Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Record invocations for stubs with stub_everything = true

  • Loading branch information...
commit a4149be5b4d08a38a034e55d389d86ad4b05dc44 1 parent 5640e51
@opsb authored
Showing with 24 additions and 0 deletions.
  1. +8 −0 lib/bourne/mock.rb
  2. +16 −0 test/acceptance/spy_test.rb
View
8 lib/bourne/mock.rb
@@ -16,6 +16,14 @@ def method_missing(symbol, *arguments, &block)
message = UnexpectedInvocation.new(self, symbol, *arguments).to_s
message << Mockery.instance.mocha_inspect
raise ExpectationError.new(message, caller)
+ else
+ target = if self.respond_to? :mocha
+ self.mocha
+ else
+ mocha
+ end
+ Mockery.instance.invocation(target, symbol, arguments)
+ nil
end
end
end
View
16 test/acceptance/spy_test.rb
@@ -142,3 +142,19 @@ def new_instance
stub
end
end
+
+class StubEverythingSpyTest < Test::Unit::TestCase
+ include AcceptanceTest
+ def setup
+ setup_acceptance_test
+ end
+
+ def teardown
+ teardown_acceptance_test
+ end
+ def test_should_match_invocations_with_no_explicit_stubbing
+ instance = stub_everything
+ instance.surprise!
+ assert_received(instance, :surprise!)
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.