Rspec:be_succes(不是be_success)通过
Rspec: be_succes(not be_success) passes
我在我的一项测试中注意到我的响应检查有错字,expect(response).to be_succes
而不是 expect(response).to be_success
。测试通过了。为什么测试还是通过了?
response.succes?
returns:
Failure/Error: response.succes?
NoMethodError:
undefined method `succes?' for #<ActionController::TestResponse:0x007fe6e22a2530>
我有一个chat with the guys at RSpec about this issue and it turns out that this is a somewhat intentional operation and is due to the present_tense_predicate
and predicate
methods in RSpec: https://github.com/rspec/rspec-expectations/blob/master/lib/rspec/matchers/built_in/be.rb#L248。
作为提出此问题的结果,已提议在 RSpec 4 中删除此问题:https://github.com/rspec/rspec-expectations/issues/935.
我在我的一项测试中注意到我的响应检查有错字,expect(response).to be_succes
而不是 expect(response).to be_success
。测试通过了。为什么测试还是通过了?
response.succes?
returns:
Failure/Error: response.succes?
NoMethodError:
undefined method `succes?' for #<ActionController::TestResponse:0x007fe6e22a2530>
我有一个chat with the guys at RSpec about this issue and it turns out that this is a somewhat intentional operation and is due to the present_tense_predicate
and predicate
methods in RSpec: https://github.com/rspec/rspec-expectations/blob/master/lib/rspec/matchers/built_in/be.rb#L248。
作为提出此问题的结果,已提议在 RSpec 4 中删除此问题:https://github.com/rspec/rspec-expectations/issues/935.