【问题标题】:multiple shoulds in a rails rspec block - do they all have to be true to pass the testrails rspec 块中的多个应该 - 它们是否都必须为真才能通过测试
【发布时间】:2011-10-18 21:33:14
【问题描述】:

如果我有:

it "should raise an ActiveABC::IllegalStatement exception do
  @var.set_cmd(:output => 'a.pdf').should == "output a pdf"
  @var.set_cmd(:output  => 'a.pdf').should == File.new(path_to_pdf(;fields.pdf)).should == "output -"
  @var.set_cmd(:output  => 'a.pdf').should == Tempfile.new('specs')).should == "output -"
  @var.set_cmd(:output  => 'a.pdf').should == StringIO.new('specs')).should == "output -"
end

这是否意味着每个条件(全部 4 个)都必须通过才能通过整体条件?

【问题讨论】:

    标签: ruby-on-rails testing rspec shoulda


    【解决方案1】:

    是的。第一次失败将导致测试失败。

    【讨论】:

    • 我不明白其中一个失败如何意味着测试通过了。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多