From af2129b4c74732c88ffce76e5c55c805cb9431f6 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Thu, 1 Aug 2019 16:41:26 +0900 Subject: Use `try` only when we're unsure if the receiver would respond_to the method --- railties/test/application/current_attributes_integration_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'railties') diff --git a/railties/test/application/current_attributes_integration_test.rb b/railties/test/application/current_attributes_integration_test.rb index 146e96facc..f4ff5b8077 100644 --- a/railties/test/application/current_attributes_integration_test.rb +++ b/railties/test/application/current_attributes_integration_test.rb @@ -18,7 +18,7 @@ class CurrentAttributesIntegrationTest < ActiveSupport::TestCase def customer=(customer) super - Time.zone = customer.try(:time_zone) + Time.zone = customer&.time_zone end end RUBY @@ -53,7 +53,7 @@ class CurrentAttributesIntegrationTest < ActiveSupport::TestCase RUBY app_file "app/views/customers/index.html.erb", <<-RUBY - <%= Current.customer.try(:name) || 'noone' %>,<%= Time.zone.name %> + <%= Current.customer&.name || 'noone' %>,<%= Time.zone.name %> RUBY require "#{app_path}/config/environment" -- cgit v1.2.3