require 'minitest/autorun'
require 'rr'
class FooTest < MiniTest::Unit::TestCase
include RR::Adapters::MiniTest
attr_reader :object
def setup
@object = Object.new
end
def test_foo
mock(object) do
baz(anything).once
end
object.baz('whatever')
end
end
Output:
Run options: --seed 37148
# Running tests:
F
Finished tests in 0.003291s, 303.8590 tests/s, 0.0000 assertions/s.
1) Error:
test_foo(FooTest):
RR::Errors::DoubleNotFoundError: On subject #<Object:0x007fc11b888b30>,
unexpected method invocation:
baz("whatever")
expected invocations:
- baz(#<RR::DoubleDefinitions::DoubleDefinition:0x007fc11b883bf8 @implementation=#<Proc:0x007fc11b883a90@/Users/elliot/code/github/forks/rr/lib/rr/double_definitions/double_definition.rb:242 (lambda)>, .................. [snip]
2) Failure:
test_foo(FooTest) [/Users/elliot/tmp/rr-test.rb:18]:
anything()
Called 0 times.
Expected 1 times.
This test fails:
Output: