File: point_spec.rb

package info (click to toggle)
ruby-twitter 7.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,884 kB
  • sloc: ruby: 10,919; makefile: 6
file content (39 lines) | stat: -rw-r--r-- 1,143 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
require 'helper'

describe Twitter::Geo::Point do
  before do
    @point = Twitter::Geo::Point.new(coordinates: [-122.399983, 37.788299])
  end

  describe '#==' do
    it 'returns true for empty objects' do
      point = Twitter::Geo::Point.new
      other = Twitter::Geo::Point.new
      expect(point == other).to be true
    end
    it 'returns true when objects coordinates are the same' do
      other = Twitter::Geo::Point.new(coordinates: [-122.399983, 37.788299])
      expect(@point == other).to be true
    end
    it 'returns false when objects coordinates are different' do
      other = Twitter::Geo::Point.new(coordinates: [37.788299, -122.399983])
      expect(@point == other).to be false
    end
    it 'returns false when classes are different' do
      other = Twitter::Geo.new(coordinates: [-122.399983, 37.788299])
      expect(@point == other).to be false
    end
  end

  describe '#latitude' do
    it 'returns the latitude' do
      expect(@point.latitude).to eq(-122.399983)
    end
  end

  describe '#longitude' do
    it 'returns the longitude' do
      expect(@point.longitude).to eq(37.788299)
    end
  end
end