Skip to content

Commit

Permalink
Debug test_app_update_preserves_sprockets
Browse files Browse the repository at this point in the history
  • Loading branch information
zzak committed Jun 7, 2024
1 parent fbace5c commit 85421d5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions railties/test/generators/app_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def test_app_update_preserves_sprockets
FileUtils.cd(destination_root) do
config = "config/environments/production.rb"
assert_no_changes -> { File.readlines(config).grep(/config\.assets/) } do
run_app_update
run_app_update(quietly: false)
end
end
end
Expand Down Expand Up @@ -1479,13 +1479,16 @@ def assert_no_node_files
end
end

def run_app_update(app_root = destination_root, flags: "--force")
def run_app_update(app_root = destination_root, flags: "--force", quietly: true)
Dir.chdir(app_root) do
gemfile_contents = File.read("Gemfile")
gemfile_contents.sub!(/^(gem "rails").*/, "\\1, path: #{File.expand_path("../../..", __dir__).inspect}")
File.write("Gemfile", gemfile_contents)

quietly { system({ "BUNDLE_GEMFILE" => "Gemfile" }, "bin/rails app:update #{flags}", exception: true) }
if quietly
quietly { system({ "BUNDLE_GEMFILE" => "Gemfile" }, "bin/rails app:update #{flags}", exception: true) }
end
system({ "BUNDLE_GEMFILE" => "Gemfile" }, "bin/rails app:update #{flags}", exception: true)
end
end

Expand Down

0 comments on commit 85421d5

Please sign in to comment.