diff --git a/activesupport/lib/active_support/core_ext/date/calculations.rb b/activesupport/lib/active_support/core_ext/date/calculations.rb index ce3bebc25a..3dd61334d0 100644 --- a/activesupport/lib/active_support/core_ext/date/calculations.rb +++ b/activesupport/lib/active_support/core_ext/date/calculations.rb @@ -1,4 +1,5 @@ require 'active_support/duration' +require 'active_support/core_ext/time/zones' class Date class << self diff --git a/activesupport/lib/active_support/core_ext/date/conversions.rb b/activesupport/lib/active_support/core_ext/date/conversions.rb index 54facf4430..b41ad5b686 100644 --- a/activesupport/lib/active_support/core_ext/date/conversions.rb +++ b/activesupport/lib/active_support/core_ext/date/conversions.rb @@ -1,6 +1,7 @@ require 'active_support/inflector' require 'active_support/core_ext/time/conversions' require 'active_support/core_ext/date_time/conversions' +require 'active_support/values/time_zone' class Date DATE_FORMATS = { diff --git a/activesupport/lib/active_support/json/encoding.rb b/activesupport/lib/active_support/json/encoding.rb index f440d6ce58..8e8f9022c1 100644 --- a/activesupport/lib/active_support/json/encoding.rb +++ b/activesupport/lib/active_support/json/encoding.rb @@ -6,10 +6,7 @@ require 'active_support/core_ext/object/instance_variables' require 'active_support/deprecation' -require 'active_support/core_ext/date_time/conversions' -require 'active_support/core_ext/time/conversions' require 'active_support/time_with_zone' -require 'active_support/values/time_zone' # Hack to load json gem first so we can overwrite its to_json. begin diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb index 4907fae9d6..a64128e49e 100644 --- a/activesupport/lib/active_support/time_with_zone.rb +++ b/activesupport/lib/active_support/time_with_zone.rb @@ -1,4 +1,5 @@ require 'active_support/duration' +require 'active_support/values/time_zone' require 'active_support/core_ext/numeric/time' require 'active_support/core_ext/integer/time' require 'active_support/core_ext/time/conversions' diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb index 892aa97ad7..6a51ce9402 100644 --- a/activesupport/test/caching_test.rb +++ b/activesupport/test/caching_test.rb @@ -154,13 +154,13 @@ def test_expires_in File.stubs(:mtime).returns(time) @cache.write('foo', 'bar') - cache_read = lambda { @cache.read('foo', :expires_in => 1.minute) } + cache_read = lambda { @cache.read('foo', :expires_in => 60) } assert_equal 'bar', cache_read.call - Time.stubs(:now).returns(time + 30.seconds) + Time.stubs(:now).returns(time + 30) assert_equal 'bar', cache_read.call - Time.stubs(:now).returns(time + 2.minutes) + Time.stubs(:now).returns(time + 120) assert_nil cache_read.call end end diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 26a55a73e1..af73b08547 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -242,6 +242,7 @@ def new # If assigned value cannot be matched to a TimeZone, an exception will be raised. initializer :initialize_time_zone do if config.time_zone + require 'active_support/core_ext/time/zones' zone_default = Time.__send__(:get_zone, config.time_zone) unless zone_default