Minitest有proveit!
RSpec是否具有类似的要求断言的方式?
答案 0 :(得分:1)
这是我的看法
, 'DELETE');
答案 1 :(得分:0)
您可以为此配置RSpec,请检查以下内容:
https://github.com/rspec/rspec-core/issues/404#issuecomment-11431199和http://blog.sorah.jp/2012/12/17/rspec-warn-for-no-expectations
基本上,您需要设置after
挂钩并检查是否有预期运行的元数据:
(以防万一,如果网址不正确,则复制代码)
RSpec.configure do |config|
config.after(:each) do
result = self.example.metadata[:execution_result]
has_mock_expectations = RSpec::Mocks.space.instance_eval{receivers}.empty?
if !result[:exception] && !result[:pending_message] && !RSpec::Matchers.last_should && hasnt_mock_expectations
$stderr.puts "[WARN] No expectations found in example at #{self.example.location}: Maybe you forgot to write `should` in the example?"
end
end
end