Sha256: 205f771e219b75a2225b09fd46327098cff55eff756c74ec069150c3d5f4c685

Contents?: true

Size: 799 Bytes

Versions: 6

Compression:

Stored size: 799 Bytes

Contents

require_relative '../../spec_helper'

module Barometer::WeatherService
  describe Noaa::CurrentResponse do
    let(:forecast_response) { Barometer::Response.new }

    it "parses the timezones correctly" do
      payload = Barometer::Utils::Payload.new({
        "observation_time_rfc822" => "Sun, 14 Apr 2013 10:51:00 -0700",
        "observation_time" => "Last Updated on Apr 14 2013, 10:51 am PDT"
      })
      response = Noaa::CurrentResponse.new(forecast_response).parse(payload)

      utc_observed_at = Time.utc(2013,04,14,17,51,00)
      utc_stale_at = Time.utc(2013,04,14,18,51,00)

      expect( response.current.observed_at.utc ).to eq utc_observed_at
      expect( response.current.stale_at.utc ).to eq utc_stale_at
      expect( response.timezone.to_s ).to eq 'PDT'
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
barometer-0.9.5 spec/weather_services/noaa/current_response_spec.rb
barometer-0.9.4 spec/weather_services/noaa/current_response_spec.rb
barometer-0.9.3 spec/weather_services/noaa/current_response_spec.rb
barometer-0.9.2 spec/weather_services/noaa/current_response_spec.rb
barometer-0.9.1 spec/weather_services/noaa/current_response_spec.rb
barometer-0.9.0 spec/weather_services/noaa/current_response_spec.rb