Search code examples
ruby-on-railstestingrspecshoulda

multiple shoulds in a rails rspec block - do they all have to be true to pass the test


If I have:

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

does that mean that every condition (all 4) have to pass for the overall condition to pass?


Solution

  • Yes. The first failure will cause the test to fail.