@@ -12,9 +12,11 @@ class AcceptanceTest < ActiveSupport::TestCase
12
12
13
13
def rails_version
14
14
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"
16
18
else
17
- ' ~> 6.0.0'
19
+ " ~> #{ ENV [ 'RAILS_VERSION' ] || "6.1" } .0"
18
20
end
19
21
end
20
22
@@ -157,7 +159,7 @@ def without_gem(name)
157
159
end
158
160
159
161
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 " )
161
163
162
164
assert_speedup do
163
165
assert_success app . spring_test_command , stdout : "0 failures"
@@ -271,6 +273,7 @@ def exec_name
271
273
test "binstub when spring gem is missing" do
272
274
without_gem "spring-#{ Spring ::VERSION } " do
273
275
File . write ( app . gemfile , app . gemfile . read . gsub ( /gem 'spring.*/ , "" ) )
276
+ app . run! "bundle install" , timeout : 300
274
277
assert_success "bin/rake -T" , stdout : "rake db:migrate"
275
278
end
276
279
end
@@ -518,7 +521,8 @@ def exec_name
518
521
test "changing the Gemfile works" do
519
522
assert_success %(bin/rails runner 'require "sqlite3"')
520
523
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
522
526
app . await_reload
523
527
524
528
assert_failure %(bin/rails runner 'require "sqlite3"') , stderr : "sqlite3"
@@ -530,7 +534,7 @@ def exec_name
530
534
531
535
assert_success %(bin/rails runner 'require "sqlite3"')
532
536
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" } ) )
534
538
app . await_reload
535
539
536
540
assert_failure %(bin/rails runner 'require "sqlite3"') , stderr : "sqlite3"
@@ -540,7 +544,7 @@ def exec_name
540
544
File . write ( app . path ( "script.rb" ) , <<-RUBY . strip_heredoc )
541
545
gemfile = Rails.root.join("Gemfile")
542
546
File.write(gemfile, "\# {gemfile.read}gem 'text'\\ n")
543
- Bundler.with_clean_env do
547
+ Bundler.with_unbundled_env do
544
548
system(#{ app . env . inspect } , "bundle install")
545
549
end
546
550
output = `\# {Rails.root.join('bin/rails')} runner 'require "text"; puts "done";'`
@@ -557,7 +561,7 @@ def exec_name
557
561
File . write ( app . path ( "script.rb" ) , <<-RUBY . strip_heredoc )
558
562
gemfile = Rails.root.join("gems.rb")
559
563
File.write(gemfile, "\# {gemfile.read}gem 'text'\\ n")
560
- Bundler.with_clean_env do
564
+ Bundler.with_unbundled_env do
561
565
system(#{ app . env . inspect } , "bundle install")
562
566
end
563
567
output = `\# {Rails.root.join('bin/rails')} runner 'require "text"; puts "done";'`
0 commit comments