File tree Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -6,9 +6,30 @@ def run_command(cmd, timeout = nil)
6
6
exec_cmd = cmd =~ /^rspec/ ? "bin/#{ cmd } " : cmd
7
7
# Ensure bundler env vars are unset
8
8
unset_bundler_env_vars
9
- # Ensure the correct Gemfile is found
9
+ # Ensure the correct Gemfile and binstubs are found
10
10
in_current_directory do
11
- super ( exec_cmd , timeout )
11
+ with_unbundled_env do
12
+ super ( exec_cmd , timeout )
13
+ end
14
+ end
15
+ end
16
+
17
+ def unset_bundler_env_vars
18
+ empty_env = with_environment { with_unbundled_env { ENV . to_h } }
19
+ aruba_env = aruba . environment . to_h
20
+ ( aruba_env . keys - empty_env . keys ) . each do |key |
21
+ delete_environment_variable key
22
+ end
23
+ empty_env . each do |k , v |
24
+ set_environment_variable k , v
25
+ end
26
+ end
27
+
28
+ def with_unbundled_env
29
+ if Bundler . respond_to? ( :with_unbundled_env )
30
+ Bundler . with_unbundled_env { yield }
31
+ else
32
+ Bundler . with_clean_env { yield }
12
33
end
13
34
end
14
35
end
You can’t perform that action at this time.
0 commit comments