Skip to content

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

Created by: kaiwren

Ref the conversation https://github.com/rspec/rspec-mocks/pull/1237#issuecomment-422313561

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 https://github.com/rspec/rspec-mocks/pull/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)

Merge request reports