rspec-mocks
rspec-mocks copied to clipboard
RSpec's 'test double' framework, with support for stubbing and mocking
### Subject of the issue When overwriting a class' `.new` method in order to return a subclass and expecting that method to be called with `.and_call_original`, we end up with...
### Subject of the issue Calling `expect(...).to receive(...).with(...)` with a composed matcher doesn't use the full capabilities of the passed matcher in order to provide a more precise error message...
### Subject of the issue I was trying to use rspec expectations' compound feature as in `expect().to have_received().and.have_received()` (actually for using with `.ordered`), but the `and` method is missing from...
### Subject of the issue When using `and_wrap_original` on `allow_any_instance_of(SomeModule)`, calling the original method results in a `SystemStackError`. It appears that the method passed by `and_wrap_original` is actually the stubbed...
I think there might be a thread-safety issue with stub_chain. I am occasionally getting this error: ``` gems/rspec-mocks-2.99.4/lib/rspec/mocks/any_instance/stub_chain.rb:17:in `
``` ruby RSpec.describe "Specifying ordering for calls that are interleaved with each other" do it 'fails when using `have_received`' do dbl = spy dbl.one dbl.one dbl.two dbl.one dbl.two expect(dbl).to have_received(:one).twice.ordered...
### Background Apologies if this isn't the best place to have this discussion. What follows is a largely incomplete idea but one I think is potentially useful and I wanted...
Given the following the RSpec, ``` describe UserDecorator do let(:user) { User.new } let(:decorated_user) { user.decorate } describe '#greeting' do # Failing spec it 'uses DecoratedUser#name' do expect(decorated_user).to receive(:name).and_call_original decorated_user.greeting...
We recently upgraded to ruby 2.5.1 and had a regression in our test suite. I isolated the failure to expecting a method to be called on a partial class double...
(Moved here from rspec/rspec-core#1370). If you define a custom matcher and use it in mocks with `should_receive` and you call the function more often than expected, then `inspect` is used...