Skip to content

Using a wildcard argument matcher inside a block given to #stub or #mock doesn't seem to work #93

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mcmire opened this issue Mar 17, 2013 · 0 comments
Labels

Comments

@mcmire
Copy link
Collaborator

mcmire commented Mar 17, 2013

This test fails:

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant