Skip to content

Instantly share code, notes, and snippets.

@thiagoa
Last active October 10, 2016 16:47
Show Gist options
  • Save thiagoa/660c0f0f4829bd516005f4aaf115ef50 to your computer and use it in GitHub Desktop.
Save thiagoa/660c0f0f4829bd516005f4aaf115ef50 to your computer and use it in GitHub Desktop.
Twitter timeline hub spec when the timeline is forbidden
context 'when the timeline is forbidden' do
it 'returns a result with no tweets and forbidden status' do
twitter_client = double('twitter_client')
allow(twitter_client).to receive(:user_timeline)
.with('screen_name', count: 5)
.once { fail Twitter::Error::Unauthorized }
twitter_timeline_hub = TwitterTimelineHub.new(twitter_client)
result = twitter_timeline_hub.call('screen_name', count: 5)
expect(result.status).to eq :forbidden
expect(result.tweets).to be_empty
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment