Skip to content

Commit

Permalink
Remove unneeded conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Oct 26, 2020
1 parent df4ba96 commit 728f357
Showing 1 changed file with 20 additions and 24 deletions.
44 changes: 20 additions & 24 deletions test/support/acceptance_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -503,18 +503,16 @@ def exec_name
assert_failure %(bin/rails runner 'require "sqlite3"'), stderr: "sqlite3"
end

if RUBY_VERSION >= "2.0.0"
test "changing the gems.rb works" do
FileUtils.mv(app.gemfile, app.gems_rb)
FileUtils.mv(app.gemfile_lock, app.gems_locked)
test "changing the gems.rb works" do
FileUtils.mv(app.gemfile, app.gems_rb)
FileUtils.mv(app.gemfile_lock, app.gems_locked)

assert_success %(bin/rails runner 'require "sqlite3"')
assert_success %(bin/rails runner 'require "sqlite3"')

File.write(app.gems_rb, app.gems_rb.read.sub(%{gem 'sqlite3'}, %{# gem 'sqlite3'}))
app.await_reload
File.write(app.gems_rb, app.gems_rb.read.sub(%{gem 'sqlite3'}, %{# gem 'sqlite3'}))
app.await_reload

assert_failure %(bin/rails runner 'require "sqlite3"'), stderr: "sqlite3"
end
assert_failure %(bin/rails runner 'require "sqlite3"'), stderr: "sqlite3"
end

test "changing the Gemfile works when Spring calls into itself" do
Expand All @@ -531,23 +529,21 @@ def exec_name
assert_success [%(bin/rails runner 'load Rails.root.join("script.rb")'), timeout: 60]
end

if RUBY_VERSION >= "2.0.0"
test "changing the gems.rb works when spring calls into itself" do
FileUtils.mv(app.gemfile, app.gems_rb)
FileUtils.mv(app.gemfile_lock, app.gems_locked)
test "changing the gems.rb works when spring calls into itself" do
FileUtils.mv(app.gemfile, app.gems_rb)
FileUtils.mv(app.gemfile_lock, app.gems_locked)

File.write(app.path("script.rb"), <<-RUBY.strip_heredoc)
gemfile = Rails.root.join("gems.rb")
File.write(gemfile, "\#{gemfile.read}gem 'text'\\n")
Bundler.with_clean_env do
system(#{app.env.inspect}, "bundle install")
end
output = `\#{Rails.root.join('bin/rails')} runner 'require "text"; puts "done";'`
exit output.include? "done\n"
RUBY
File.write(app.path("script.rb"), <<-RUBY.strip_heredoc)
gemfile = Rails.root.join("gems.rb")
File.write(gemfile, "\#{gemfile.read}gem 'text'\\n")
Bundler.with_clean_env do
system(#{app.env.inspect}, "bundle install")
end
output = `\#{Rails.root.join('bin/rails')} runner 'require "text"; puts "done";'`
exit output.include? "done\n"
RUBY

assert_success [%(bin/rails runner 'load Rails.root.join("script.rb")'), timeout: 60]
end
assert_success [%(bin/rails runner 'load Rails.root.join("script.rb")'), timeout: 60]
end

test "changing the environment between runs" do
Expand Down

0 comments on commit 728f357

Please sign in to comment.