Testing PostcodesIO Geocoding Integration in geocoder
This test suite validates the PostcodesIO lookup functionality in the Geocoder gem, focusing on UK postcode geocoding capabilities. The tests ensure accurate coordinate retrieval and proper handling of invalid postcodes.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
alexreisner/geocoder
test/unit/lookups/postcodes_io_test.rb
# encoding: utf-8
require 'test_helper'
class PostcodesIoTest < GeocoderTestCase
def setup
super
Geocoder.configure(lookup: :postcodes_io)
end
def test_result_on_postcode_search
results = Geocoder.search('WR26NJ')
assert_equal 1, results.size
assert_equal 'Worcestershire', results.first.county
assert_equal [52.2327158260535, -2.26972239639173], results.first.coordinates
end
def test_no_results
assert_equal [], Geocoder.search('no results')
end
end