Skip to content

Commit 4097394

Browse files
committed
Fix integration test rails CLI not found in unbundled env
1 parent 465af42 commit 4097394

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

spec/integration/rails_app_spec.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
RSpec.describe "Rails integration", :integration do
1010
GEM_ROOT = File.expand_path("../..", __dir__)
1111

12-
def run_cmd!(cmd, chdir:)
13-
output, status = Bundler.with_unbundled_env do
12+
def run_cmd!(cmd, chdir:, unbundled: true)
13+
output, status = if unbundled
14+
Bundler.with_unbundled_env { Open3.capture2e(cmd, chdir: chdir) }
15+
else
1416
Open3.capture2e(cmd, chdir: chdir)
1517
end
1618
unless status.success?
@@ -23,8 +25,8 @@ def run_cmd!(cmd, chdir:)
2325
@tmpdir = Dir.mktmpdir("fixturebot_integration")
2426
@app_dir = File.join(@tmpdir, "dummy_app")
2527

26-
# Create a new minimal Rails app
27-
run_cmd!("rails new dummy_app --minimal --skip-git --skip-docker --skip-bundle", chdir: @tmpdir)
28+
# Create a new minimal Rails app (runs within parent bundle to find rails CLI)
29+
run_cmd!("rails new dummy_app --minimal --skip-git --skip-docker --skip-bundle", chdir: @tmpdir, unbundled: false)
2830

2931
# Add fixturebot to Gemfile
3032
gemfile = File.join(@app_dir, "Gemfile")

0 commit comments

Comments
 (0)