aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/time_ext_test.rb
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2008-06-03 13:32:53 -0500
committerJoshua Peek <josh@joshpeek.com>2008-06-03 13:32:53 -0500
commitc08547d2266c75f0a82d06dd91c6d0500740e12e (patch)
treeafd294792deab652137c1d172e752882bbd91669 /activesupport/test/core_ext/time_ext_test.rb
parentda91450e687fe9faa7b0575062c2b2aacc261f68 (diff)
downloadrails-c08547d2266c75f0a82d06dd91c6d0500740e12e.tar.gz
rails-c08547d2266c75f0a82d06dd91c6d0500740e12e.tar.bz2
rails-c08547d2266c75f0a82d06dd91c6d0500740e12e.zip
Namespace Inflector, Dependencies, OrderedOptions, and TimeZone under ActiveSupport [#238 state:resolved]
Diffstat (limited to 'activesupport/test/core_ext/time_ext_test.rb')
-rw-r--r--activesupport/test/core_ext/time_ext_test.rb28
1 files changed, 14 insertions, 14 deletions
diff --git a/activesupport/test/core_ext/time_ext_test.rb b/activesupport/test/core_ext/time_ext_test.rb
index e53b7193ea..17a0968c0e 100644
--- a/activesupport/test/core_ext/time_ext_test.rb
+++ b/activesupport/test/core_ext/time_ext_test.rb
@@ -449,7 +449,7 @@ class TimeExtCalculationsTest < Test::Unit::TestCase
assert_equal "17:44", time.to_s(:time)
assert_equal "February 21, 2005 17:44", time.to_s(:long)
assert_equal "February 21st, 2005 17:44", time.to_s(:long_ordinal)
- with_env_tz "UTC" do
+ with_env_tz "UTC" do
assert_equal "Mon, 21 Feb 2005 17:44:30 +0000", time.to_s(:rfc822)
end
end
@@ -505,13 +505,13 @@ class TimeExtCalculationsTest < Test::Unit::TestCase
assert_equal 30, Time.days_in_month(11, 2005)
assert_equal 31, Time.days_in_month(12, 2005)
end
-
+
uses_mocha 'TestTimeDaysInMonthWithoutYearArg' do
def test_days_in_month_feb_in_common_year_without_year_arg
Time.stubs(:now).returns(Time.utc(2007))
assert_equal 28, Time.days_in_month(2)
end
-
+
def test_days_in_month_feb_in_leap_year_without_year_arg
Time.stubs(:now).returns(Time.utc(2008))
assert_equal 29, Time.days_in_month(2)
@@ -559,13 +559,13 @@ class TimeExtCalculationsTest < Test::Unit::TestCase
def test_acts_like_time
assert Time.new.acts_like_time?
end
-
+
def test_formatted_offset_with_utc
assert_equal '+00:00', Time.utc(2000).formatted_offset
assert_equal '+0000', Time.utc(2000).formatted_offset(false)
assert_equal 'UTC', Time.utc(2000).formatted_offset(true, 'UTC')
end
-
+
def test_formatted_offset_with_local
with_env_tz 'US/Eastern' do
assert_equal '-05:00', Time.local(2000).formatted_offset
@@ -574,27 +574,27 @@ class TimeExtCalculationsTest < Test::Unit::TestCase
assert_equal '-0400', Time.local(2000, 7).formatted_offset(false)
end
end
-
+
def test_compare_with_time
assert_equal 1, Time.utc(2000) <=> Time.utc(1999, 12, 31, 23, 59, 59, 999)
assert_equal 0, Time.utc(2000) <=> Time.utc(2000, 1, 1, 0, 0, 0)
assert_equal(-1, Time.utc(2000) <=> Time.utc(2000, 1, 1, 0, 0, 0, 001))
end
-
+
def test_compare_with_datetime
assert_equal 1, Time.utc(2000) <=> DateTime.civil(1999, 12, 31, 23, 59, 59)
assert_equal 0, Time.utc(2000) <=> DateTime.civil(2000, 1, 1, 0, 0, 0)
assert_equal(-1, Time.utc(2000) <=> DateTime.civil(2000, 1, 1, 0, 0, 1))
end
-
+
def test_compare_with_time_with_zone
- assert_equal 1, Time.utc(2000) <=> ActiveSupport::TimeWithZone.new( Time.utc(1999, 12, 31, 23, 59, 59), TimeZone['UTC'] )
- assert_equal 0, Time.utc(2000) <=> ActiveSupport::TimeWithZone.new( Time.utc(2000, 1, 1, 0, 0, 0), TimeZone['UTC'] )
- assert_equal(-1, Time.utc(2000) <=> ActiveSupport::TimeWithZone.new( Time.utc(2000, 1, 1, 0, 0, 1), TimeZone['UTC'] ))
+ assert_equal 1, Time.utc(2000) <=> ActiveSupport::TimeWithZone.new( Time.utc(1999, 12, 31, 23, 59, 59), ActiveSupport::TimeZone['UTC'] )
+ assert_equal 0, Time.utc(2000) <=> ActiveSupport::TimeWithZone.new( Time.utc(2000, 1, 1, 0, 0, 0), ActiveSupport::TimeZone['UTC'] )
+ assert_equal(-1, Time.utc(2000) <=> ActiveSupport::TimeWithZone.new( Time.utc(2000, 1, 1, 0, 0, 1), ActiveSupport::TimeZone['UTC'] ))
end
-
+
def test_minus_with_time_with_zone
- assert_equal 86_400.0, Time.utc(2000, 1, 2) - ActiveSupport::TimeWithZone.new( Time.utc(2000, 1, 1), TimeZone['UTC'] )
+ assert_equal 86_400.0, Time.utc(2000, 1, 2) - ActiveSupport::TimeWithZone.new( Time.utc(2000, 1, 1), ActiveSupport::TimeZone['UTC'] )
end
def test_time_created_with_local_constructor_cannot_represent_times_during_hour_skipped_by_dst
@@ -608,7 +608,7 @@ class TimeExtCalculationsTest < Test::Unit::TestCase
def test_case_equality
assert Time === Time.utc(2000)
- assert Time === ActiveSupport::TimeWithZone.new(Time.utc(2000), TimeZone['UTC'])
+ assert Time === ActiveSupport::TimeWithZone.new(Time.utc(2000), ActiveSupport::TimeZone['UTC'])
assert_equal false, Time === DateTime.civil(2000)
end