Set Geocoder to use the test provider on tests

This commit is contained in:
Eric 2020-06-04 11:21:02 -05:00
parent 03b0f4279e
commit 5ceb05e6c3
2 changed files with 14 additions and 2 deletions

View file

@ -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
)
)

View file

@ -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