Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit 42b0abf

Browse files
committed
Rename modification time to recently modified ordering
1 parent 8f9ed99 commit 42b0abf

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

features/command_line/order.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ order of groups at each level is randomized.
1313

1414
With `rand` you can also specify a seed.
1515

16-
Use `modification_time` to run the most recently modified files first. You can
17-
combine it with `--next-failure` to find the most recent failing spec.
16+
Use `recently-modified` to run the most recently modified files first. You can
17+
combine it with `--only-failures` to find the most recent failing specs. Note
18+
that `recently-modified` and `rand` are mutually exclusives.
1819

1920
## Example usage
2021

@@ -25,5 +26,5 @@ config file (e.g. `.rspec`) and you want to override it from the command line.
2526
--order rand
2627
--order rand:123
2728
--seed 123 # same as --order rand:123
28-
--modification_time
29+
--order recently-modified
2930
</code></pre>

lib/rspec/core/option_parser.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def parser(options)
6262
' [rand] randomize the order of groups and examples',
6363
' [random] alias for rand',
6464
' [random:SEED] e.g. --order random:123',
65-
' [modification_time] run the most recently modified files first') do |o|
65+
' [recently-modified] run the most recently modified files first') do |o|
6666
options[:order] = o
6767
end
6868

lib/rspec/core/ordering.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def jenkins_hash_digest(string)
6060

6161
# @private
6262
# Orders items by modification time (most recent modified first).
63-
class ModificationTime
63+
class RecentlyModified
6464
def order(list)
6565
list.sort_by { |item| -File.mtime(item.metadata[:absolute_file_path]).to_i }
6666
end
@@ -86,7 +86,7 @@ def initialize(configuration)
8686
@strategies = {}
8787

8888
register(:random, Random.new(configuration))
89-
register(:modification_time, ModificationTime.new)
89+
register(:recently_modified, RecentlyModified.new)
9090

9191
identity = Identity.new
9292
register(:defined, identity)
@@ -141,8 +141,8 @@ def order=(type)
141141
:random
142142
elsif order == 'defined'
143143
:defined
144-
elsif order == 'modification_time'
145-
:modification_time
144+
elsif order == 'recently-modified'
145+
:recently_modified
146146
end
147147

148148
register_ordering(:global, ordering_registry.fetch(ordering_name)) if ordering_name

spec/rspec/core/ordering_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def order_with(seed)
8181
end
8282
end
8383

84-
RSpec.describe ModificationTime do
84+
RSpec.describe RecentlyModified do
8585
before do
8686
allow(File).to receive(:mtime).with('./file_1.rb').and_return(::Time.new)
8787
allow(File).to receive(:mtime).with('./file_2.rb').and_return(::Time.new + 1)
@@ -90,7 +90,7 @@ def order_with(seed)
9090
it 'orders list by file modification time' do
9191
file_1 = instance_double(Example, :metadata => { :absolute_file_path => './file_1.rb' })
9292
file_2 = instance_double(Example, :metadata => { :absolute_file_path => './file_2.rb' })
93-
strategy = ModificationTime.new
93+
strategy = RecentlyModified.new
9494

9595
expect(strategy.order([file_1, file_2])).to eq([file_2, file_1])
9696
end

0 commit comments

Comments
 (0)