Sha256: a107d16fb543372a8bcbf39082010d1845999041cc785259491d1aa5587db1ae
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 KB
Contents
require 'spec_helper' describe Clusterable::Point do describe 'instance methods' do let(:marker) { Clusterable::Point.new(50.9985319, 5.8573735) } describe '#initialize' do let(:marker) { Clusterable::Point.new('latitude', 'longitude') } it 'sets the latitude' do marker[:latitude].should eql('latitude') end it 'sets the longitude' do marker[:longitude].should eql('longitude') end end describe '#latitude' do it 'returns the latitude' do marker.latitude.should eql(marker[:latitude]) end end describe '#longitude' do it 'returns the longitude' do marker.longitude.should eql(marker[:longitude]) end end describe '#distance_to' do let(:target) { Clusterable::Point.new(50.8889999, 5.9773202) } it 'returns the distance to another point' do marker.distance_to(marker).should eql(0.0) marker.distance_to(target).should eql(0.16243297037513815) end end describe '#to_s' do it 'returns the point as a string' do marker.to_s.should eql('50.9985319, 5.8573735') end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
clusterable-0.0.1 | spec/lib/clusterable/point_spec.rb |