Permalink
Browse files

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.
  • Loading branch information...
senny committed Oct 25, 2013
1 parent 2dc579b commit a0599535aa8b15a13cfbbbaf888cdb0b8ee90307
Showing with 6 additions and 3 deletions.
  1. +6 −3 activerecord/test/cases/helper.rb
@@ -78,21 +78,24 @@ def with_timezone_config(cfg)
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}

0 comments on commit a059953

Please sign in to comment.