Skip to content
Snippets Groups Projects
Commit 0278154c authored by Alex Reisner's avatar Alex Reisner
Browse files

Use subclass instead of overriding methods directly.

parent b43f0278
No related branches found
No related tags found
No related merge requests found
Showing
with 22 additions and 20 deletions
......@@ -310,15 +310,17 @@ class PlaceReverseGeocodedWithCustomLookup < ActiveRecord::Base
end
class Test::Unit::TestCase
class GeocoderTestCase < Test::Unit::TestCase
def setup
super
Geocoder.configure(:maxmind => {:service => :city_isp_org})
end
def teardown
Geocoder.send(:remove_const, :Configuration)
load "geocoder/configuration.rb"
super
end
def geocoded_object_params(abbrev)
......
# encoding: utf-8
require 'test_helper'
class ActiveRecordTest < Test::Unit::TestCase
class ActiveRecordTest < GeocoderTestCase
def test_exclude_condition_when_model_has_a_custom_primary_key
venue = PlaceWithCustomPrimaryKey.new(*geocoded_object_params(:msg))
......
# encoding: utf-8
require 'test_helper'
class CacheTest < Test::Unit::TestCase
class CacheTest < GeocoderTestCase
def test_second_occurrence_of_request_is_cache_hit
Geocoder.configure(:cache => {})
......
# encoding: utf-8
require 'test_helper'
class CalculationsTest < Test::Unit::TestCase
class CalculationsTest < GeocoderTestCase
def setup
Geocoder.configure(
:units => :mi,
......
# encoding: utf-8
require 'test_helper'
class ConfigurationTest < Test::Unit::TestCase
class ConfigurationTest < GeocoderTestCase
def setup
Geocoder::Configuration.set_defaults
end
......
# encoding: utf-8
require 'test_helper'
class ErrorHandlingTest < Test::Unit::TestCase
class ErrorHandlingTest < GeocoderTestCase
def teardown
Geocoder.configure(:always_raise => [])
......
# encoding: utf-8
require 'test_helper'
class GeocoderTest < Test::Unit::TestCase
class GeocoderTest < GeocoderTestCase
def test_distance_to_returns_float
v = Place.new(*geocoded_object_params(:msg))
......
# encoding: utf-8
require 'test_helper'
class HttpsTest < Test::Unit::TestCase
class HttpsTest < GeocoderTestCase
def test_uses_https_for_secure_query
Geocoder.configure(:use_https => true)
......
# encoding: utf-8
require 'test_helper'
class IpAddressTest < Test::Unit::TestCase
class IpAddressTest < GeocoderTestCase
def test_valid
assert Geocoder::IpAddress.new("232.65.123.94").valid?
......
# encoding: utf-8
require 'test_helper'
class LookupTest < Test::Unit::TestCase
class LookupTest < GeocoderTestCase
def test_responds_to_name_method
Geocoder::Lookup.all_services.each do |l|
......
# encoding: utf-8
require 'test_helper'
class BingTest < Test::Unit::TestCase
class BingTest < GeocoderTestCase
def setup
Geocoder.configure(lookup: :bing)
......
# encoding: utf-8
require 'test_helper'
class DstkTest < Test::Unit::TestCase
class DstkTest < GeocoderTestCase
def setup
Geocoder.configure(lookup: :dstk)
......
# encoding: utf-8
require 'test_helper'
class EsriTest < Test::Unit::TestCase
class EsriTest < GeocoderTestCase
def setup
Geocoder.configure(lookup: :esri)
......
# encoding: utf-8
require 'test_helper'
class FreegeoipTest < Test::Unit::TestCase
class FreegeoipTest < GeocoderTestCase
def setup
Geocoder.configure(ip_lookup: :freegeoip)
......
# encoding: utf-8
require 'test_helper'
class GeocoderCaTest < Test::Unit::TestCase
class GeocoderCaTest < GeocoderTestCase
def setup
Geocoder.configure(lookup: :geocoder_ca)
......
# encoding: utf-8
require 'test_helper'
class GeocodioTest < Test::Unit::TestCase
class GeocodioTest < GeocoderTestCase
def setup
Geocoder.configure(lookup: :geocodio)
......
# encoding: utf-8
require 'test_helper'
class GooglePremierTest < Test::Unit::TestCase
class GooglePremierTest < GeocoderTestCase
def setup
Geocoder.configure(lookup: :google_premier)
......
# encoding: utf-8
require 'test_helper'
class GoogleTest < Test::Unit::TestCase
class GoogleTest < GeocoderTestCase
def test_google_result_components
result = Geocoder.search("Madison Square Garden, New York, NY").first
......
# encoding: utf-8
require 'test_helper'
class MapquestTest < Test::Unit::TestCase
class MapquestTest < GeocoderTestCase
def setup
Geocoder.configure(lookup: :mapquest)
......
# encoding: utf-8
require 'test_helper'
class MaxmindLocalTest < Test::Unit::TestCase
class MaxmindLocalTest < GeocoderTestCase
def setup
Geocoder.configure(ip_lookup: :maxmind_local)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment