Skip to content
Snippets Groups Projects
Commit a859c89c authored by Alex Reisner's avatar Alex Reisner
Browse files

Code formatting: replace tabs with spaces.

parent 1c0ce90a
No related branches found
No related tags found
No related merge requests found
...@@ -14,26 +14,22 @@ class MongoidTest < Test::Unit::TestCase ...@@ -14,26 +14,22 @@ class MongoidTest < Test::Unit::TestCase
def test_geocoded_check def test_geocoded_check
p = Place.new(*venue_params(:msg)) p = Place.new(*venue_params(:msg))
p.location = [40.750354, -73.993371] p.location = [40.750354, -73.993371]
assert p.geocoded?
assert p.geocoded? end
end
def test_distance_to_returns_float def test_distance_to_returns_float
p = Place.new(*venue_params(:msg)) p = Place.new(*venue_params(:msg))
p.location = [40.750354, -73.993371] p.location = [40.750354, -73.993371]
assert p.distance_to([30, -94]).is_a?(Float) assert p.distance_to([30, -94]).is_a?(Float)
end end
def test_custom_coordinate_field_near_scope def test_custom_coordinate_field_near_scope
location = [40.750354, -73.993371] location = [40.750354, -73.993371]
p = Place.near(location) p = Place.near(location)
assert_equal p.selector[:location]['$nearSphere'], location.reverse
assert p.selector[:location] end
assert_equal p.selector[:location]['$nearSphere'], location.reverse
end
end end
rescue LoadError => crash rescue LoadError => crash
warn 'Mongoid not installed, not tested.' warn 'Mongoid not installed, not tested.'
end end
...@@ -12,13 +12,13 @@ end ...@@ -12,13 +12,13 @@ end
# Geocoded model. # Geocoded model.
# #
class Place class Place
include Mongoid::Document include Mongoid::Document
include Geocoder::Model::Mongoid include Geocoder::Model::Mongoid
geocoded_by :address, :coordinates => :location geocoded_by :address, :coordinates => :location
field :name field :name
field :address field :address
field :location, :type => Array field :location, :type => Array
def initialize(name, address) def initialize(name, address)
super() super()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment