Sha256: e5b6d2faef8af13ee0a259d4edf8c0e75f66b31190e924b566fe4e2a6e8fada0

Contents?: true

Size: 1.28 KB

Versions: 14

Compression:

Stored size: 1.28 KB

Contents

require 'helper'

describe Twitter::Geo::Polygon do

  before do
    @polygon = Twitter::Geo::Polygon.new(:coordinates => [[[-122.40348192, 37.77752898], [-122.387436, 37.77752898], [-122.387436, 37.79448597], [-122.40348192, 37.79448597]]])
  end

  describe '#==' do
    it 'returns true for empty objects' do
      polygon = Twitter::Geo::Polygon.new
      other = Twitter::Geo::Polygon.new
      expect(polygon == other).to be true
    end
    it 'returns true when objects coordinates are the same' do
      other = Twitter::Geo::Polygon.new(:coordinates => [[[-122.40348192, 37.77752898], [-122.387436, 37.77752898], [-122.387436, 37.79448597], [-122.40348192, 37.79448597]]])
      expect(@polygon == other).to be true
    end
    it 'returns false when objects coordinates are different' do
      other = Twitter::Geo::Polygon.new(:coordinates => [[[37.77752898, -122.40348192], [37.77752898, -122.387436], [37.79448597, -122.387436], [37.79448597, -122.40348192]]])
      expect(@polygon == other).to be false
    end
    it 'returns false when classes are different' do
      other = Twitter::Geo.new(:coordinates => [[[-122.40348192, 37.77752898], [-122.387436, 37.77752898], [-122.387436, 37.79448597], [-122.40348192, 37.79448597]]])
      expect(@polygon == other).to be false
    end
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
twitter-5.11.0 spec/twitter/geo/polygon_spec.rb
twitter-5.10.0 spec/twitter/geo/polygon_spec.rb
twitter-5.9.0 spec/twitter/geo/polygon_spec.rb
twitter-5.8.0 spec/twitter/geo/polygon_spec.rb
twitter-5.7.1 spec/twitter/geo/polygon_spec.rb
twitter-5.7.0 spec/twitter/geo/polygon_spec.rb
twitter-5.6.0 spec/twitter/geo/polygon_spec.rb
twitter-5.5.1 spec/twitter/geo/polygon_spec.rb
twitter-5.5.0 spec/twitter/geo/polygon_spec.rb
twitter-5.4.1 spec/twitter/geo/polygon_spec.rb
twitter-5.4.0 spec/twitter/geo/polygon_spec.rb
twitter-5.3.1 spec/twitter/geo/polygon_spec.rb
twitter-5.3.0 spec/twitter/geo/polygon_spec.rb
twitter-5.2.0 spec/twitter/geo/polygon_spec.rb