Skip to content

Commit

Permalink
Pass options from initial request to each subsequent request
Browse files Browse the repository at this point in the history
Closes #596.
  • Loading branch information
sferik committed Sep 6, 2015
1 parent f3d3de7 commit ee757c5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/twitter/search_results.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def next_page

# @return [Hash]
def fetch_next_page
response = Twitter::REST::Request.new(@client, @request_method, @path, next_page).perform
response = Twitter::REST::Request.new(@client, @request_method, @path, @options.merge(next_page)).perform
self.attrs = response
end

Expand Down
7 changes: 7 additions & 0 deletions spec/twitter/search_results_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
@client.search('#freebandnames').each { count += 1 }
expect(count).to eq(6)
end
it 'passes through parameters to the next request' do
stub_get('/1.1/search/tweets.json').with(query: {q: '#freebandnames', since_id: '414071360078878542', 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', since_id: '414071360078878542', count: '3', include_entities: '1', max_id: '414071361066532863'}).to_return(body: fixture('search2.json'), headers: {content_type: 'application/json; charset=utf-8'})
@client.search('#freebandnames', since_id: 414_071_360_078_878_542).each {}
expect(a_get('/1.1/search/tweets.json').with(query: {q: '#freebandnames', since_id: '414071360078878542', count: '100'})).to have_been_made
expect(a_get('/1.1/search/tweets.json').with(query: {q: '#freebandnames', since_id: '414071360078878542', count: '3', include_entities: '1', max_id: '414071361066532863'})).to have_been_made
end
context 'with start' do
it 'iterates' do
count = 0
Expand Down

0 comments on commit ee757c5

Please sign in to comment.