@@ -503,6 +503,20 @@ def exec_name
503503 assert_failure %(bin/rails runner 'require "sqlite3"') , stderr : "sqlite3"
504504 end
505505
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+
506520 test "changing the Gemfile works when Spring calls into itself" do
507521 File . write ( app . path ( "script.rb" ) , <<-RUBY . strip_heredoc )
508522 gemfile = Rails.root.join("Gemfile")
@@ -517,6 +531,25 @@ def exec_name
517531 assert_success [ %(bin/rails runner 'load Rails.root.join("script.rb")') , timeout : 60 ]
518532 end
519533
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+
520553 test "changing the environment between runs" do
521554 File . write ( app . application_config , "#{ app . application_config . read } \n ENV['BAR'] = 'bar'" )
522555
0 commit comments