From fea4703b6b63ee612d2194510598d3ce20039e76 Mon Sep 17 00:00:00 2001 From: Alex Reisner <alex@alexreisner.com> Date: Fri, 21 Dec 2012 09:44:22 -0500 Subject: [PATCH] Implement #name method for MaxMind lookup. Also add test for method presence in all lookups. --- lib/geocoder/lookups/maxmind.rb | 4 ++++ test/lookup_test.rb | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/lib/geocoder/lookups/maxmind.rb b/lib/geocoder/lookups/maxmind.rb index c53480fc..2fa36e2b 100644 --- a/lib/geocoder/lookups/maxmind.rb +++ b/lib/geocoder/lookups/maxmind.rb @@ -5,6 +5,10 @@ require 'csv' module Geocoder::Lookup class Maxmind < Base + def name + "MaxMind" + end + private # --------------------------------------------------------------- def results(query) diff --git a/test/lookup_test.rb b/test/lookup_test.rb index d4b9fd34..6e77e4ba 100644 --- a/test/lookup_test.rb +++ b/test/lookup_test.rb @@ -3,6 +3,14 @@ require 'test_helper' class LookupTest < Test::Unit::TestCase + def test_responds_to_name_method + Geocoder::Lookup.all_services.each do |l| + lookup = Geocoder::Lookup.get(l) + assert lookup.respond_to?(:name), + "Lookup #{l} does not respond to #name method." + end + end + def test_search_returns_empty_array_when_no_results Geocoder::Lookup.all_services_except_test.each do |l| lookup = Geocoder::Lookup.get(l) -- GitLab