module GeocoderHelpers
Public Instance Methods
configure_maps()
click to toggle source
# File lib/decidim/dev/test/rspec_support/geocoder.rb, line 26 def configure_maps # Set maps configuration in test mode Decidim.maps = { provider: :test, api_key: "1234123412341234", static: { url: "https://www.example.org/my_static_map" }, autocomplete: { url: "/photon_api" } # Locally drawn route for the tests } end
fill_in_geocoding(attribute, options = {})
click to toggle source
Waits for the front-end geocoding request to finish in order to ensure there are no pending requests when proceeding.
# File lib/decidim/dev/test/rspec_support/geocoder.rb, line 19 def fill_in_geocoding(attribute, options = {}) fill_in attribute, options expect(page).to have_selector(".tribute-container ul#results", count: 1) end
stub_geocoding(address, coordinates)
click to toggle source
# File lib/decidim/dev/test/rspec_support/geocoder.rb, line 4 def stub_geocoding(address, coordinates) result = coordinates.blank? ? [] : [{ "coordinates" => [latitude, longitude] }] Geocoder::Lookup::Test.add_stub( address, result ) Decidim::Map::Provider::Autocomplete::Test.add_stub( address, coordinates ) end