[rspec-users] Expectations on Class Methods

s.ross cwdinfo at gmail.com
Tue Nov 27 15:13:32 EST 2007


Sorry about the non-specific subject. Here's what I'm trying to do. I  
have a method:

DataMapper::Database.setup

That I want to create an expectation on. I wrote:

DataMapper::Database.should_receive(:setup).once.and_return 
(connection_hash)

The call to setup is invoked in the "Object" namespace. I.e., it is  
setup code, and not in any method or class.

I can see that the class method is being called rather than the  
expectation. Is there something obvious I'm missing?

Thanks,

--s


More information about the rspec-users mailing list