Sha256: 6c0df30eabef5cd4fa777a53f63beddfcaf64cf1f8f70b137b6b408a2167c357

Contents?: true

Size: 1010 Bytes

Versions: 5

Compression:

Stored size: 1010 Bytes

Contents

require 'spec_helper'

require 'on_the_map/positionable'

require 'rails'
require 'mongoid'
require 'rails/mongoid'

module Dummy
  class Application < Rails::Application
  end
end

require 'mongoid_indexing'

class MyPositionableAddress
  include Mongoid::Document
#  include OnTheMap::GeoLocatable
  include OnTheMap::Positionable
end

describe OnTheMap::Positionable do
  subject { address }

  before :suite do
    Mongoid.logger = Logger.new($stdout)
    Moped.logger   = Logger.new($stdout)
  end

  context 'empty address' do
    let(:address) {   }

    before do
      5.times do |n|
        MyPositionableAddress.create position: [rand(n), n*4]
      end

      ::Mongoid::Indexing.create_indexes
    end

    describe 'positions' do
      before do
        @nearby = MyPositionableAddress.nearby(MyPositionableAddress.first.position)
        # puts "nearby: #{@nearby.to_a.inspect}"
      end

      it 'should have all nearby' do
        expect(@nearby).to have(5).items
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
on_the_map-0.1.5 spec/on_the_map/positionable_spec.rb
on_the_map-0.1.4 spec/on_the_map/positionable_spec.rb
on_the_map-0.1.3 spec/on_the_map/positionable_spec.rb
on_the_map-0.1.1 spec/on_the_map/positionable_spec.rb
on_the_map-0.1.0 spec/on_the_map/positionable_spec.rb