Created
October 5, 2016 12:54
-
-
Save thiagoa/590a47121ed3d666075ff3ff696289fb to your computer and use it in GitHub Desktop.
TwitterTimelineHub - When the timeline is found
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
context 'when the timeline is found' do | |
it 'returns a result object with tweets and an ok status' do | |
twitter_client = instance_double(Twitter::REST::Client) | |
tweet = build_tweet_double( | |
user_name: 'thiagoaraujos', | |
text: 'Foo @bar', | |
mention_name: 'bar', | |
created_at: Date.new(2016, 1, 1) | |
) | |
allow(twitter_client).to receive(:user_timeline).and_return([tweet]) | |
twitter_timeline_hub = TwitterTimelineHub.new(twitter_client) | |
result = twitter_timeline_hub.call('foo') | |
expect(result.status).to eq :ok | |
expect(result.tweets).to eq( | |
[ | |
screen_name: 'thiagoaraujos', | |
text: 'Foo @bar', | |
mentions: ['bar'], | |
created_at: Date.new(2016, 1, 1) | |
] | |
) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment