mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix testing isolation
AS::Testing::Isolation has two ways to isolate the process:
forking and subprocessing. The second way is used on JRuby and other
platforms that don't support forking.
The way how subprocessing works is that we prepare a command to run a
new process:
```
/opt/rubies/2.3.0/bin/ruby -I{skipped_load_path} test/initializable_test.rb '' -nInitializableTests::Basic#test_Initializer_provides_context's_class_name
```
As you see, there's unescaped quote at the end of the line.
It leads to:
```
sh: -c: line 0: unexpected EOF while looking for matching `''
sh: -c: line 1: syntax error: unexpected end of file
```
This fixes tests on MRI + NO_FORK variable and on JRuby 🎉
This commit is contained in:
parent
3a558aa2bc
commit
3261470452
1 changed files with 2 additions and 1 deletions
|
@ -2,6 +2,7 @@ module ActiveSupport
|
|||
module Testing
|
||||
module Isolation
|
||||
require "thread"
|
||||
require "shellwords"
|
||||
|
||||
def self.included(klass) #:nodoc:
|
||||
klass.class_eval do
|
||||
|
@ -80,7 +81,7 @@ module ActiveSupport
|
|||
|
||||
load_paths = $-I.map { |p| "-I\"#{File.expand_path(p)}\"" }.join(" ")
|
||||
orig_args = ORIG_ARGV.join(" ")
|
||||
test_opts = "-n#{self.class.name}##{self.name}"
|
||||
test_opts = "-n#{self.class.name}##{Shellwords.escape(self.name)}"
|
||||
command = "#{Gem.ruby} #{load_paths} #{$0} '#{orig_args}' #{test_opts}"
|
||||
|
||||
# IO.popen lets us pass env in a cross-platform way
|
||||
|
|
Loading…
Reference in a new issue