1 require File.dirname(__FILE__) + '/../../spec_helper.rb'
7 @mock = Mock.new("test mock")
10 it "should fail if method is never called" do
11 @mock.should_receive(:random_call).at_least(4).times
14 end.should raise_error(MockExpectationError)
17 it "should fail when called less than n times" do
18 @mock.should_receive(:random_call).at_least(4).times
24 end.should raise_error(MockExpectationError)
27 it "should fail when at least once method is never called" do
28 @mock.should_receive(:random_call).at_least(:once)
31 end.should raise_error(MockExpectationError)
34 it "should fail when at least twice method is called once" do
35 @mock.should_receive(:random_call).at_least(:twice)
39 end.should raise_error(MockExpectationError)
42 it "should fail when at least twice method is never called" do
43 @mock.should_receive(:random_call).at_least(:twice)
46 end.should raise_error(MockExpectationError)
49 it "should pass when at least n times method is called exactly n times" do
50 @mock.should_receive(:random_call).at_least(4).times
58 it "should pass when at least n times method is called n plus 1 times" do
59 @mock.should_receive(:random_call).at_least(4).times
68 it "should pass when at least once method is called once" do
69 @mock.should_receive(:random_call).at_least(:once)
74 it "should pass when at least once method is called twice" do
75 @mock.should_receive(:random_call).at_least(:once)
81 it "should pass when at least twice method is called three times" do
82 @mock.should_receive(:random_call).at_least(:twice)
89 it "should pass when at least twice method is called twice" do
90 @mock.should_receive(:random_call).at_least(:twice)