]> git.openstreetmap.org Git - rails.git/blob - vendor/gems/rspec-1.1.2/spec/spec/mocks/any_number_of_times_spec.rb
added RSpec and RSpec on Rails
[rails.git] / vendor / gems / rspec-1.1.2 / spec / spec / mocks / any_number_of_times_spec.rb
1 require File.dirname(__FILE__) + '/../../spec_helper.rb'
2
3 module Spec
4   module Mocks
5     
6     describe "AnyNumberOfTimes" do
7       before(:each) do
8         @mock = Mock.new("test mock")
9       end
10
11       it "should pass if any number of times method is called many times" do
12         @mock.should_receive(:random_call).any_number_of_times
13         (1..10).each do
14           @mock.random_call
15         end
16       end
17
18       it "should pass if any number of times method is called once" do
19         @mock.should_receive(:random_call).any_number_of_times
20         @mock.random_call
21       end
22       
23       it "should pass if any number of times method is not called" do
24         @mock.should_receive(:random_call).any_number_of_times
25       end
26     end
27
28   end
29 end