diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 8be5fd9a05..7f875acd23 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -447,7 +447,7 @@ def set_last_body(public_body) end def country_from_ip - return AlaveteliGeoIP.country_code_from_ip(user_ip) if user_ip + return AlaveteliGeoIp.country_code_from_ip(user_ip) if user_ip AlaveteliConfiguration.iso_country_code end diff --git a/config/initializers/alaveteli.rb b/config/initializers/alaveteli.rb index 49b5faca9d..4053f08c1f 100644 --- a/config/initializers/alaveteli.rb +++ b/config/initializers/alaveteli.rb @@ -48,7 +48,7 @@ require 'public_body_csv' require 'alaveteli_text_masker' require 'database_collation' -require 'alaveteli_geoip' +require 'alaveteli_geo_ip' require 'default_late_calculator' require 'analytics_event' require 'alaveteli_gettext/fuzzy_cleaner' diff --git a/lib/alaveteli_geo_ip.rb b/lib/alaveteli_geo_ip.rb index bcb084e9f7..8f7685692a 100644 --- a/lib/alaveteli_geo_ip.rb +++ b/lib/alaveteli_geo_ip.rb @@ -4,14 +4,14 @@ # country_code_from_ip rather than creating a # new instance. -class AlaveteliGeoIP +class AlaveteliGeoIp require 'maxmind/db' attr_reader :geoip, :current_code # Public: Get the country code for a given IP address # Delegates to an instance configured with the geoip_database - # See AlaveteliGeoIP#country_code_from_ip for more documentation. + # See AlaveteliGeoIp#country_code_from_ip for more documentation. def self.country_code_from_ip(ip) instance.country_code_from_ip(ip) end diff --git a/spec/lib/alaveteli_geoip_spec.rb b/spec/lib/alaveteli_geoip_spec.rb index 98150639f9..13511ae431 100644 --- a/spec/lib/alaveteli_geoip_spec.rb +++ b/spec/lib/alaveteli_geoip_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -RSpec.describe AlaveteliGeoIP do +RSpec.describe AlaveteliGeoIp do let(:ip_address) { '127.0.0.1' } let(:max_mind_config) { { mode: :MODE_MEMORY } } @@ -14,7 +14,7 @@ it 'delegates to an instance of the class' do expect(delegate).to receive(:country_code_from_ip).with(ip_address) - AlaveteliGeoIP.country_code_from_ip(ip_address) + AlaveteliGeoIp.country_code_from_ip(ip_address) end end @@ -24,7 +24,7 @@ it { is_expected.to be_a(described_class) } it 'caches the instance' do - expect(AlaveteliGeoIP.instance).to equal(AlaveteliGeoIP.instance) + expect(AlaveteliGeoIp.instance).to equal(AlaveteliGeoIp.instance) end end