Sha256: a7cbe8cdbdb38fa485b70f6f611084772d6bc5ab79bcab3aa7d4ce0e6279f44f

Contents?: true

Size: 1.34 KB

Versions: 4

Compression:

Stored size: 1.34 KB

Contents

require 'spec_helper'
require './lib/gmaps4rails/markers_builder'

describe Gmaps4rails::MarkersBuilder do

  describe "call" do
    let(:lat) { 40 }
    let(:lng) { 5  }
    let(:id)  { 'id' }
    let(:infowindow) { 'some infowindow content' }
    let(:name)       { 'name' }
    let(:picture)    { {
      :url    => "http://www.blankdots.com/img/github-32x32.png",
      :width  => "32",
      :height => "32"
    }}
    let(:shadow) { {
      :url    => "shadow",
      :width  => "30",
      :height => "30"
    } }
    let(:expected_hash) { {
      :lat          => lat,
      :lng          => lng,
      :marker_title => name,
      :some_id      => id,
      :infowindow   => infowindow,
      :picture      => picture,
      :shadow       => shadow
    }}
    let(:object) { OpenStruct.new(
      :latitude  => lat,
      :longitude => lng,
      :name      => name,
      :some_id   => id
    )}

    let(:action) { Gmaps4rails::MarkersBuilder.new(object).call do |user, marker|
        marker.lat        user.latitude
        marker.lng        user.longitude
        marker.infowindow infowindow
        marker.picture    picture
        marker.shadow     shadow
        marker.title      user.name
        marker.json({ :some_id => user.some_id })
      end
    }

    it "creates expected hash" do
      expect(action).to eq [expected_hash]
    end

  end


end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gmaps4rails-2.1.2 spec/lib/markers_builder_spec.rb
gmaps4rails-2.1.1 spec/lib/markers_builder_spec.rb
gmaps4rails-2.1.0 spec/lib/markers_builder_spec.rb
gmaps4rails-2.0.5 spec/lib/markers_builder_spec.rb