Skip to content

Commit 7550b34

Browse files
committed
Fix undefined method to_h for ENV
1 parent 57a5ce4 commit 7550b34

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

features/support/env.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def run_command(cmd, timeout = nil)
1414
end
1515

1616
def unset_bundler_env_vars
17-
empty_env = with_environment { with_unbundled_env { ENV.to_h } }
17+
empty_env = with_environment { with_unbundled_env { env_to_h } }
1818
aruba_env = aruba.environment.to_h
1919
(aruba_env.keys - empty_env.keys).each do |key|
2020
delete_environment_variable key
@@ -31,6 +31,14 @@ def with_unbundled_env
3131
Bundler.with_clean_env { yield }
3232
end
3333
end
34+
35+
def env_to_h
36+
if RUBY_VERSION > '2.0'
37+
ENV.to_h
38+
else
39+
ENV.inject({}) { |h, (k, v)| h[k] = v; h }
40+
end
41+
end
3442
end
3543

3644
World(ArubaExt)

0 commit comments

Comments
 (0)