]> git.openstreetmap.org Git - rails.git/blobdiff - vendor/gems/rspec-1.1.2/spec/spec/mocks/bug_report_10263.rb
added RSpec and RSpec on Rails
[rails.git] / vendor / gems / rspec-1.1.2 / spec / spec / mocks / bug_report_10263.rb
diff --git a/vendor/gems/rspec-1.1.2/spec/spec/mocks/bug_report_10263.rb b/vendor/gems/rspec-1.1.2/spec/spec/mocks/bug_report_10263.rb
new file mode 100644 (file)
index 0000000..f82180c
--- /dev/null
@@ -0,0 +1,24 @@
+describe "Mock" do
+  before do
+    @mock = mock("test mock")
+  end
+  
+  specify "when one example has an expectation (non-mock) inside the block passed to the mock" do
+    @mock.should_receive(:msg) do |b|
+      b.should be_true #this call exposes the problem
+    end
+    @mock.msg(false) rescue nil
+  end
+  
+  specify "then the next example should behave as expected instead of saying" do
+    @mock.should_receive(:foobar)
+    @mock.foobar
+    @mock.rspec_verify
+    begin
+      @mock.foobar
+    rescue => e
+      e.message.should == "Mock 'test mock' received unexpected message :foobar with (no args)"
+    end
+  end 
+end
+