Skip to content

Commit 37635e6

Browse files
committed
Fix breaking change of execution order on TestTask
Due to #357, execution order on Rake 13.0.2 changes from Rake 13.0.1. Example: ``` Rake::TestTask do |t| t.test_files = [ "test/a.rb", "test/b.rb", ] end ``` On 13.0.2, Rake executes test/b.rb before test/a.rb because test/a.rb are loaded before rake_test_loader.rb. rake_test_loader.rb executes the Ruby code in ARGV using Kernel.#require, but does not execute test/a.rb which is already loaded. In addition, Rake 13.0.1 allows specifying test_files without .rb but 13.0.2 doesn't allows. This commit also fixes this problem. ``` Rake::TestTask do |t| t.test_files = [ "test/setup", "test/a.rb", ] end ```
1 parent 65be0c7 commit 37635e6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/rake/testtask.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def run_code # :nodoc:
181181
when :testrb
182182
"-S testrb"
183183
when :rake
184-
"-r#{__dir__}/rake_test_loader"
184+
"#{__dir__}/rake_test_loader.rb"
185185
end
186186
end
187187

test/test_rake_test_task.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def test_run_code_rake
128128
t.loader = :rake
129129
end
130130

131-
assert_match(/\A-r.*?\Z/, test_task.run_code)
131+
assert_includes test_task.run_code, "lib/rake/rake_test_loader.rb"
132132
ensure
133133
Gem.loaded_specs["rake"] = rake
134134
end

0 commit comments

Comments
 (0)