Class: Decidim::Map::Provider::Autocomplete::Test

Inherits:
Autocomplete
  • Object
show all
Defined in:
lib/decidim/dev/test/rspec_support/geocoder.rb

Defined Under Namespace

Classes: Builder

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.add_stub(address, coordinates) ⇒ Object



54
55
56
57
58
59
# File 'lib/decidim/dev/test/rspec_support/geocoder.rb', line 54

def self.add_stub(address, coordinates)
  stubs.push(
    properties: address.is_a?(Hash) ? address : { street: address },
    geometry: { coordinates: coordinates.reverse }
  )
end

.clear_stubsObject



61
62
63
# File 'lib/decidim/dev/test/rspec_support/geocoder.rb', line 61

def self.clear_stubs
  @stubs = []
end

.stubsObject



50
51
52
# File 'lib/decidim/dev/test/rspec_support/geocoder.rb', line 50

def self.stubs
  @stubs ||= []
end

Instance Method Details

#builder_optionsObject



65
66
67
# File 'lib/decidim/dev/test/rspec_support/geocoder.rb', line 65

def builder_options
  { url: configuration.fetch(:url, nil) }.compact
end