This repository was archived by the owner on Nov 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +11
-10
lines changed Expand file tree Collapse file tree 4 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,9 @@ order of groups at each level is randomized.
13
13
14
14
With ` rand ` you can also specify a seed.
15
15
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.
18
19
19
20
## Example usage
20
21
@@ -25,5 +26,5 @@ config file (e.g. `.rspec`) and you want to override it from the command line.
25
26
--order rand
26
27
--order rand:123
27
28
--seed 123 # same as --order rand:123
28
- --modification_time
29
+ --order recently-modified
29
30
</code ></pre >
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ def parser(options)
62
62
' [rand] randomize the order of groups and examples' ,
63
63
' [random] alias for rand' ,
64
64
' [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 |
66
66
options [ :order ] = o
67
67
end
68
68
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ def jenkins_hash_digest(string)
60
60
61
61
# @private
62
62
# Orders items by modification time (most recent modified first).
63
- class ModificationTime
63
+ class RecentlyModified
64
64
def order ( list )
65
65
list . sort_by { |item | -File . mtime ( item . metadata [ :absolute_file_path ] ) . to_i }
66
66
end
@@ -86,7 +86,7 @@ def initialize(configuration)
86
86
@strategies = { }
87
87
88
88
register ( :random , Random . new ( configuration ) )
89
- register ( :modification_time , ModificationTime . new )
89
+ register ( :recently_modified , RecentlyModified . new )
90
90
91
91
identity = Identity . new
92
92
register ( :defined , identity )
@@ -141,8 +141,8 @@ def order=(type)
141
141
:random
142
142
elsif order == 'defined'
143
143
:defined
144
- elsif order == 'modification_time '
145
- :modification_time
144
+ elsif order == 'recently-modified '
145
+ :recently_modified
146
146
end
147
147
148
148
register_ordering ( :global , ordering_registry . fetch ( ordering_name ) ) if ordering_name
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ def order_with(seed)
81
81
end
82
82
end
83
83
84
- RSpec . describe ModificationTime do
84
+ RSpec . describe RecentlyModified do
85
85
before do
86
86
allow ( File ) . to receive ( :mtime ) . with ( './file_1.rb' ) . and_return ( ::Time . new )
87
87
allow ( File ) . to receive ( :mtime ) . with ( './file_2.rb' ) . and_return ( ::Time . new + 1 )
@@ -90,7 +90,7 @@ def order_with(seed)
90
90
it 'orders list by file modification time' do
91
91
file_1 = instance_double ( Example , :metadata => { :absolute_file_path => './file_1.rb' } )
92
92
file_2 = instance_double ( Example , :metadata => { :absolute_file_path => './file_2.rb' } )
93
- strategy = ModificationTime . new
93
+ strategy = RecentlyModified . new
94
94
95
95
expect ( strategy . order ( [ file_1 , file_2 ] ) ) . to eq ( [ file_2 , file_1 ] )
96
96
end
You can’t perform that action at this time.
0 commit comments