Allow order specs by modification time
Created by: MatheusRich
Subject of the issue
Quite often is useful to run tests that you've just modified. RSpec lets you to define custom ordering, so I have this snipped configured in my projects:
config.register_ordering(:global) do |items|
items.sort_by { |item| -File.mtime(item.metadata[:absolute_file_path]).to_i }
end
I thought it might be useful to upstream this for more users to use this with an option --order modification_time
. Thoughts?
Your environment
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux-musl]
RSpec 3.9
- rspec-core 3.9.2
- rspec-expectations 3.9.2
- rspec-mocks 3.9.1
- rspec-rails 4.0.1
- rspec-support 3.9.3