Skip to content
Browse files

Quotes ruby command in case it contains spaces

* Closes #674
  • Loading branch information...
1 parent 410155e commit 4d3b610afde1e339fde0380ae803c490fe94cc97 @alindeman alindeman committed
Showing with 8 additions and 2 deletions.
  1. +1 −0 Changelog.md
  2. +1 −1 lib/autotest/rspec2.rb
  3. +6 −1 spec/autotest/rspec_spec.rb
View
1 Changelog.md
@@ -8,6 +8,7 @@ Enhancements
* JSON Formatter (Alex Chaffee)
* Refactor rake task internals (Sam Phippen)
* Refactor HtmlFormatter (Pete Hodgson)
+* Autotest supports a path to Ruby that contains spaces (dsisnero)
Bug fixes
View
2 lib/autotest/rspec2.rb
@@ -47,7 +47,7 @@ def consolidate_failures(failed)
# Overrides Autotest's implementation to generate the rspec command to run
def make_test_cmd(files_to_test)
files_to_test.empty? ? '' :
- "#{prefix}#{ruby}#{suffix} -S '#{RSPEC_EXECUTABLE}' --tty #{normalize(files_to_test).keys.flatten.map { |f| "'#{f}'"}.join(' ')}"
+ "#{prefix}'#{ruby}'#{suffix} -S '#{RSPEC_EXECUTABLE}' --tty #{normalize(files_to_test).keys.flatten.map { |f| "'#{f}'"}.join(' ')}"
end
# Generates a map of filenames to Arrays for Autotest
View
7 spec/autotest/rspec_spec.rb
@@ -3,7 +3,7 @@
describe Autotest::Rspec2 do
let(:rspec_autotest) { Autotest::Rspec2.new }
let(:spec_cmd) { File.expand_path("../../../exe/rspec", __FILE__) }
- let(:ruby_cmd) { "ruby" }
+ let(:ruby_cmd) { "/path/to/ruby" }
before do
File.stub(:exist?) { false }
@@ -50,6 +50,11 @@
end
end
+ it "quotes the path of the ruby executable" do
+ cmd = rspec_autotest.make_test_cmd(@files_to_test)
+ cmd.should match(%r('/path/to/ruby'))
+ end
+
it "gives '--tty' to #{Autotest::Rspec2::RSPEC_EXECUTABLE}, not '--autotest'" do
cmd = rspec_autotest.make_test_cmd(@files_to_test)
cmd.should match(' --tty ')

0 comments on commit 4d3b610

Please sign in to comment.
Something went wrong with that request. Please try again.