Sha256: c61feb01a2da3acf71e8c8fe8fb582f3a35af1004e6ef7e9d8a6aa0616cd997e

Contents?: true

Size: 1.33 KB

Versions: 11

Compression:

Stored size: 1.33 KB

Contents

require 'helper'

describe Twitter::Cursor do

  describe '#each' do
    before do
      @client = Twitter::REST::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS', :access_token => 'AT', :access_token_secret => 'AS')
      stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('ids_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
      stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '1305102810874389703', :screen_name => 'sferik'}).to_return(:body => fixture('ids_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
    end
    it 'requests the correct resources' do
      @client.follower_ids('sferik').each {}
      expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
      expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '1305102810874389703', :screen_name => 'sferik'})).to have_been_made
    end
    it 'iterates' do
      count = 0
      @client.follower_ids('sferik').each { count += 1 }
      expect(count).to eq(6)
    end
    context 'with start' do
      it 'iterates' do
        count = 0
        @client.follower_ids('sferik').each(5) { count += 1 }
        expect(count).to eq(1)
      end
    end
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
twitter-5.11.0 spec/twitter/cursor_spec.rb
twitter-5.10.0 spec/twitter/cursor_spec.rb
twitter-5.9.0 spec/twitter/cursor_spec.rb
twitter-5.8.0 spec/twitter/cursor_spec.rb
twitter-5.7.1 spec/twitter/cursor_spec.rb
twitter-5.7.0 spec/twitter/cursor_spec.rb
twitter-5.6.0 spec/twitter/cursor_spec.rb
twitter-5.5.1 spec/twitter/cursor_spec.rb
twitter-5.5.0 spec/twitter/cursor_spec.rb
twitter-5.4.1 spec/twitter/cursor_spec.rb
twitter-5.4.0 spec/twitter/cursor_spec.rb