Sha256: 468eb97d17a0700a19c405bc1d9b550c8d5cf3b8159bd03bb2d03af2b1a1d870

Contents?: true

Size: 1.67 KB

Versions: 1

Compression:

Stored size: 1.67 KB

Contents

require 'spec_helper'
require 'cartographie/map'

describe Cartographie::Map do

  subject { described_class.new }

  describe 'defaults' do
    its(:location) { should eq('Paris, France') }
    its(:width) { should eq(300) }
    its(:height) { should eq(300) }
    its(:size) { should eq('300x300') }
    its(:zoom) { should eq(15) }
    its(:file_format) { should eq('png') }
    its(:sensor) { should be_false }
  end

  describe 'with options' do
    let(:options) do
      { width: 75, height: 75, zoom: 10, file_format: 'jpg', sensor: true }
    end
    subject { described_class.new 'New York, NY', options }

    its(:location) { should eq('New York, NY') }
    its(:width) { should eq(75) }
    its(:height) { should eq(75) }
    its(:size) { should eq('75x75') }
    its(:zoom) { should eq(10) }
    its(:file_format) { should eq('jpg') }
    its(:sensor) { should be_true }
  end

  describe '#uri' do
    let(:map) { described_class.new 'Tokyo' }

    subject { map.uri }

    it "should match the instance's string representation" do
      subject.should eq(map.to_s)
    end

    it 'returns a Google Static Maps URI' do
      subject.should include('http://maps.googleapis.com/maps/api/staticmap')
    end

    it 'contains the map location' do
      subject.should include(map.location)
    end

    it 'contains the map size, like 640x640' do
      subject.should include(map.size)
    end

    it 'contains the map zoom level' do
      subject.should include(map.zoom.to_s)
    end

    it 'contains the map file format' do
      subject.should include(map.file_format)
    end

    it 'contains the map sensor indication' do
      subject.should include(map.sensor.to_s)
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cartographie-0.0.1 spec/cartographie/map_spec.rb