Sha256: 4d2de387cd31d9cf65c741ee197666e85121615df775e7e542063ba2850923a9

Contents?: true

Size: 824 Bytes

Versions: 8

Compression:

Stored size: 824 Bytes

Contents

require_relative '../../spec_helper'

describe Barometer::Query::Service::ToWeatherId, vcr: {
  cassette_name: "Service::ToWeatherId"
} do
  describe ".call," do
    it "returns nothing if query doesn't have a supported format" do
      query = Barometer::Query.new("90210")
      Barometer::Query::Service::ToWeatherId.call(query).should be_nil
    end

    it "returns a weather_id if the query is format unknown" do
      query = Barometer::Query.new("Paris, France")
      Barometer::Query::Service::ToWeatherId.call(query).should == "FRXX0076"
    end

    it "returns a weather_id if the query has a supported conversion" do
      query = Barometer::Query.new("10001")
      query.add_conversion(:geocode, "New York, NY")
      Barometer::Query::Service::ToWeatherId.call(query).should == "USNY0996"
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
barometer-0.9.7 spec/query/services/to_weather_id_spec.rb
barometer-0.9.6 spec/query/services/to_weather_id_spec.rb
barometer-0.9.5 spec/query/services/to_weather_id_spec.rb
barometer-0.9.4 spec/query/services/to_weather_id_spec.rb
barometer-0.9.3 spec/query/services/to_weather_id_spec.rb
barometer-0.9.2 spec/query/services/to_weather_id_spec.rb
barometer-0.9.1 spec/query/services/to_weather_id_spec.rb
barometer-0.9.0 spec/query/services/to_weather_id_spec.rb