diff --git a/.ruby-gemset b/.ruby-gemset new file mode 100644 index 0000000..3d32504 --- /dev/null +++ b/.ruby-gemset @@ -0,0 +1 @@ +sunrisesunset diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..f33eb12 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +ruby-2.0.0 diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..ba1daa5 --- /dev/null +++ b/Gemfile @@ -0,0 +1,4 @@ +source 'https://rubygems.org' + +# Specify your gem's dependencies in rubysunrise.gemspec +gemspec \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..ccc84a8 --- /dev/null +++ b/Gemfile.lock @@ -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! diff --git a/test/sunsettest.rb b/test/sunsettest.rb index cc6deed..f8bb9e0 100644 --- a/test/sunsettest.rb +++ b/test/sunsettest.rb @@ -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