[rspec-users] Any way to continue on Assertion Failure

Pat Maddox pat.maddox at gmail.com
Mon Jun 1 14:59:24 EDT 2009

Let's say I've got this spec:

describe Team, "add_player" do
  it "should add a player to the team" do
    team = Team.new
    player = Player.new :name => "Pat"
    team.add_player player
    team.should have(1).players
    team.players.first.name.should == "Pat"

and for some reason
team.should have(1).players
fails.  Do I get any value from seeing the second expectation fail?
What if it passes?

My suggestion is to break up your long running test flow into bits
that you can test individually, that run quickly and independently of
each other.  Get those tested, and have an integration test which
makes sure that everything works together.


On Tue, May 26, 2009 at 4:33 PM, Gary Lin <glin at employees.org> wrote:
> Hi,
> I wonder if there is any way to tell the test script to continue even when
> encountering an assertion failure?  The reason I am asking this is because I
> have a test flow that can take a long time to run and it would be very
> useful if I can perform all verification at the end of test flow in one shot
> rather than fail one and exit immediately.  Of course, I could break each
> verification point into separate test case, but then it will double or
> triple the overall execution time.  Does RSpec support this?
> Thanks,
> --Gary
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list