Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/rake/testtask.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def run_code # :nodoc:
when :"test-unit"
"-S test-unit"
when :rake
"#{__dir__}/rake_test_loader.rb"
"\"#{__dir__}/rake_test_loader.rb\""
end
end

Expand Down
21 changes: 21 additions & 0 deletions test/test_rake_functional.rb
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,27 @@ def test_test_task_when_verbose_unless_verbose_passed_not_prompt_testopts
refute_match exp, @out
end

def test_test_task_with_rake_installed_under_path_with_space
spaced_root = File.join @tempdir, "rake with space"
FileUtils.mkdir_p spaced_root
FileUtils.cp_r @rake_lib, spaced_root
@ruby_options = ["-I#{File.join spaced_root, "lib"}", "-I."]

rakefile <<~TEST_TASK
require "rake/testtask"

Rake::TestTask.new(:test) do |t|
t.test_files = ["a_test.rb"]
end
TEST_TASK
File.write "a_test.rb", "puts 'ATEST'\n"

rake "test"

assert_match(/^ATEST$/, @out)
assert_predicate @exit, :success?, @err
end

def test_comment_before_task_acts_like_desc
rakefile_comments

Expand Down
10 changes: 10 additions & 0 deletions test/test_rake_test_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,16 @@ def test_run_code_rake
Gem.loaded_specs["rake"] = rake
end

def test_run_code_rake_quotes_loader_path
test_task = Rake::TestTask.new do |t|
t.loader = :rake
end

loader = File.expand_path("../lib/rake/rake_test_loader.rb", __dir__)

assert_equal "\"#{loader}\"", test_task.run_code
end

def test_test_files_equals
tt = Rake::TestTask.new do |t|
t.test_files = FileList["a.rb", "b.rb"]
Expand Down