Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding failing test for timezone/day overlaps #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .ruby-gemset
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sunrisesunset
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby-2.0.0
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source 'https://rubygems.org'

# Specify your gem's dependencies in rubysunrise.gemspec
gemspec
20 changes: 20 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
PATH
remote: .
specs:
RubySunrise (0.3)
tzinfo

GEM
remote: https://rubygems.org/
specs:
atomic (1.1.14)
thread_safe (0.1.3)
atomic
tzinfo (1.1.0)
thread_safe (~> 0.1)

PLATFORMS
ruby

DEPENDENCIES
RubySunrise!
7 changes: 7 additions & 0 deletions test/sunsettest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@
@calc.compute_utc_official_sunset.should eql(DateTime.parse("#{@date.strftime}T21:59:00-00:00"))
end

it "returns correct UTC official sunset time for time zones in different days" do
date = Date.parse('2013-10-06') #06 October 2013 (MDT)
calc = SolarEventCalculator.new(date, BigDecimal.new("39.7643389"), BigDecimal.new("-104.8551114"))
# Sunset in CO is 18:34 on Oct, 6. In UTC time this should be 00:34 on Oct, 7
calc.compute_utc_official_sunset.should eql(DateTime.parse("#{date.next_day.strftime}T00:34:00+00:00"))
end

it "returns correct UTC nautical sunset time" do
@calc.compute_utc_nautical_sunset.should eql(DateTime.parse("#{@date.strftime}T23:00:00-00:00"))
end
Expand Down