From a0599535aa8b15a13cfbbbaf888cdb0b8ee90307 Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Fri, 25 Oct 2013 15:59:04 +0200 Subject: only warn on leaked time zone state instead of rasing an error. Raising `RuntimeErrors` skips important cleanup code and leads to a lot of subsequent errors. This clutters the test output with a lot of noise. --- activerecord/test/cases/helper.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'activerecord/test/cases') diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 7b38fcf529..2af647e2d7 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -78,21 +78,24 @@ EXPECTED_DEFAULT_TIMEZONE = :utc EXPECTED_TIME_ZONE_AWARE_ATTRIBUTES = false def verify_default_timezone_config if Time.zone != EXPECTED_ZONE - raise <<-MSG + $stderr.puts <<-MSG +\n#{self.to_s} Global state `Time.zone` was leaked. Expected: #{EXPECTED_ZONE} Got: #{Time.zone} MSG end if ActiveRecord::Base.default_timezone != EXPECTED_DEFAULT_TIMEZONE - raise <<-MSG + $stderr.puts <<-MSG +\n#{self.to_s} Global state `ActiveRecord::Base.default_timezone` was leaked. Expected: #{EXPECTED_DEFAULT_TIMEZONE} Got: #{ActiveRecord::Base.default_timezone} MSG end if ActiveRecord::Base.time_zone_aware_attributes != EXPECTED_TIME_ZONE_AWARE_ATTRIBUTES - raise <<-MSG + $stderr.puts <<-MSG +\n#{self.to_s} Global state `ActiveRecord::Base.time_zone_aware_attributes` was leaked. Expected: #{EXPECTED_TIME_ZONE_AWARE_ATTRIBUTES} Got: #{ActiveRecord::Base.time_zone_aware_attributes} -- cgit v1.2.3