diff --git a/test/mongoid_test.rb b/test/mongoid_test.rb index 4b2bed0c220a5174d7bb1c1e7e313399ab5103ed..c4fb8ae07251f61f3c52480838b308c5ed9e3e36 100644 --- a/test/mongoid_test.rb +++ b/test/mongoid_test.rb @@ -14,26 +14,22 @@ class MongoidTest < Test::Unit::TestCase def test_geocoded_check p = Place.new(*venue_params(:msg)) p.location = [40.750354, -73.993371] - - assert p.geocoded? - end + assert p.geocoded? + end def test_distance_to_returns_float p = Place.new(*venue_params(:msg)) p.location = [40.750354, -73.993371] - assert p.distance_to([30, -94]).is_a?(Float) end - def test_custom_coordinate_field_near_scope - location = [40.750354, -73.993371] + def test_custom_coordinate_field_near_scope + location = [40.750354, -73.993371] p = Place.near(location) - - assert p.selector[:location] - assert_equal p.selector[:location]['$nearSphere'], location.reverse - end + assert_equal p.selector[:location]['$nearSphere'], location.reverse + end end rescue LoadError => crash - warn 'Mongoid not installed, not tested.' + warn 'Mongoid not installed, not tested.' end diff --git a/test/mongoid_test_helper.rb b/test/mongoid_test_helper.rb index 159f8a222d2b72c3c699189d161486b9bea3544c..5486a12436ce680d54f25271223e742f54ab17c7 100644 --- a/test/mongoid_test_helper.rb +++ b/test/mongoid_test_helper.rb @@ -12,13 +12,13 @@ end # Geocoded model. # class Place - include Mongoid::Document - include Geocoder::Model::Mongoid + include Mongoid::Document + include Geocoder::Model::Mongoid geocoded_by :address, :coordinates => :location - field :name - field :address - field :location, :type => Array + field :name + field :address + field :location, :type => Array def initialize(name, address) super()