我希望这些测试不会“失败”,但会被标记为待处理.也许我没有使用正确的或正确的指令为水豚专门吗?
feature 'Tenant Scoping ' do scenario "displays only Tenant A's things" do pending end scenario "displays only Tenant B's things" do pending end end
以下是运行时的输出:
Tenant Scoping displays only Tenant A's things (Failed - 1) displays only Tenant B's things (Failed - 2) Failures: 1) Tenant Scoping displays only Tenant A's things FIXED Expected pending 'No reason given' to fail. No Error was raised. # ./spec/features/tenants/scopingtest_spec.rb:3 2) Tenant Scoping displays only Tenant B's things FIXED Expected pending 'No reason given' to fail. No Error was raised. # ./spec/features/tenants/scopingtest_spec.rb:7 Finished in 0.04047 seconds (files took 1.62 seconds to load) 2 examples,2 failures
解决方法
从RSpec 3起,如果通过,未决的示例将被视为失败.尝试使用skip而不是pending来完全跳过这些规范.
有关更多信息,请参阅Notable Changes in RSpec 3.