]> git.openstreetmap.org Git - rails.git/blobdiff - 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
diff --git a/vendor/gems/rspec-1.1.2/spec/spec/mocks/any_number_of_times_spec.rb b/vendor/gems/rspec-1.1.2/spec/spec/mocks/any_number_of_times_spec.rb
new file mode 100644 (file)
index 0000000..3f50dcf
--- /dev/null
@@ -0,0 +1,29 @@
+require File.dirname(__FILE__) + '/../../spec_helper.rb'
+
+module Spec
+  module Mocks
+    
+    describe "AnyNumberOfTimes" do
+      before(:each) do
+        @mock = Mock.new("test mock")
+      end
+
+      it "should pass if any number of times method is called many times" do
+        @mock.should_receive(:random_call).any_number_of_times
+        (1..10).each do
+          @mock.random_call
+        end
+      end
+
+      it "should pass if any number of times method is called once" do
+        @mock.should_receive(:random_call).any_number_of_times
+        @mock.random_call
+      end
+      
+      it "should pass if any number of times method is not called" do
+        @mock.should_receive(:random_call).any_number_of_times
+      end
+    end
+
+  end
+end