rspec-mocks icon indicating copy to clipboard operation
rspec-mocks copied to clipboard

RSpec's 'test double' framework, with support for stubbing and mocking

Results 71 rspec-mocks issues
Sort by recently updated
recently updated
newest added

### Subject of the issue I am performing a complex expectation as described in the [arbitrary handling](https://github.com/rspec/rspec-mocks#arbitrary-handling) section of the docs. Here is the expectation: ```ruby expect(double).to receive(:method) do |item:,...

### Subject of the issue A special combination of `any_instance_of` calls can prevent `rspec-mocks` from properly restoring the originally mocked method method during it cleanup step. I'm only able to...

This came up in rspec/rspec-expectations#1017 we need to duplicate args we capture for later replay onto expectations, in case they are mutated downstream. This seems like an "ok" way to...

When using nested method calls and blocks, stubbing a super class method will leak into the child class for the duration of the block. First reported on rspec/rspec-core#2563 (with reproduction...

This is @kaiwren's `a_block` argument matcher with fleshed out sad path specs, and a refactoring of the match logic to allow mixing with other arguments. Review please @kaiwren @ioquatix @benoittgt.

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...

This comes from tracking down https://github.com/rspec/rspec-rails/issues/2049 wherein ``` it 'should show only 2 times' do expect(@student).to receive(:email).once.and_call_original @student.email @student.email end ``` overflows. There `Devise` has defined an `inspect` method which...

Demonstration of rspec/rspec-mocks#1098

Hi! What to you think about a possibility to stub not only instances of some class, but instances that satisfy some preconditions? Concerning the syntax I'd think about something like:...