Sha256: f624d5018bfe4f7deb4343462026ce4b8952e5f1d10c688944f6513e25201651

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

describe Smappy::Marker do
  let(:marker) { Smappy::Marker.new(50.9985099, 5.857652) }
  
  describe '#initialize' do
    it 'sets a default image' do
      marker.image.should == File.expand_path('../../../markers/information_marker.png', __FILE__)
    end
    
    it 'sets a default offset' do
      marker.offset.should == [-16, -37]
    end
  end
  
  describe '#width' do
    it 'returns the width of the marker image' do
      marker.width.should == 32
    end
  end
  
  describe '#height' do
    it 'returns the height of the marker image' do
      marker.height.should == 37
    end
  end
  
  describe '#position_on_map' do
    let(:map) { Smappy::StaticMap.new(center: [50.9985099, 5.857652], zoomlevel: 15) }
    
    it 'returns the coordinates of the marker on the given map' do
      marker.position_on_map(map).should == [234, 138]
    end
    
    it 'returns the coordinates of the marker on the given map offset by the specified offset' do
      marker.offset = [0, 0]
      marker.position_on_map(map).should == [250, 175]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
smappy-0.0.3 spec/smappy/marker_spec.rb
smappy-0.0.2 spec/smappy/marker_spec.rb