Skip to content
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

satisfy conflict with rspec2 #49

Open
tight opened this issue Dec 10, 2010 · 3 comments
Open

satisfy conflict with rspec2 #49

tight opened this issue Dec 10, 2010 · 3 comments
Labels

Comments

@tight
Copy link

tight commented Dec 10, 2010

rr's satisfy wildcard matchers conflicts with rspec2's one

In order to use rr's satisfy, you can just add a method in RR::Adapters::RRMethods :
module RR::Adapters::RRMethods
def rrsatisfy(&block)
RR::WildcardMatchers::Satisfy.new(block)
end
end

You can now use
mock(object).foobar(rrsatisfy {|arg| arg.length == 2})
object.foobar("xy")

@mb-dev
Copy link

mb-dev commented Dec 30, 2011

I just encountered that. I wonder how it's not fixed by now

@mcmire
Copy link
Collaborator

mcmire commented Mar 15, 2013

For future reference: all RR methods are aliased as rr_*, so in this case you can use #rr_satisfy.

@mcmire mcmire closed this as completed Mar 15, 2013
@mcmire
Copy link
Collaborator

mcmire commented Mar 29, 2013

I am reopening this.

The reason why this is happening is because in RSpec, in order to set up an example group, two things happen:

  1. a module which represents the mock framework (RR) is mixed into the example group
  2. a module which represents the expectation framework (rspec-expectations) is then mixed into the example group

(source)

So, RSpec's #satisfy is indeed overriding RR's #satisfy.

@mcmire mcmire reopened this Mar 29, 2013
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

3 participants