Skip to content

Instantly share code, notes, and snippets.

@thiagoa
Last active October 3, 2016 17:59
Show Gist options
  • Save thiagoa/dce9071acd8a30796ade5da3eae305de to your computer and use it in GitHub Desktop.
Save thiagoa/dce9071acd8a30796ade5da3eae305de to your computer and use it in GitHub Desktop.
def stub_timeline(id:, returns:)
instance = instance_double(TwitterTimelineHub)
allow(instance).to receive(:call).with(id).once.and_return(returns)
allow(TwitterTimelineHub).to receive(:new).once.and_return(instance)
end
def stub_result(**attrs)
instance_double(TwitterTimelineHub::Result, **attrs)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment