@@ -825,7 +825,7 @@ def test_no_skip_javascript_option_with_no_skip_javascript_argument
825
825
end
826
826
827
827
def test_hotwire
828
- run_generator [ destination_root , "--no-skip-bundle" ]
828
+ run_generator_and_bundler [ destination_root ]
829
829
assert_gem "turbo-rails"
830
830
assert_gem "stimulus-rails"
831
831
assert_file "app/views/layouts/application.html.erb" do |content |
@@ -848,15 +848,15 @@ def test_skip_hotwire
848
848
end
849
849
850
850
def test_css_option_with_asset_pipeline_tailwind
851
- run_generator [ destination_root , "--css" , " tailwind" , "--no-skip-bundle "]
851
+ run_generator_and_bundler [ destination_root , "--css= tailwind" ]
852
852
assert_gem "tailwindcss-rails"
853
853
assert_file "app/views/layouts/application.html.erb" do |content |
854
854
assert_match ( /tailwind/ , content )
855
855
end
856
856
end
857
857
858
858
def test_css_option_with_cssbundling_gem
859
- run_generator [ destination_root , "--css" , " postcss" , "--no-skip-bundle "]
859
+ run_generator_and_bundler [ destination_root , "--css= postcss" ]
860
860
assert_gem "cssbundling-rails"
861
861
assert_file "app/assets/stylesheets/application.postcss.css"
862
862
end
@@ -1068,6 +1068,20 @@ def test_name_option
1068
1068
end
1069
1069
1070
1070
private
1071
+ def run_generator_and_bundler ( args )
1072
+ option_args , positional_args = args . partition { |arg | arg . start_with? ( "--" ) }
1073
+ option_args << "--no-skip-bundle"
1074
+ generator ( positional_args , option_args )
1075
+
1076
+ # Stub `rails_gemfile_entry` so that Bundler resolves `gem "rails"` to the
1077
+ # current repository instead of searching for an invalid version number
1078
+ # (for a version that hasn't been released yet).
1079
+ rails_gemfile_entry = Rails ::Generators ::AppBase ::GemfileEntry . path ( "rails" , Rails ::Generators ::RAILS_DEV_PATH )
1080
+ generator . stub ( :rails_gemfile_entry , -> { rails_gemfile_entry } ) do
1081
+ quietly { run_generator_instance }
1082
+ end
1083
+ end
1084
+
1071
1085
def run_app_update ( app_root = destination_root )
1072
1086
Dir . chdir ( app_root ) do
1073
1087
gemfile_contents = File . read ( "Gemfile" )
0 commit comments