aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/date_ext_test.rb
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2007-11-05 22:29:11 +0000
committerMichael Koziarski <michael@koziarski.com>2007-11-05 22:29:11 +0000
commit47576a646bd99d431f4217b20b7625bdd3444171 (patch)
tree1e2912a07b1cf0458ddc090c37c67001f124b7ee /activesupport/test/core_ext/date_ext_test.rb
parent800b69b6adab2e2ea90b66fd2b37ed05f973b1d5 (diff)
downloadrails-47576a646bd99d431f4217b20b7625bdd3444171.tar.gz
rails-47576a646bd99d431f4217b20b7625bdd3444171.tar.bz2
rails-47576a646bd99d431f4217b20b7625bdd3444171.zip
Cater for DST changes when converting Times to DateTimes. Closes #10068 [gbuesing]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8076 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test/core_ext/date_ext_test.rb')
-rw-r--r--activesupport/test/core_ext/date_ext_test.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/activesupport/test/core_ext/date_ext_test.rb b/activesupport/test/core_ext/date_ext_test.rb
index 3ef4744c44..05835a5fed 100644
--- a/activesupport/test/core_ext/date_ext_test.rb
+++ b/activesupport/test/core_ext/date_ext_test.rb
@@ -174,9 +174,13 @@ class DateExtCalculationsTest < Test::Unit::TestCase
def test_xmlschema
with_timezone 'US/Eastern' do
- assert_match(/^1880-06-28T00:00:00-04:?00$/, Date.new(1880, 6, 28).xmlschema)
+ assert_match(/^1980-02-28T00:00:00-05:?00$/, Date.new(1980, 2, 28).xmlschema)
assert_match(/^1980-06-28T00:00:00-04:?00$/, Date.new(1980, 6, 28).xmlschema)
- assert_match(/^2080-06-28T00:00:00-04:?00$/, Date.new(2080, 6, 28).xmlschema)
+ # these tests are only of interest on platforms where older dates #to_time fail over to DateTime
+ if ::DateTime === Date.new(1880, 6, 28).to_time
+ assert_match(/^1880-02-28T00:00:00-05:?00$/, Date.new(1880, 2, 28).xmlschema)
+ assert_match(/^1880-06-28T00:00:00-05:?00$/, Date.new(1880, 6, 28).xmlschema) # DateTimes aren't aware of DST rules
+ end
end
end