@@ -393,12 +393,18 @@ def run_generator_using_prerelease(args)
393
393
394
394
generator ( positional_args , option_args )
395
395
396
+ prerelease_commands = [ ]
397
+ prerelease_command_rails_gems = [ ]
396
398
rails_gem_pattern = /^gem ["']rails["'], .+/
397
- bundle_command_rails_gems = [ ]
399
+
398
400
@bundle_command_stub = -> ( command , *) do
399
401
@bundle_commands << command
400
- assert_file File . expand_path ( "Gemfile" , project_path ) do |gemfile |
401
- bundle_command_rails_gems << gemfile [ rails_gem_pattern ]
402
+
403
+ if command . start_with? ( "install" , "exec rails" )
404
+ prerelease_commands << command
405
+ assert_file File . expand_path ( "Gemfile" , project_path ) do |gemfile |
406
+ prerelease_command_rails_gems << gemfile [ rails_gem_pattern ]
407
+ end
402
408
end
403
409
end
404
410
@@ -408,13 +414,11 @@ def run_generator_using_prerelease(args)
408
414
end
409
415
410
416
assert_file File . expand_path ( "Gemfile" , project_path ) do |gemfile |
411
- assert_equal "install" , @bundle_commands [ 0 ]
412
- assert_match "lock --add-platform" , @bundle_commands [ 1 ]
413
-
414
- assert_equal gemfile [ rails_gem_pattern ] , bundle_command_rails_gems [ 0 ]
417
+ assert_equal "install" , prerelease_commands [ 0 ]
418
+ assert_equal gemfile [ rails_gem_pattern ] , prerelease_command_rails_gems [ 0 ]
415
419
416
- assert_match %r"^exec rails (?:plugin )?new #{ Regexp . escape Shellwords . join ( expected_args ) } " , @bundle_commands [ 2 ]
417
- assert_equal gemfile [ rails_gem_pattern ] , bundle_command_rails_gems [ 1 ]
420
+ assert_match %r"^exec rails (?:plugin )?new #{ Regexp . escape Shellwords . join ( expected_args ) } " , prerelease_commands [ 1 ]
421
+ assert_equal gemfile [ rails_gem_pattern ] , prerelease_command_rails_gems [ 1 ]
418
422
end
419
423
end
420
424
0 commit comments