Open
Description
Summary
The RSpec/ReceiveNever cop says:
Prefer
not_to receive(...)
overreceive(...).never
When running rspec it says:
allow(...).not_to receive
is not supported since it doesn't really make sense. What would it even mean?
Either I'm doing something wrong, or the whole cop is invalid.
Details
In #628 the RSpec/ReceiveNever cop was added, but there's this code:
https://github.com/puppetlabs/puppetlabs-stdlib/blob/7e7ded41443750e6643599fa02ad4456e781fede/spec/functions/loadjson_spec.rb#L31-L35
Or a minimal example: allow(JSON).to receive(:parse).never
. The cop suggests this should be allow(JSON).not_to receive(:parse)
but when I run that, the tests fail with:
$ bundle exec rspec ./spec/functions/loadjson_spec.rb
...
Failures:
1) loadjson when calling with valid arguments when a non-existing file is specified
Failure/Error: allow(JSON).not_to receive(:parse)
`allow(...).not_to receive` is not supported since it doesn't really make sense. What would it even mean?
# ./spec/functions/loadjson_spec.rb:34:in `block (4 levels) in <top (required)>'
# /home/ekohl/.local/share/gem/ruby/bin/rspec:25:in `load'
# /home/ekohl/.local/share/gem/ruby/bin/rspec:25:in `<top (required)>'
# /usr/bin/bundle:25:in `load'
# /usr/bin/bundle:25:in `<main>'
Metadata
Metadata
Assignees
Labels
No labels