Skip to content

Add propshaft specs for railties new default#52122

Closed
tute wants to merge 12 commits intorails:mainfrom
tute:tc-propshaft-specs
Closed

Add propshaft specs for railties new default#52122
tute wants to merge 12 commits intorails:mainfrom
tute:tc-propshaft-specs

Conversation

@tute
Copy link
Contributor

@tute tute commented Jun 13, 2024

Motivation / Background

In #51799 @dhh changed asset pipeline default to Propshaft in Rails 8; specs assumed sprockets though so the new default isn't being tested.

@fedesapuppo and I reconvert test/application/assets_test.rb to test the propshaft default (dropping several sprockets-specific tests now unneeded), and duplicated the original file into a test/application/sprockets_assets_test.rb to continue testing that option. Both run fine independently, but loading them together leaves the propshaft railtie loaded for both versions, messing with the sprockets configuration and tests. How could we decouple them properly?

Thanks to @rafaelfranca for helping us get started generating a template app for each asset pipeline option.

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Unrelated changes should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • [doesn't apply] Tests are added or updated if you fix a bug or add a feature.
  • [doesn't apply] CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

tute and others added 12 commits June 13, 2024 18:36
Create `sprockets_assets_test.rb` file that will contain the
sprockets-specific tests of `assets_test.rb` (which in turn will contain
the tests common to both pipelines).

Generate new temporary directory for template app configured for the
sprockets asset pipeline.

Both `sprockets_assets_test.rb` and `assets_test.rb` files run fine
independently, but when ran together, loading propshaft breaks
`config.assets` for the Sprockets test. How could we run them together?
- Remove `.erb` extension
- Change `asset_path` helper for `url` helper
- Update manifest directory
- Update hash key
Need to tell Propshaft proper URL or ask it's assembly for the proper
digest (but that's already tested in the gem).
@rails-bot rails-bot bot added the railties label Jun 13, 2024
@tute
Copy link
Contributor Author

tute commented Jul 1, 2024

Pinging @rafaelfranca please about the question on railties for each library colliding with each other. Thank you! 💖

@zzak
Copy link
Member

zzak commented Sep 14, 2024

Both run fine independently, but loading them together leaves the propshaft railtie loaded for both versions, messing with the sprockets configuration and tests. How could we decouple them properly?

This happens if you simply require "propshaft" in sprockets_assets_test.rb, but since these tests are designed to run in isolation it shouldn't be a problem.

I've wrapped up these tests and fixed the rest of propshaft tests based on #52887 in a new PR (#52899), thanks for your work on this!

@zzak zzak closed this Sep 14, 2024
@tute
Copy link
Contributor Author

tute commented Sep 14, 2024

Oh I thought we had to load both for testing all files on a single test process. Thank you @zzak!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants