1 require File.dirname(__FILE__) + '/../../spec_helper.rb'
5 describe "a mock acting as a NullObject" do
7 @mock = Mock.new("null_object", :null_object => true)
10 it "should allow explicit expectation" do
11 @mock.should_receive(:something)
15 it "should fail verification when explicit exception not met" do
17 @mock.should_receive(:something)
19 end.should raise_error(MockExpectationError)
22 it "should ignore unexpected methods" do
23 @mock.random_call("a", "d", "c")
27 it "should expected message with different args first" do
28 @mock.should_receive(:message).with(:expected_arg)
29 @mock.message(:unexpected_arg)
30 @mock.message(:expected_arg)
33 it "should expected message with different args second" do
34 @mock.should_receive(:message).with(:expected_arg)
35 @mock.message(:expected_arg)
36 @mock.message(:unexpected_arg)