Sha256: 4affc248ccffe4baf3867f953689764daf483191047de3031d9443cf75211938

Contents?: true

Size: 1.21 KB

Versions: 2

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 false for empty objects" do
      geo = Twitter::Geo.new
      other = Twitter::Geo.new
      (geo == other).should be_false
    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]]])
      (@geo == other).should 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]]])
      (@geo == other).should be_false
    end
    it "returns false 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]]])
      (@geo == other).should be_false
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
twitter-4.1.0 spec/twitter/geo_spec.rb
twitter-4.0.0 spec/twitter/geo_spec.rb