Sha256: 4ba23ed9cb86c8d408b42c423efe31b2aed423770aa709246d65ab9fe8e67b08

Contents?: true

Size: 1.41 KB

Versions: 10

Compression:

Stored size: 1.41 KB

Contents

require 'helper'

describe Twitter::SearchResults 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/search/tweets.json').with(:query => {:q => '#freebandnames', :count => '100'}).to_return(:body => fixture('search.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
      stub_get('/1.1/search/tweets.json').with(:query => {:q => '#freebandnames', :count => '3', :include_entities => '1', :max_id => '414071361066532863'}).to_return(:body => fixture('search2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
    end
    it 'requests the correct resources' do
      @client.search('#freebandnames').each {}
      expect(a_get('/1.1/search/tweets.json').with(:query => {:q => '#freebandnames', :count => '100'})).to have_been_made
      expect(a_get('/1.1/search/tweets.json').with(:query => {:q => '#freebandnames', :count => '3', :include_entities => '1', :max_id => '414071361066532863'})).to have_been_made
    end
    it 'iterates' do
      count = 0
      @client.search('#freebandnames').each { count += 1 }
      expect(count).to eq(6)
    end
    context 'with start' do
      it 'iterates' do
        count = 0
        @client.search('#freebandnames').each(5) { count += 1 }
        expect(count).to eq(1)
      end
    end
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

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