Sha256: 08611a657825245b6bec560414aee1f9e9135c4365f2af20c6e0b696f6de6571

Contents?: true

Size: 934 Bytes

Versions: 6

Compression:

Stored size: 934 Bytes

Contents

require_relative '../../spec_helper'

module Barometer::Query
  describe Format::WeatherID do
    describe '.geo' do
      specify { expect( Format::WeatherID.geo(nil) ).to be_nil }
      specify { expect( Format::WeatherID.geo('i') ).to be_nil }

      context 'when the country code is standard' do
        specify { expect( Format::WeatherID.geo('USGA0000') ).to eq({country_code: 'US'}) }
        specify { expect( Format::WeatherID.geo('CAAB0000') ).to eq({country_code: 'CA'}) }
      end

      context 'when the country code is non standard' do
        specify { expect( Format::WeatherID.geo('SPXX0000') ).to eq({country_code: 'ES'}) }
      end
    end

    describe '.is?' do
      it 'recognizes a valid format' do
        expect( Format::WeatherID.is?('USGA0028') ).to be_true
      end

      it 'recognizes non-valid format' do
        expect( Format::WeatherID.is?('invalid') ).to be_false
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
barometer-0.9.7 spec/query/formats/weather_id_spec.rb
barometer-0.9.6 spec/query/formats/weather_id_spec.rb
barometer-0.9.5 spec/query/formats/weather_id_spec.rb
barometer-0.9.4 spec/query/formats/weather_id_spec.rb
barometer-0.9.3 spec/query/formats/weather_id_spec.rb
barometer-0.9.2 spec/query/formats/weather_id_spec.rb