apneadiving / Google-Maps-for-Rails

Enables easy Google map + overlays creation in Ruby apps
https://apneadiving.github.io/
MIT License
2.26k stars 382 forks source link

Tested and works #222

Closed kristianmandrup closed 12 years ago

kristianmandrup commented 12 years ago

At least the models/place_spec.rb now runs without fail

describe Gmaps4rails::ActsAsGmappable do

  let(:place)         { Factory(:place) }
  let(:invalid_place) { Factory.build(:invalid_place) }

  before(:each) do
    Geocoding.stub_geocoding
  end

  context "standard configuration, valid place" do
    it "should save longitude and latitude to the customized array" do
      set_gmaps4rails_options!(:lat_lng_array  => 'location')
      place.location.should_not be_nil
      place.should have_same_position_as TOULON
    end
  end
end

The model place.rb


require 'mongoid'

class Place  
  include Mongoid::Document
  include Gmaps4rails::ActsAsGmappable

  acts_as_gmappable :address => :address, :lat_lng_array => :location

  field :location, :type => Array
  field :address,  :type => String
  field :gmaps,    :type => Boolean
end