1describe "Mock" do
2 before do
3 @mock = mock("test mock")
4 end
5
6 specify "when one example has an expectation (non-mock) inside the block passed to the mock" do
7 @mock.should_receive(:msg) do |b|
8 b.should be_true #this call exposes the problem
9 end
10 @mock.msg(false) rescue nil
11 end
12
13 specify "then the next example should behave as expected instead of saying" do
14 @mock.should_receive(:foobar)
15 @mock.foobar
16 @mock.rspec_verify
17 begin
18 @mock.foobar
19 rescue Exception => e
20 e.message.should == "Mock 'test mock' received unexpected message :foobar with (no args)"
21 end
22 end
23end
24