~ubuntu-branches/ubuntu/oneiric/puppet/oneiric-security

« back to all changes in this revision

Viewing changes to vendor/gems/rspec/spec/spec/mocks/any_number_of_times_spec.rb

  • Committer: Bazaar Package Importer
  • Author(s): Micah Anderson
  • Date: 2008-07-26 15:43:45 UTC
  • mto: (3.1.1 lenny) (1.3.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: james.westby@ubuntu.com-20080726154345-1fmgo76b4l72ulvc
ImportĀ upstreamĀ versionĀ 0.24.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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