可以将 RSpec 配置为使任何不包含任何期望的示例失败吗?

Can RSpec be configured to fail any example which does not contain any expectations?

我知道在 RSpec 中,您可以通过省略块轻松地将示例标记为不完整:

it 'is not a complete example'

但是是否有可能让 RSpec 使任何不包含任何期望的示例失败?

即。 RSpec 将愉快地通过这个例子:

it 'does not have any expectations but still passes' do
end

我想模拟 PHPUnit 的行为,它会在任何不包含任何断言的测试中失败。

没有内置方式,但它是 feature I'd like to see added at some point

同时,加自己也不是太难:

http://blog.sorah.jp/2012/12/17/rspec-warn-for-no-expectations