Skip to content

Instantly share code, notes, and snippets.

@thiagoa
Created October 5, 2016 12:54
Show Gist options
  • Save thiagoa/590a47121ed3d666075ff3ff696289fb to your computer and use it in GitHub Desktop.
Save thiagoa/590a47121ed3d666075ff3ff696289fb to your computer and use it in GitHub Desktop.
TwitterTimelineHub - When the timeline is found
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