代码之家  ›  专栏  ›  技术社区  ›  typeoneerror

如何将Capybara功能测试标记为待定?

  •  10
  • typeoneerror  · 技术社区  · 10 年前

    我希望这些测试不会“失败”,而是标记为待定。也许我没有专门针对Capybara使用待定或正确的指令?

    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
    
    2 回复  |  直到 10 年前
        1
  •  14
  •   Phil    10 年前

    只需将“scenario”替换为“xscenario”。

    唯一的缺点是它会将整个特性标记为待定,而不是每个单独的规范。

        2
  •  10
  •   Dylan Markow    10 年前

    从RSpec 3开始,挂起的示例如果通过,则被视为失败 skip 而不是 pending 完全跳过这些规格。

    看见 Notable Changes in RSpec 3 了解更多信息。