File: geo_results_spec.rb

package info (click to toggle)
ruby-twitter 7.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 4,840 kB
  • sloc: ruby: 10,919; makefile: 6
file content (33 lines) | stat: -rw-r--r-- 903 bytes parent folder | download | duplicates (3)
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
require 'helper'

describe Twitter::GeoResults do
  describe '#each' do
    before do
      @geo_results = Twitter::GeoResults.new(result: {places: [{id: 1}, {id: 2}, {id: 3}, {id: 4}, {id: 5}, {id: 6}]})
    end
    it 'iterates' do
      count = 0
      @geo_results.each { count += 1 }
      expect(count).to eq(6)
    end
    context 'with start' do
      it 'iterates' do
        count = 0
        @geo_results.each(5) { count += 1 }
        expect(count).to eq(1)
      end
    end
  end

  describe '#token' do
    it 'returns a String when token is set' do
      geo_results = Twitter::GeoResults.new(result: {}, token: 'abc123')
      expect(geo_results.token).to be_a String
      expect(geo_results.token).to eq('abc123')
    end
    it 'returns nil when token is not set' do
      geo_results = Twitter::GeoResults.new(result: {})
      expect(geo_results.token).to be_nil
    end
  end
end