Skip to content

Fix Propshaft tests - Take 2#51913

Merged
dhh merged 1 commit intorails:propshaft-by-defaultfrom
lazaronixon:propshaft-by-default-test-2
May 26, 2024
Merged

Fix Propshaft tests - Take 2#51913
dhh merged 1 commit intorails:propshaft-by-defaultfrom
lazaronixon:propshaft-by-default-test-2

Conversation

@lazaronixon
Copy link
Contributor

This PR fixes tests blocking Propshaft from being merged to rails.

@rails-bot rails-bot bot added the railties label May 25, 2024
@lazaronixon lazaronixon marked this pull request as draft May 25, 2024 02:32
@lazaronixon lazaronixon force-pushed the propshaft-by-default-test-2 branch 7 times, most recently from be4684c to 474a2eb Compare May 25, 2024 21:10
@lazaronixon lazaronixon force-pushed the propshaft-by-default-test-2 branch 13 times, most recently from e6a2650 to aa9284b Compare May 26, 2024 01:15
@lazaronixon lazaronixon force-pushed the propshaft-by-default-test-2 branch 4 times, most recently from d21813a to 42697c4 Compare May 26, 2024 02:17
@lazaronixon lazaronixon force-pushed the propshaft-by-default-test-2 branch from 42697c4 to ec9197e Compare May 26, 2024 02:23
Copy link

@ItaloCobains ItaloCobains left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sonds good

@lazaronixon lazaronixon marked this pull request as ready for review May 26, 2024 02:35
@lazaronixon
Copy link
Contributor Author

@dhh

@dhh dhh merged commit 35d34b2 into rails:propshaft-by-default May 26, 2024
@dhh
Copy link
Member

dhh commented May 26, 2024

Excellent work, @lazaronixon!!

dhh added a commit that referenced this pull request May 26, 2024
* Change asset pipeline default to Propshaft

* Use :all for stylesheets when propshaft is active

* Switch to using propshaft as the default (still need to find a way to tests against sprockets too)

* Fix tests that rely on sprockets being used

* Fix Propshaft tests (#51913)

* Update railties/test/generators/shared_generator_tests.rb

Co-authored-by: Lázaro Nixon <lazaronixon@hotmail.com>

---------

Co-authored-by: Lázaro Nixon <lazaronixon@hotmail.com>
PROJECT_ROOT = File.expand_path("../../../../", __dir__)
ALLOWED_WARNINGS = Regexp.union(
/circular require considered harmful.*delayed_job/, # Bug in delayed job.
/circular require considered harmful.*rails-html-sanitizer/, # Bug when sprockets-rails is not required.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is a bug in one of Rails' gems, why aren't fixing instead of delaying the problem? Who is expected to fix this?

FileUtils.mkdir_p(app_template_path)

sh "#{Gem.ruby} #{RAILS_FRAMEWORK_ROOT}/railties/exe/rails new #{app_template_path} --skip-bundle --no-rc --quiet"
sh "#{Gem.ruby} #{RAILS_FRAMEWORK_ROOT}/railties/exe/rails new #{app_template_path} --asset-pipeline=sprockets --skip-bundle --no-rc --quiet"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this just delaying the problem? The test app is still generating using sprockets. Who is supposed to fix this?

# app-specific one: we don't want to require every gem that lists.
contents = File.read("#{app_template_path}/config/application.rb")
contents.sub!(/^Bundler\.require.*/, "%w(importmap-rails).each { |r| require r }")
contents.sub!(/^Bundler\.require.*/, "%w(sprockets/railtie importmap-rails).each { |r| require r }")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to do this? sprockets-rails already require this file, so Bundler.require should just work.

xjunior pushed a commit to xjunior/rails that referenced this pull request Jun 9, 2024
* Change asset pipeline default to Propshaft

* Use :all for stylesheets when propshaft is active

* Switch to using propshaft as the default (still need to find a way to tests against sprockets too)

* Fix tests that rely on sprockets being used

* Fix Propshaft tests (rails#51913)

* Update railties/test/generators/shared_generator_tests.rb

Co-authored-by: Lázaro Nixon <lazaronixon@hotmail.com>

---------

Co-authored-by: Lázaro Nixon <lazaronixon@hotmail.com>
Set2005 pushed a commit to Set2005/fix-association-initialize-order that referenced this pull request Jul 8, 2024
* Change asset pipeline default to Propshaft

* Use :all for stylesheets when propshaft is active

* Switch to using propshaft as the default (still need to find a way to tests against sprockets too)

* Fix tests that rely on sprockets being used

* Fix Propshaft tests (rails#51913)

* Update railties/test/generators/shared_generator_tests.rb

Co-authored-by: Lázaro Nixon <lazaronixon@hotmail.com>

---------

Co-authored-by: Lázaro Nixon <lazaronixon@hotmail.com>
DanielaVelasquez pushed a commit to DanielaVelasquez/rails that referenced this pull request Oct 3, 2024
* Change asset pipeline default to Propshaft

* Use :all for stylesheets when propshaft is active

* Switch to using propshaft as the default (still need to find a way to tests against sprockets too)

* Fix tests that rely on sprockets being used

* Fix Propshaft tests (rails#51913)

* Update railties/test/generators/shared_generator_tests.rb

Co-authored-by: Lázaro Nixon <lazaronixon@hotmail.com>

---------

Co-authored-by: Lázaro Nixon <lazaronixon@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants