Sha256: fbbd063f8c0dd97d4338cbad99864087a6d5fa2a51dee6ffe8663f3eb55caf13

Contents?: true

Size: 1011 Bytes

Versions: 5

Compression:

Stored size: 1011 Bytes

Contents

require 'spec_helper'
require 'on_the_map/geo_locatable'

class MyGeoCodableAddress
  include Mongoid::Document
  include OnTheMap::GeoLocatable
end


describe OnTheMap::GeoLocatable do
  subject { address }

  context 'empty address' do
    let(:address) { MyGeoCodableAddress.create street: '', city: ''  }

    it 'should have a blank full address' do
      expect(subject.address.full).to be_blank
    end

    it 'should not be geolocatable' do
      expect(subject.geolocatable?).to be false
    end

    it 'should not be geocoded?' do
      expect(subject.geocoded?).to be false
    end
  end

  context 'invalid address' do
    let(:address) { MyGeoCodableAddress.create street: 'blip blab', city: 'blop'  }

    it 'should be geolocatable' do
      expect(subject.geolocatable?).to be_true
    end

    it 'should not calculate a position' do
      expect(subject.position.to_a).to be_blank
    end

    it 'should not be geocoded?' do
      expect(subject.geocoded?).to be false
    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/geo_locatable_spec.rb
on_the_map-0.1.4 spec/on_the_map/geo_locatable_spec.rb
on_the_map-0.1.3 spec/on_the_map/geo_locatable_spec.rb
on_the_map-0.1.1 spec/on_the_map/geo_locatable_spec.rb
on_the_map-0.1.0 spec/on_the_map/geo_locatable_spec.rb