Skip to content

Commit f9873aa

Browse files
committed
Avoid breaking cucumber task when new bundler update gets out
With new bundler update like 2.1.2 and 2.1.3 we saw issues on the CI after running `bundle exec cucumber`: ``` +/home/travis/.rvm/gems/ruby-2.6.3/gems/bundler-2.1.3/lib/bundler/runtime.rb:312:in `check_for_activated_spec!': You have already activated bundler 2.1.2, but your Gemfile requires bundler 2.1.3. Since bundler is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports bundler as a default gem. (Gem::LoadError) ``` Using the patch from mvz #2241 reduce the amount of error
1 parent 60e923a commit f9873aa

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

features/support/env.rb

+23-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,31 @@
44
module ArubaExt
55
def run_command(cmd, timeout = nil)
66
exec_cmd = cmd =~ /^rspec/ ? "bin/#{cmd}" : cmd
7-
# Ensure bundler env vars are unset
87
unset_bundler_env_vars
9-
# Ensure the correct Gemfile is found
8+
# Ensure the correct Gemfile and binstubs are found
109
in_current_directory do
11-
super(exec_cmd, timeout)
10+
with_unbundled_env do
11+
super(exec_cmd, timeout)
12+
end
13+
end
14+
end
15+
16+
def unset_bundler_env_vars
17+
empty_env = with_environment { with_unbundled_env { ENV.to_h } }
18+
aruba_env = aruba.environment.to_h
19+
(aruba_env.keys - empty_env.keys).each do |key|
20+
delete_environment_variable key
21+
end
22+
empty_env.each do |k, v|
23+
set_environment_variable k, v
24+
end
25+
end
26+
27+
def with_unbundled_env
28+
if Bundler.respond_to?(:with_unbundled_env)
29+
Bundler.with_unbundled_env { yield }
30+
else
31+
Bundler.with_clean_env { yield }
1232
end
1333
end
1434
end

0 commit comments

Comments
 (0)