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

Refactoring Mocks::Proxy to make it easier to treat blocks similarly to args for expectations matchers like a_block #1241

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

kaiwren
Copy link
Contributor

@kaiwren kaiwren commented Oct 5, 2018

Ref the conversation #1237 (comment)

Redid the a_block change after refactoring Mocks::Proxy to make it easier to treat blocks similarly to args for expectations matchers like a_block - this PR includes all the commits originally made in #1237

  # Matches if a block is passed implicitly i.e is invoked
  # using `yield` in the receiving method
  #
  # @example
  #   expect(object).to receive(:message).with(a_block)
  #
  #   # matches any of these:
  #   object.message { }
  #   empty_lambda = lambda { }
  #   object.message(&empty_lambda)
  #   empty_proc = Proc.new { }
  #   object.message(&empty_proc)

kaiwren and others added 12 commits September 17, 2018 04:37
…tcher

* cucumber feature passing
* happy path unit specs passing
* need help fixing sad path unit specs, currently marked pending
- Make api consistent in using `*args, &block` throughout
… delegate all @messages_received related logic to them
…ys) allowing usage of ReceivedMessages#all_args
…age-from-Proxy

- Add spec to cover stubs with block args
- Pass block to MessageExpecation#match? consistently in ReceivedMessage
@@ -122,3 +122,28 @@ Feature: Matching arguments
"""
When I run `rspec responding_differently_spec.rb`
Then the examples should all pass

Scenario: Expecting a method invocatin with a block
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"invocation"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed in 9bc5f79

@kaiwren
Copy link
Contributor Author

kaiwren commented Oct 14, 2018

OK I have this green for all rubies except for 1.8.7, ree and jruby 1.7 (all three with the same red spec). I'm having trouble installing 1.8.7/ree on my box, will try with jruby 1.7.

@JonRowe JonRowe changed the base branch from master to main August 2, 2020 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants