[rspec-users] specing class methods
Courtenay
court3nay at gmail.com
Fri Apr 13 14:30:02 EDT 2007
> 1. How do I spec out class methods? (please point me to docs, if
> any. I can only find class level specing on "partial mocks" (of
> rails class objects)
This doesn't work?
Autotest.spec!(:run)
or do you perhaps want to return a proc that gets called?
> 2. How can I tell that new.run has been called, without saying
> should_receive(:new) and should_receive(:run) in separate specs?
If you want instance method stubs, that's handled by mocha but AFAIK
not rspec. Mocha does it something like
Autotest.any_instance.stubs(:run)
This'd be a great rspec feature (or maybe I just couldn't find it).
Or maybe you want to do it more like
test = Autotest.new
test.should_receive(:run)
I don't know about the rest, still learning :)
More information about the rspec-users
mailing list