Sha256: 0e7336f588cc69f544dd09bc7ff2a3993b57da8f59a78f430a3174e01a67de54

Contents?: true

Size: 1.21 KB

Versions: 4

Compression:

Stored size: 1.21 KB

Contents

require 'helper'

describe Twitter::Geo do

  before do
    @geo = Twitter::Geo.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
      geo = Twitter::Geo.new
      other = Twitter::Geo.new
      expect(geo == other).to be true
    end
    it "returns true when objects coordinates are the same" do
      other = Twitter::Geo.new(:coordinates => [[[-122.40348192, 37.77752898], [-122.387436, 37.77752898], [-122.387436, 37.79448597], [-122.40348192, 37.79448597]]])
      expect(@geo == other).to be true
    end
    it "returns false when objects coordinates are different" do
      other = Twitter::Geo.new(:coordinates => [[[37.77752898, -122.40348192], [37.77752898, -122.387436], [37.79448597, -122.387436], [37.79448597, -122.40348192]]])
      expect(@geo == other).to be false
    end
    it "returns true when classes are different" do
      other = Twitter::Geo::Polygon.new(:coordinates => [[[-122.40348192, 37.77752898], [-122.387436, 37.77752898], [-122.387436, 37.79448597], [-122.40348192, 37.79448597]]])
      expect(@geo == other).to be true
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
twitter-5.1.1 spec/twitter/geo_spec.rb
twitter-5.1.0 spec/twitter/geo_spec.rb
twitter-5.0.1 spec/twitter/geo_spec.rb
twitter-5.0.0 spec/twitter/geo_spec.rb