Skip to content

Commit

Permalink
Avoid breaking cucumber task when new bundler update gets out
Browse files Browse the repository at this point in the history
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
  • Loading branch information
benoittgt authored and JonRowe committed Jan 12, 2020
1 parent e1a5008 commit 1c6273d
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions features/support/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,31 @@
module ArubaExt
def run_command(cmd, timeout = nil)
exec_cmd = cmd =~ /^rspec/ ? "bin/#{cmd}" : cmd
# Ensure bundler env vars are unset
unset_bundler_env_vars
# Ensure the correct Gemfile is found
# Ensure the correct Gemfile and binstubs are found
in_current_directory do
super(exec_cmd, timeout)
with_unbundled_env do
super(exec_cmd, timeout)
end
end
end

def unset_bundler_env_vars
empty_env = with_environment { with_unbundled_env { ENV.to_h } }
aruba_env = aruba.environment.to_h
(aruba_env.keys - empty_env.keys).each do |key|
delete_environment_variable key
end
empty_env.each do |k, v|
set_environment_variable k, v
end
end

def with_unbundled_env
if Bundler.respond_to?(:with_unbundled_env)
Bundler.with_unbundled_env { yield }
else
Bundler.with_clean_env { yield }
end
end
end
Expand Down

0 comments on commit 1c6273d

Please sign in to comment.