ruby on rails - rspec `with` must have at least one argument. error after upgrade to 3.1.0 -


i upgrading our code base use rspec 3.1.0 , following docs here: https://relishapp.com/rspec/docs/upgrade

one of existing tests following error after running transpec.

"with must have @ least 1 argument. use no_args matcher set expectation of receiving no arguments."

here test.

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

does new synatx not receive block anymore?

this deprecated in version 2.99 , removed in rspec 3. can see details here: https://github.com/rspec/rspec-mocks/issues/377.

you can accomplish same test with:

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

Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -