Sha256: eeae083551fd4709e92a762b95436ce7248dd0e405a47a82529e49cc47e4dd0c

Contents?: true

Size: 718 Bytes

Versions: 5

Compression:

Stored size: 718 Bytes

Contents

# encoding: utf-8
require 'test_helper'

begin
require 'mongoid'
require 'mongoid_test_helper'

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

  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]
    p = Place.near(location)
    assert_equal p.selector[:location]['$nearSphere'], location.reverse
  end
end

rescue LoadError => crash
  warn 'Mongoid not installed, not tested.'
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
geocoder-1.1.1 test/mongoid_test.rb
geocoder-1.1.0 test/mongoid_test.rb
geocoder-1.0.5 test/mongoid_test.rb
geocoder-1.0.4 test/mongoid_test.rb
geocoder-1.0.3 test/mongoid_test.rb