Skip to content

Commit

Permalink
Add spec coverage for Twitter::Utils.parallel_map with more than one …
Browse files Browse the repository at this point in the history
…element
  • Loading branch information
sferik committed Dec 18, 2013
1 parent a556028 commit 715b979
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion spec/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

SimpleCov.start do
add_filter '/spec/'
minimum_coverage(99.13)
minimum_coverage(99.24)
end

require 'twitter'
Expand Down
18 changes: 14 additions & 4 deletions spec/twitter/rest/api/saved_searches_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,21 @@
context 'with ids passed' do
before do
stub_get('/1.1/saved_searches/show/16129012.json').to_return(:body => fixture('saved_search.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
stub_get('/1.1/saved_searches/show/16129013.json').to_return(:body => fixture('saved_search.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
end
it 'requests the correct resource' do
@client.saved_searches(16_129_012)
@client.saved_searches(16_129_012, 16_129_013)
expect(a_get('/1.1/saved_searches/show/16129012.json')).to have_been_made
expect(a_get('/1.1/saved_searches/show/16129013.json')).to have_been_made
end
it 'returns an array of saved searches' do
saved_searches = @client.saved_searches(16_129_012)
saved_searches = @client.saved_searches(16_129_012, 16_129_013)
expect(saved_searches).to be_an Array
expect(saved_searches.size).to eq(2)
expect(saved_searches.first).to be_a Twitter::SavedSearch
expect(saved_searches.first.name).to eq('twitter')
expect(saved_searches.last).to be_a Twitter::SavedSearch
expect(saved_searches.last.name).to eq('twitter')
end
end
context 'without ids passed' do
Expand Down Expand Up @@ -72,16 +77,21 @@
describe '#destroy_saved_search' do
before do
stub_post('/1.1/saved_searches/destroy/16129012.json').to_return(:body => fixture('saved_search.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
stub_post('/1.1/saved_searches/destroy/16129013.json').to_return(:body => fixture('saved_search.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
end
it 'requests the correct resource' do
@client.destroy_saved_search(16_129_012)
@client.destroy_saved_search(16_129_012, 16_129_013)
expect(a_post('/1.1/saved_searches/destroy/16129012.json')).to have_been_made
expect(a_post('/1.1/saved_searches/destroy/16129013.json')).to have_been_made
end
it 'returns an array of deleted saved searches' do
saved_searches = @client.destroy_saved_search(16_129_012)
saved_searches = @client.destroy_saved_search(16_129_012, 16_129_013)
expect(saved_searches).to be_an Array
expect(saved_searches.size).to eq(2)
expect(saved_searches.first).to be_a Twitter::SavedSearch
expect(saved_searches.first.name).to eq('twitter')
expect(saved_searches.last).to be_a Twitter::SavedSearch
expect(saved_searches.last.name).to eq('twitter')
end
end

Expand Down

0 comments on commit 715b979

Please sign in to comment.