Skip to content

Commit

Permalink
Use Time.utc instead of Time.local in tests
Browse files Browse the repository at this point in the history
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
alanpeabody committed Nov 13, 2011
1 parent 3bd25ac commit 725436a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions test/test_date_ext.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ def setup
end end


def test_sunrise 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)) assert_equal(sunrise, @date.sunrise(@lat, @lng))
end end


def test_sunset 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)) assert_equal(sunset, @date.sunset(@lat, @lng))
end end
end end
6 changes: 3 additions & 3 deletions test/test_sun_time.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ def setup
end end


def test_sunrise 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) assert_equal(sunrise, @sun_time.sunrise)
end end


def test_sunset 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) assert_equal(sunset, @sun_time.sunset)
end end
Expand Down Expand Up @@ -79,4 +79,4 @@ def test_j_set
def test_j_rise def test_j_rise
assert_in_delta(2455035.6184334, @sun_time.send(:j_rise), 2 ** -20) assert_in_delta(2455035.6184334, @sun_time.send(:j_rise), 2 ** -20)
end end
end end

0 comments on commit 725436a

Please sign in to comment.