0
votes

I want to define some rspec specs that will run at the end of the test suite. The reason being is that they will read the log output, generate some statistics and fail if the numbers are too high. In order to run correctly the test suite needs to be finished so that the log is complete.

Is there a way to run an rspec test suite with a particular spec/tag last? I'm running the rspecs through rake at the moment so I've just defined a separate rake task that runs second, but I'd like a cleaner way if possible.

1

1 Answers

1
votes

The only options for ordering examples within an rspec file are "default" (i.e. in the order declared) or "random" (with an option to specify a "seed" value), as described in Run RSpec tasks in a specific order and its references. However, when given a set of spec files to execute, RSpec executes those specs in the order specified. So, if you're willing to put your "last" spec in a separate file, you can always just specify it as the last spec/file to be executed.