describe SomeThing do
before :all do
# ...
FooClass.stub(:fooMethod).with('a').and_return("something")
end
end
Worked cool with rspec 1.
I’ve updated to rspec 2, and this is what i’m receiving for this line now:
Failure/Error:
FooClass.stub(:fooMethod).with('a').and_return("something")
NoMethodError:
undefined method `stub' for FooClass::Class
The rspec api but says: Person.stub(:find) { person }
What am i missing?
Is this inside an
itorbeforeblock?Stubs are not supported in
before :allblocks. Stubs and mocks get cleared after each example. You can read more about this here. Change thebefore :all dotobefore doand this should work.