[rspec-users] #describe behavior with a module

Gary Wright gwtmp01 at mac.com
Sat Feb 16 17:19:00 EST 2008


Consider:

module X
   def initialize(a)
     super()
   end
end

describe X do

   it "is a module" do
     X.should be_instance_of(Module)
   end
end

This generates an error because #describe tries to include X into the  
test harness and the test harness doesn't know about the extra  
argument to #initialize.

The work around is to just use 'describe "X" do' but I spent a bit of  
time just trying to figure out what was going on.

Why is #describe trying to include the module?

Gary Wright


More information about the rspec-users mailing list