Permalink
Browse files

Add feature for any_instance.should_receive use case

  • Loading branch information...
1 parent 1f64f6d commit d0d5e99ddec0519c6d1e167e93e3e395f7a9bc00 @alindeman alindeman committed Mar 30, 2011
Showing with 19 additions and 0 deletions.
  1. +19 −0 features/message_expectations/any_instance.feature
@@ -0,0 +1,19 @@
+Feature: expect a message on any instance of a class
+
+ Use `any_instance.should_receive` to set an expectation that one (and only
+ one) instance of a class receives a message before the example is completed.
+
+ Scenario: expect a message on any instance of a class
+ Given a file named "example_spec.rb" with:
+ """
+ describe "any_instance.should_receive" do
+ it "verifies that one instance of the class receives the message" do
+ Object.any_instance.should_receive(:foo).and_return(:return_value)
+
+ o = Object.new
+ o.foo.should eq(:return_value)
+ end
+ end
+ """
+ When I run `rspec example_spec.rb`
+ Then the output should contain "0 failures"

0 comments on commit d0d5e99

Please sign in to comment.