summaryrefslogtreecommitdiff
path: root/spec/support/helpers.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/helpers.rb')
-rw-r--r--spec/support/helpers.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb
index 9be5955ac3..4eb98645a5 100644
--- a/spec/support/helpers.rb
+++ b/spec/support/helpers.rb
@@ -131,8 +131,6 @@ module Spec
load_path << spec
load_path_str = "-I#{load_path.join(File::PATH_SEPARATOR)}"
- env = env.map {|k, v| "#{k}='#{v}'" }.join(" ")
-
args = options.map do |k, v|
case v
when nil
@@ -146,8 +144,8 @@ module Spec
end
end.join
- cmd = "#{env} #{sudo} #{Gem.ruby} #{load_path_str} #{requires_str} #{bundle_bin} #{cmd}#{args}"
- sys_exec(cmd) {|i, o, thr| yield i, o, thr if block_given? }
+ cmd = "#{sudo} #{Gem.ruby} #{load_path_str} #{requires_str} #{bundle_bin} #{cmd}#{args}"
+ sys_exec(cmd, env) {|i, o, thr| yield i, o, thr if block_given? }
end
bang :bundle
@@ -216,10 +214,12 @@ module Spec
"#{Gem.ruby} -S #{ENV["GEM_PATH"]}/bin/rake"
end
- def sys_exec(cmd)
+ def sys_exec(cmd, env = {})
command_execution = CommandExecution.new(cmd.to_s, Dir.pwd)
- Open3.popen3(cmd.to_s) do |stdin, stdout, stderr, wait_thr|
+ env = env.map {|k, v| [k.to_s, v.to_s] }.to_h # convert env keys and values to string
+
+ Open3.popen3(env, cmd.to_s) do |stdin, stdout, stderr, wait_thr|
yield stdin, stdout, wait_thr if block_given?
stdin.close