1 require File.dirname(__FILE__) + '/spec_helper'
3 describe "A consumer of a mock" do
4 it "should be able to send messages to the mock" do
6 mock.should_receive(:poke)
12 it "should be able to mock the same message twice w/ different args" do
14 mock.should_receive(:msg).with(:arg1).and_return(:val1)
15 mock.should_receive(:msg).with(:arg2).and_return(:val2)
16 mock.msg(:arg1).should eql(:val1)
17 mock.msg(:arg2).should eql(:val2)
20 it "should be able to mock the same message twice w/ different args in reverse order" do
22 mock.should_receive(:msg).with(:arg1).and_return(:val1)
23 mock.should_receive(:msg).with(:arg2).and_return(:val2)
24 mock.msg(:arg2).should eql(:val2)
25 mock.msg(:arg1).should eql(:val1)