Rspec `with` must have at least one argument. error after updating to 3.1.0

I updated our code base to use rspec 3.1.0 and followed the docs here: https://relishapp.com/rspec/docs/upgrade

In one of the existing tests, I get the following error after running transpec.

" withmust have at least one argument. Use no_argsmatcher to set the wait for arguments to be received."

Here is a test.

  it 'does something' do
    expect(my_method).to receive(:resource)
      .with { |path| path.include? 'test' }.and_return({})
  end

New syntax won't get block anymore?

+4
source share
1 answer

2.99 rspec 3. : https://github.com/rspec/rspec-mocks/issues/377.

:

it 'does something' do
    expect(my_object).to receive(:resource).with(/test/).and_return({})
end
+1

All Articles