Sha256: bb01cd3f99c2da4dd3083bac8a81c11c19df089ae86afa6cd5bfa5c79b12802c

Contents?: true

Size: 891 Bytes

Versions: 8

Compression:

Stored size: 891 Bytes

Contents

require_relative '../../spec_helper'

describe Barometer::Query::Converter::FromGeocodeToCoordinates do
  it "converts :geocode -> :coordinates" do
    query = Barometer::Query.new('USNY0996')
    query.add_conversion(:geocode, 'New York, NY')

    query.geo = Barometer::Data::Geo.new(latitude: 40.7143528, longitude: -74.0059731, country_code: 'US')

    converter = Barometer::Query::Converter::FromGeocodeToCoordinates.new(query)
    converted_query = converter.call

    converted_query.q.should == '40.7143528,-74.0059731'
    converted_query.format.should == :coordinates
    converted_query.geo.country_code.should == 'US'
    converted_query.geo.should_not be_nil
  end

  it "does not convert other formats" do
    query = Barometer::Query.new('USGA0028')

    converter = Barometer::Query::Converter::FromGeocodeToCoordinates.new(query)
    converter.call.should be_nil
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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