aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-03-07 15:44:39 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2011-03-07 15:44:39 -0800
commit1408b942d9c2c131a1cdcab97f49d74ce84dae38 (patch)
tree87ec810f79e5d8e4bd51bae49bd68b4d595a24e5 /activesupport/test
parent33f222b9e1b20aa6264084ec2c8c3206e1c2d598 (diff)
downloadrails-1408b942d9c2c131a1cdcab97f49d74ce84dae38.tar.gz
rails-1408b942d9c2c131a1cdcab97f49d74ce84dae38.tar.bz2
rails-1408b942d9c2c131a1cdcab97f49d74ce84dae38.zip
removing stubs. 1.9.3 implements Date.today in C so mocking the return value of Time.now does nothing
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/core_ext/date_ext_test.rb13
1 files changed, 4 insertions, 9 deletions
diff --git a/activesupport/test/core_ext/date_ext_test.rb b/activesupport/test/core_ext/date_ext_test.rb
index 03b84ae2e5..d81693209f 100644
--- a/activesupport/test/core_ext/date_ext_test.rb
+++ b/activesupport/test/core_ext/date_ext_test.rb
@@ -262,8 +262,7 @@ class DateExtCalculationsTest < ActiveSupport::TestCase
def test_yesterday_constructor_when_zone_is_not_set
with_env_tz 'UTC' do
with_tz_default do
- Time.stubs(:now).returns Time.local(2000, 1, 1)
- assert_equal Date.new(1999, 12, 31), Date.yesterday
+ assert_equal(Date.today - 1, Date.yesterday)
end
end
end
@@ -284,8 +283,7 @@ class DateExtCalculationsTest < ActiveSupport::TestCase
def test_tomorrow_constructor_when_zone_is_not_set
with_env_tz 'UTC' do
with_tz_default do
- Time.stubs(:now).returns Time.local(1999, 12, 31)
- assert_equal Date.new(2000, 1, 1), Date.tomorrow
+ assert_equal(Date.today + 1, Date.tomorrow)
end
end
end
@@ -410,17 +408,14 @@ class DateExtCalculationsTest < ActiveSupport::TestCase
def test_current_returns_date_today_when_zone_not_set
with_env_tz 'US/Central' do
Time.stubs(:now).returns Time.local(1999, 12, 31, 23)
- assert_equal Date.new(1999, 12, 31), Date.today
- assert_equal Date.new(1999, 12, 31), Date.current
+ assert_equal Date.today, Date.current
end
end
def test_current_returns_time_zone_today_when_zone_is_set
Time.zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)']
with_env_tz 'US/Central' do
- Time.stubs(:now).returns Time.local(1999, 12, 31, 23)
- assert_equal Date.new(1999, 12, 31), Date.today
- assert_equal Date.new(2000, 1, 1), Date.current
+ assert_equal ::Time.zone.today, Date.current
end
ensure
Time.zone = nil