mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-01-27 02:37:53 -05:00
Add in_testing config option to Nominatum
Checking against Rails.env.test? fails on Travis.
This commit is contained in:
@@ -53,6 +53,8 @@ Growstuff::Application.configure do
|
||||
|
||||
end
|
||||
|
||||
Nominatim.in_testing = true
|
||||
|
||||
Nominatim.add_stub(
|
||||
"Amundsen-Scott Base, Antarctica", {
|
||||
:latitude => -90.0,
|
||||
|
||||
@@ -4,8 +4,13 @@ require 'json'
|
||||
|
||||
class Nominatim
|
||||
|
||||
# class-level instance variable, see
|
||||
# http://www.railstips.org/blog/archives/2006/11/18/class-and-instance-variables-in-ruby/
|
||||
class << self; attr_accessor :in_testing end
|
||||
@in_testing = false
|
||||
|
||||
def self.geocode(place)
|
||||
if Rails.env.test?
|
||||
if self.in_testing
|
||||
return stubs[place]
|
||||
end
|
||||
json = open(
|
||||
|
||||
Reference in New Issue
Block a user