@@ -503,6 +503,20 @@ def exec_name
503
503
assert_failure %(bin/rails runner 'require "sqlite3"') , stderr : "sqlite3"
504
504
end
505
505
506
+ if RUBY_VERSION >= "2.0.0"
507
+ test "changing the gems.rb works" do
508
+ FileUtils . mv ( app . gemfile , app . gems_rb )
509
+ FileUtils . mv ( app . gemfile_lock , app . gems_locked )
510
+
511
+ assert_success %(bin/rails runner 'require "sqlite3"')
512
+
513
+ File . write ( app . gems_rb , app . gems_rb . read . sub ( %{gem 'sqlite3'} , %{# gem 'sqlite3'} ) )
514
+ app . await_reload
515
+
516
+ assert_failure %(bin/rails runner 'require "sqlite3"') , stderr : "sqlite3"
517
+ end
518
+ end
519
+
506
520
test "changing the Gemfile works when Spring calls into itself" do
507
521
File . write ( app . path ( "script.rb" ) , <<-RUBY . strip_heredoc )
508
522
gemfile = Rails.root.join("Gemfile")
@@ -517,6 +531,25 @@ def exec_name
517
531
assert_success [ %(bin/rails runner 'load Rails.root.join("script.rb")') , timeout : 60 ]
518
532
end
519
533
534
+ if RUBY_VERSION >= "2.0.0"
535
+ test "changing the gems.rb works when spring calls into itself" do
536
+ FileUtils . mv ( app . gemfile , app . gems_rb )
537
+ FileUtils . mv ( app . gemfile_lock , app . gems_locked )
538
+
539
+ File . write ( app . path ( "script.rb" ) , <<-RUBY . strip_heredoc )
540
+ gemfile = Rails.root.join("gems.rb")
541
+ File.write(gemfile, "\# {gemfile.read}gem 'text'\\ n")
542
+ Bundler.with_clean_env do
543
+ system(#{ app . env . inspect } , "bundle install")
544
+ end
545
+ output = `\# {Rails.root.join('bin/rails')} runner 'require "text"; puts "done";'`
546
+ exit output.include? "done\n "
547
+ RUBY
548
+
549
+ assert_success [ %(bin/rails runner 'load Rails.root.join("script.rb")') , timeout : 60 ]
550
+ end
551
+ end
552
+
520
553
test "changing the environment between runs" do
521
554
File . write ( app . application_config , "#{ app . application_config . read } \n ENV['BAR'] = 'bar'" )
522
555
0 commit comments