rspec/rspec-core — Issue #547: Customized ordering strategy for running specs
Author: jingweno
Created: 2012-01-04 23:26:28+00:00
State: open

I noticed that spec can be run in random order (https://github.com/rspec/rspec-core/blob/master/lib/rspec/core/extensions/ordered.rb#L12-13). Would it make sense to provide an extension point to run spec in customized order?

Here are some sudo codes:

```ruby
# spec_helper.rb
RSpec.configure do |config|
config.order_strategy = lambda {
...
}
end

module RSpec
module Core
# @private
module Extensions
# @private
# Used to extend lists of examples and groups to support ordering
# strategies like randomization.
module Ordered
# @private
def ordered
if RSpec.configuration.randomize?
Kernel.srand RSpec.configuration.seed
sort_by { Kernel.rand size }
elsif !RSpec.configuration.order_strategy.nil?
sort_by { RSpec.configuration.order_stategy }
else
self
end
end
end
end
end
end
```

It would be nice if I can define what order my specs are running to maximize the feedback loop (more important spec runs first)