Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

removing stubs. 1.9.3 implements Date.today in C so mocking the retur…

…n value of Time.now does nothing
  • Loading branch information...
commit 1408b942d9c2c131a1cdcab97f49d74ce84dae38 1 parent 33f222b
@tenderlove tenderlove authored
Showing with 4 additions and 9 deletions.
  1. +4 −9 activesupport/test/core_ext/date_ext_test.rb
View
13 activesupport/test/core_ext/date_ext_test.rb
@@ -262,8 +262,7 @@ def test_yesterday_constructor
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 @@ def test_tomorrow_constructor
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 @@ def test_future
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
Please sign in to comment.
Something went wrong with that request. Please try again.