diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2017-05-28 10:19:32 +0200 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2017-05-28 10:19:32 +0200 |
commit | 96be81303e2f5d19c1246ca0fdc4d0029b0b4a8f (patch) | |
tree | d17af2e586806712188f369630b287575ccad31d | |
parent | 3cacbc1ef055b3c1702f640969b5840f612b2995 (diff) | |
download | rails-96be81303e2f5d19c1246ca0fdc4d0029b0b4a8f.tar.gz rails-96be81303e2f5d19c1246ca0fdc4d0029b0b4a8f.tar.bz2 rails-96be81303e2f5d19c1246ca0fdc4d0029b0b4a8f.zip |
Make reset execution assertions easier to read.
The app is booted by then, so there's no need to stash the code away in
some other script.
-rw-r--r-- | railties/test/application/current_attributes_integration_test.rb | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/railties/test/application/current_attributes_integration_test.rb b/railties/test/application/current_attributes_integration_test.rb index b6659f296a..5653ec0be1 100644 --- a/railties/test/application/current_attributes_integration_test.rb +++ b/railties/test/application/current_attributes_integration_test.rb @@ -52,19 +52,6 @@ class CurrentAttributesIntegrationTest < ActiveSupport::TestCase <%= Current.customer.try(:name) || 'noone' %>,<%= Time.zone.name %> RUBY - app_file "app/executor_intercept.rb", <<-RUBY - check_state = -> { puts [ Current.customer.try(:name) || "noone", Time.zone.name ].join(",") } - - check_state.call - - Rails.application.executor.wrap do - Current.customer = Customer.new("david") - check_state.call - end - - check_state.call - RUBY - require "#{app_path}/config/environment" end @@ -81,8 +68,17 @@ class CurrentAttributesIntegrationTest < ActiveSupport::TestCase end test "resets after execution" do - Dir.chdir(app_path) do - assert_equal "noone,UTC\ndavid,Copenhagen\nnoone,UTC\n", `bin/rails runner app/executor_intercept.rb` + assert_nil Current.customer + assert_equal "UTC", Time.zone.name + + Rails.application.executor.wrap do + Current.customer = Customer.new("david") + + assert_equal "david", Current.customer.name + assert_equal "Copenhagen", Time.zone.name end + + assert_nil Current.customer + assert_equal "UTC", Time.zone.name end end |