Sha256: 5ad1252da73a9596d8b4bde402a81a39ffb449cdd996824bb8bc31e6a7db4875

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

require_relative '../../spec_helper'

module Barometer
  module Query
    module Service
      describe NoaaStation, vcr: {
        cassette_name: 'Service::NoaaStation'
      } do
        describe '.fetch' do
          it "returns nohing if query doesn't have coordinates format" do
            query = Query.new("90210")
            expect(NoaaStation.fetch(query)).to be_nil
          end

          it "returns a station_id if the query is format coordinates" do
            query = Query.new('34.10,-118.41')
            expect(NoaaStation.fetch(query)).to eq 'KSMO'
          end

          it "returns a station_id if the query is format coordinates" do
            query = Query.new('42.7243,-73.6927')
            expect(NoaaStation.fetch(query)).to eq 'KALB'
          end

          it "returns a station_id if the query has a corrdinates conversion" do
            query = Query.new('90210')
            query.add_conversion(:coordinates, '34.10,-118.41')
            expect(NoaaStation.fetch(query)).to eq 'KSMO'
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
barometer-0.9.7 spec/query/services/noaa_station_id_spec.rb