Hi there,
I'm basing my question on this one: http://stackoverflow.com/questions/1583760/rspec-mocks-verify-expectations-in-it-should-methods and also on these guidelines: http://eggsonbread.com/2010/03/28/my-rspec-best-practices-and-tips/
So, if there should be only one expectation per "it" block, what if I'm mixing mocks expectations with value expectations?
Example:
describe Foo, "#bar" do
before :all do
@baz = mock(Baz)
@foo = Foo.new(@baz)
end
it "should call waka on @baz" do
@baz.should_receive(:waka)
end
it "should not be empty afterwards" do
@foo.should_not be_empty
end
it "should not raise exceptions" do
lambda {@foo.bar}.should_not raise_exception # potentially with side effects?
end
after :all do
@foo.bar # won't work with the second expectation
end
end
I hope the problem is clear. Does anybody has experience with organizing specs on this case? Am I doing some mistake?