Skip to content

Instantly share code, notes, and snippets.

@MatheusRich
Created January 23, 2020 16:36
Show Gist options
  • Save MatheusRich/c5b9055e8320a0aad410264a0a505b51 to your computer and use it in GitHub Desktop.
Save MatheusRich/c5b9055e8320a0aad410264a0a505b51 to your computer and use it in GitHub Desktop.
How to sort Rspec specs by file modification time
RSpec.configure do |config|
config.register_ordering(:global) do |items|
items.sort_by { |item| -File.mtime(item.metadata[:absolute_file_path]).to_i }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment