rspec-expectations icon indicating copy to clipboard operation
rspec-expectations copied to clipboard

Deprecation request: RSpec::Matchers#be with no arguments

Open tom-lord opened this issue 10 years ago • 11 comments

https://github.com/rspec/rspec-expectations/blob/master/lib/rspec/matchers.rb#L320-L322 https://github.com/rspec/rspec-expectations/blob/master/lib/rspec/matchers/built_in/be.rb#L104-L106

I think that the following:

expect(foo).to be

Should be deprecated, in favour of:

expect(foo).to be_truthy

The existence of the former has just caused me some pain, since someone had written the following test:

expect(json.size).to be      ## (they forgot to specify a number!!!)

- And the test was silently passing, despite testing nothing of any use! (They could have used eq rather than be, which would have immediately highlighted the problem, but oh well.)

Is there a genuine use case I've not thought of, or can we get rid of this argument-free signature of the method?

tom-lord avatar Apr 08 '15 13:04 tom-lord