Sha256: 4b97eaf0cbaddd1e1405b55099a6f532a00fa7bb4b303013776ea5816805d21e

Contents?: true

Size: 949 Bytes

Versions: 5

Compression:

Stored size: 949 Bytes

Contents

# encoding: utf-8
require 'test_helper'

class LookupTest < Test::Unit::TestCase

  def test_search_returns_empty_array_when_no_results
    all_lookups.each do |l|
      lookup = Geocoder.send(:get_lookup, l)
      assert_equal [], lookup.send(:results, "no results"),
        "Lookup #{l} does not return empty array when no results."
    end
  end

  def test_hash_to_query
    g = Geocoder::Lookup::Google.new
    assert_equal "a=1&b=2", g.send(:hash_to_query, {:a => 1, :b => 2})
  end

  def test_google_api_key
    Geocoder::Configuration.api_key = "MY_KEY"
    g = Geocoder::Lookup::Google.new
    assert_match "key=MY_KEY", g.send(:query_url, "Madison Square Garden, New York, NY  10001, United States")
  end

  def test_yahoo_app_id
    Geocoder::Configuration.api_key = "MY_KEY"
    g = Geocoder::Lookup::Yahoo.new
    assert_match "appid=MY_KEY", g.send(:query_url, "Madison Square Garden, New York, NY  10001, United States")
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
geocoder-1.1.1 test/lookup_test.rb
geocoder-1.1.0 test/lookup_test.rb
geocoder-1.0.5 test/lookup_test.rb
geocoder-1.0.4 test/lookup_test.rb
geocoder-1.0.3 test/lookup_test.rb