Sha256: 7af9e11e87077d011e1faea7a0345ca232bfccaeb07a56dc80e378c6e4078221

Contents?: true

Size: 1.18 KB

Versions: 5

Compression:

Stored size: 1.18 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe GoMaps::Address do
  context 'on #exists?' do
    it 'should return true given a valid address' do
      address = 'Valid Address'
      map_address_to_file address, 'address_success'
      GoMaps::Address.new(address).exists?.should be_true
    end

    it 'should return false given an invalid address' do
      address = 'Invalid Address'
      map_address_to_file address, 'address_error'
      GoMaps::Address.new(address).exists?.should be_false
    end
  end

  context 'on #distance_to' do
    it 'should return the distance given valid addresses' do
      address1, address2 = 'Valid Address 1', 'Valid Address 2'
      map_addresses_to_file address1, address2, 'distance_success_10.8'
      GoMaps::Address.new(address1).distance_to(address2).should == 10.8
    end

    it 'should raise AddressNotFoundException given invalid addresses' do
      address1, address2 = 'Invalid Address 1', 'Invalid Address 2'
      map_addresses_to_file address1, address2, 'distance_error'
      lambda { GoMaps::Address.new(address1).distance_to(address2) }.should raise_error(GoMaps::AddressNotFoundException)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
go_maps-0.3.2 spec/go_maps/address_spec.rb
go_maps-0.3.1 spec/go_maps/address_spec.rb
go_maps-0.3.0 spec/go_maps/address_spec.rb
go_maps-0.2.0 spec/go_maps/address_spec.rb
go_maps-0.1.0 spec/go_maps/address_spec.rb