Skip to content

Commit

Permalink
wip test - ensure bundler uses local gems
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrocha committed Jan 18, 2025
1 parent 55bea35 commit a463c0a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions spec/helpers/mock_project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ def bundle_install!(version: nil)
# so in this case, we install whichever is the latest
if ::Gem::Version.new(bundler_version).prerelease?
::Gem.install("bundler")
"bundle install"
"bundle config set --local path 'vendor/bundle' && bundle install"
else
::Gem.install("bundler", bundler_version)
"bundle _#{bundler_version}_ install"
"bundle config set --local path 'vendor/bundle' && bundle _#{bundler_version}_ install"
end

out, err, status = Open3.capture3(cmd, opts)
Expand All @@ -101,6 +101,10 @@ def bundle_install!(version: nil)
def bundle_exec(command, env = {})
opts = {}
opts[:chdir] = absolute_path
env = {
"BUNDLE_PATH" => "vendor/bundle",
"BUNDLE_GEMFILE" => File.join(absolute_path, "Gemfile"),
}.merge(env)
Bundler.with_unbundled_env do
out, err, status = Open3.capture3(env, ["bundle", "_#{bundler_version}_", "exec", command].join(" "), opts)
Spoom::ExecResult.new(out: out, err: err, status: T.must(status.success?), exit_code: T.must(status.exitstatus))
Expand Down

0 comments on commit a463c0a

Please sign in to comment.