diff --git a/test/test_helper.rb b/test/test_helper.rb index e57c779ac614dc5c1d818838eea215a38acad638..c4d018b8c077f5a8e6715e5acac154f0513017d7 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -214,6 +214,13 @@ module Geocoder "okf_kirstinmaki" end end + + class PostcodeAnywhereUk + private + def fixture_prefix + 'postcode_anywhere_uk_geocode_v200' + end + end end end diff --git a/test/unit/lookups/postcode_anywhere_uk_test.rb b/test/unit/lookups/postcode_anywhere_uk_test.rb new file mode 100644 index 0000000000000000000000000000000000000000..77c481d5e1dd4e83eacf73ee32b18b14ba4703cb --- /dev/null +++ b/test/unit/lookups/postcode_anywhere_uk_test.rb @@ -0,0 +1,33 @@ +# encoding: utf-8 +$: << File.join(File.dirname(__FILE__), '..', '..') +require 'test_helper' + +class PostcodeAnywhereUkTest < GeocoderTestCase + + def setup + Geocoder.configure(lookup: :postcode_anywhere_uk) + set_api_key!(:postcode_anywhere_uk) + end + + def test_result_components + results = Geocoder.search('Madison Square Garden') + + assert_equal 1, results.size + result = results.first + assert_equal 'Maidstone, Kent, TQ 76153 55386', result.address + assert_equal [51.2703, 0.5238], result.coordinates + end + + def test_WR26NJ + results = Geocoder.search('WR26NJ') + + assert_equal 1, results.size + result = results.first + assert_equal 'Moseley Road, Hallow, Worcester, SO 81676 59425', result.address + assert_equal [52.2327, -2.2697], result.coordinates + end + + def test_no_results + assert_equal [], Geocoder.search('no results') + end +end