@@ -12,9 +12,11 @@ class AcceptanceTest < ActiveSupport::TestCase
1212
1313 def rails_version
1414 if ENV [ 'RAILS_VERSION' ] == "edge"
15- "7.0.0.alpha"
15+ "7.1.0.alpha"
16+ elsif ENV [ 'RAILS_VERSION' ] == "7.0"
17+ ">= 7.0.0.alpha"
1618 else
17- ' ~> 6.0.0'
19+ " ~> #{ ENV [ 'RAILS_VERSION' ] || "6.1" } .0"
1820 end
1921 end
2022
@@ -157,7 +159,7 @@ def without_gem(name)
157159 end
158160
159161 test "code changes in pre-referenced app files are picked up" do
160- File . write ( app . path ( "config/initializers/load_posts_controller.rb" ) , "PostsController\n " )
162+ File . write ( app . path ( "config/initializers/load_posts_controller.rb" ) , "Rails.application.config.to_prepare { PostsController } \n " )
161163
162164 assert_speedup do
163165 assert_success app . spring_test_command , stdout : "0 failures"
@@ -271,6 +273,7 @@ def exec_name
271273 test "binstub when spring gem is missing" do
272274 without_gem "spring-#{ Spring ::VERSION } " do
273275 File . write ( app . gemfile , app . gemfile . read . gsub ( /gem 'spring.*/ , "" ) )
276+ app . run! "bundle install" , timeout : 300
274277 assert_success "bin/rake -T" , stdout : "rake db:migrate"
275278 end
276279 end
@@ -518,7 +521,8 @@ def exec_name
518521 test "changing the Gemfile works" do
519522 assert_success %(bin/rails runner 'require "sqlite3"')
520523
521- File . write ( app . gemfile , app . gemfile . read . gsub ( %{gem 'sqlite3'} , %{# gem 'sqlite3'} ) )
524+ File . write ( app . gemfile , app . gemfile . read . gsub ( %r{gem ['"]sqlite3['"]} , %{# gem "sqlite3"} ) )
525+ puts app . gemfile . read
522526 app . await_reload
523527
524528 assert_failure %(bin/rails runner 'require "sqlite3"') , stderr : "sqlite3"
@@ -530,7 +534,7 @@ def exec_name
530534
531535 assert_success %(bin/rails runner 'require "sqlite3"')
532536
533- File . write ( app . gems_rb , app . gems_rb . read . sub ( % {gem ' sqlite3' }, %{# gem ' sqlite3' } ) )
537+ File . write ( app . gems_rb , app . gems_rb . read . gsub ( %r {gem ['"] sqlite3['"] }, %{# gem " sqlite3" } ) )
534538 app . await_reload
535539
536540 assert_failure %(bin/rails runner 'require "sqlite3"') , stderr : "sqlite3"
@@ -540,7 +544,7 @@ def exec_name
540544 File . write ( app . path ( "script.rb" ) , <<-RUBY . strip_heredoc )
541545 gemfile = Rails.root.join("Gemfile")
542546 File.write(gemfile, "\# {gemfile.read}gem 'text'\\ n")
543- Bundler.with_clean_env do
547+ Bundler.with_unbundled_env do
544548 system(#{ app . env . inspect } , "bundle install")
545549 end
546550 output = `\# {Rails.root.join('bin/rails')} runner 'require "text"; puts "done";'`
@@ -557,7 +561,7 @@ def exec_name
557561 File . write ( app . path ( "script.rb" ) , <<-RUBY . strip_heredoc )
558562 gemfile = Rails.root.join("gems.rb")
559563 File.write(gemfile, "\# {gemfile.read}gem 'text'\\ n")
560- Bundler.with_clean_env do
564+ Bundler.with_unbundled_env do
561565 system(#{ app . env . inspect } , "bundle install")
562566 end
563567 output = `\# {Rails.root.join('bin/rails')} runner 'require "text"; puts "done";'`
0 commit comments