From 560f555c259576fb7e4c7bb357d5411baea68bcd Mon Sep 17 00:00:00 2001 From: Alexandre Barret Date: Mon, 25 Nov 2024 10:03:28 +1300 Subject: [PATCH] Refactor format batch of Ruby and Rake --- lib/retest/command/rake.rb | 2 +- lib/retest/command/ruby.rb | 2 +- test/retest/command/ruby_test.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/retest/command/rake.rb b/lib/retest/command/rake.rb index a58562d..9cb7330 100644 --- a/lib/retest/command/rake.rb +++ b/lib/retest/command/rake.rb @@ -10,7 +10,7 @@ def to_s end def format_batch(*files) - files.size > 1 ? "\"{#{files.join(',')}}\"" : files.first + files.size > 1 ? %Q{"{#{files.join(',')}}"} : files.first end private diff --git a/lib/retest/command/ruby.rb b/lib/retest/command/ruby.rb index bb2a40f..fdb26bc 100644 --- a/lib/retest/command/ruby.rb +++ b/lib/retest/command/ruby.rb @@ -10,7 +10,7 @@ def to_s end def format_batch(*files) - %Q{-e "#{files.map { |file| "require './#{file}';" }.join}"} + files.size > 1 ? %Q{-e "#{files.map { |file| "require './#{file}';" }.join}"} : files.first end end end diff --git a/test/retest/command/ruby_test.rb b/test/retest/command/ruby_test.rb index 3b5230b..3758d6e 100644 --- a/test/retest/command/ruby_test.rb +++ b/test/retest/command/ruby_test.rb @@ -37,7 +37,7 @@ def test_to_s end def test_format_with_one_file - assert_equal %Q{-e "require './a/file/path.rb';"}, @subject.format_batch('a/file/path.rb') + assert_equal 'a/file/path.rb', @subject.format_batch('a/file/path.rb') end def test_format_with_multiple_files