diff --git a/config/initializers/geocode.rb b/config/initializers/geocode.rb index 0d7a0ed5..22d2dec8 100644 --- a/config/initializers/geocode.rb +++ b/config/initializers/geocode.rb @@ -3,8 +3,8 @@ # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later Geocoder.configure( cache: Rails.cache, - lookup: :google, + lookup: Rails.env == 'test' ? :test : :google, use_https: true, api_key: ENV['GOOGLE_API_KEY'], timeout: 10 -) +) \ No newline at end of file diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 8af99c06..478ebca1 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -72,4 +72,16 @@ RSpec.configure do |config| config.include Devise::Test::ControllerHelpers, type: :controller config.include Devise::Test::IntegrationHelpers, type: :request config.include RSpec::Rails::RequestExampleGroup, type: :request, file_path: %r{spec/api} + Geocoder::Lookup::Test.set_default_stub( + [ + { + 'coordinates' => [44.2876041,-88.4671082], + 'address' => 'Appleton, WI, USA', + 'state' => 'Appleton', + 'state_code' => 'WI', + 'country' => 'United States', + 'country_code' => 'US' + } + ] + ) end