it 'should be an array and not be empty' do
pending
expect(a.class).to be(Array)
expect(a.empty?).to be(false)
expect(a.first.class).to be(ExampleClass)
end
当我运行 rspec 时:
Failures:
1) should be an array and not be empty FIXED
Expected pending 'No reason given' to fail. No Error was raised.
# ./spec/example_spec.rb:19
知道为什么这会被列为失败吗?
最佳答案
从 Rspec 3.x 开始,pending specs 实际上会运行,如果它们通过了,就被认为是失败的(因为如果它通过了,那么 Rspec 认为它不应该是 pending)。
您可以使用 skip
而不是 pending
来确保您的规范实际上没有运行。
关于ruby-on-rails - rspec 在失败测试中的未决结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25041974/