Browse files

Use Time.utc instead of Time.local in tests

Due to the use of Time.local in a GMT+2 TZ, the expected date must
have 2 hours subtracted to be the correct expected utc time.

Test should now pass when run anywhere.
  • Loading branch information...
1 parent 3bd25ac commit 725436a88b37fbfe546cbb49e197f1b9e8753b55 @alanpeabody committed Nov 13, 2011
Showing with 6 additions and 6 deletions.
  1. +3 −3 test/test_date_ext.rb
  2. +3 −3 test/test_sun_time.rb
View
6 test/test_date_ext.rb
@@ -10,13 +10,13 @@ def setup
end
def test_sunrise
- sunrise = Time.mktime(2009, 7, 23, 4, 50, 32)
+ sunrise = Time.utc(2009, 7, 23, 2, 50, 32)
assert_equal(sunrise, @date.sunrise(@lat, @lng))
end
def test_sunset
- sunset = Time.mktime(2009, 7, 23, 21, 48, 56)
+ sunset = Time.utc(2009, 7, 23, 19, 48, 56)
assert_equal(sunset, @date.sunset(@lat, @lng))
end
-end
+end
View
6 test/test_sun_time.rb
@@ -11,13 +11,13 @@ def setup
end
def test_sunrise
- sunrise = Time.mktime(2009, 7, 23, 4, 50, 32)
+ sunrise = Time.utc(2009, 7, 23, 2, 50, 32)
assert_equal(sunrise, @sun_time.sunrise)
end
def test_sunset
- sunset = Time.mktime(2009, 7, 23, 21, 48, 56)
+ sunset = Time.utc(2009, 7, 23, 19, 48, 56)
assert_equal(sunset, @sun_time.sunset)
end
@@ -79,4 +79,4 @@ def test_j_set
def test_j_rise
assert_in_delta(2455035.6184334, @sun_time.send(:j_rise), 2 ** -20)
end
-end
+end

0 comments on commit 725436a

Please sign in to comment.