Set Geocoder to use the test provider on tests
This commit is contained in:
parent
03b0f4279e
commit
5ceb05e6c3
2 changed files with 14 additions and 2 deletions
|
@ -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
|
||||
)
|
||||
)
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue