Sha256: e7cae87d2306bb536610230663b3d40e17a2f99dcf423d74d98f48b6ae58842a
Contents?: true
Size: 1.96 KB
Versions: 1
Compression:
Stored size: 1.96 KB
Contents
require 'spec_helper' require 'rails' require 'gmaps4rails' require 'on_the_map/mappable' class MyMappableAddress include Mongoid::Document # include OnTheMap::GeoLocatable include OnTheMap::Mappable end describe OnTheMap::Mappable do subject { address } context 'empty address' do let(:address) { MyMappableAddress.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 it 'should not have a gmaps' do expect(subject.gmaps).to_not be true end it 'should not have a normalized address' do expect(subject.normalized_address).to be_blank end end context 'invalid address' do let(:address) { MyMappableAddress.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 it 'should not have a gmaps' do expect(subject.gmaps).to_not be_true end it 'should not have a normalized address' do expect(subject.normalized_address).to be_blank end end context 'valid address' do let(:address) { MyMappableAddress.create street: street, city: city } let(:city) { 'Frederiksberg' } let(:street) { 'Maglekildevej 18, 4th' } describe 'creation' do its(:city) { should == city } its(:street) { should == street } # leave geocoding to geocoder! its(:gmaps_geocode?) { should be_false } # geocoder sets gmaps when position has been calculated? # Note: not done anymore its(:gmaps) { should be_false } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
on_the_map-0.1.1 | spec/on_the_map/mappable_spec.rb |