Deprecate using `with` without arguments.
Created by: yousuketto
RSpec3.0 prohibit using with
without arguments.
example spec
class Dummy
end
RSpec.describe Dummy do
let(:dummy){Dummy.new}
it "use 'with()'" do
expect(dummy).to receive(:dummy_method).with().and_return("this is dummy method.")
expect(dummy.dummy_method).to eq("this is dummy method.")
end
end
execute by rspec2.99
$ bundle exec rspec example_spec.rb
.
Finished in 0.00211 seconds
1 example, 0 failures
execute by rspec3.0
$ bundle exec rspec example_spec.rb
F
Failures:
1) Dummy use 'with()'
Failure/Error: expect(dummy).to receive(:dummy_method).with().and_return("this is dummy method.")
ArgumentError:
`with` must have at least one argument. Use `no_args` matcher to set the expectation of receiving no arguments.
# ./example_spec.rb:7:in `block (2 levels) in <top (required)>'
Finished in 0.02599 seconds (files took 0.21393 seconds to load)
1 example, 1 failure