Skip to content

Instantly share code, notes, and snippets.

@levycarneiro
Created March 13, 2009 13:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save levycarneiro/78562 to your computer and use it in GitHub Desktop.
Save levycarneiro/78562 to your computer and use it in GitHub Desktop.
describe Tweet do
describe "basic fetching of tweets" do
it "should fetch new tweets from Twitter" do
new_search = mock(Twitter::Search)
search_containing = mock(Twitter::Search)
search_not_retweeted = mock(Twitter::Search)
search_since = mock(Twitter::Search)
last_id_processed = Tweet.stub!(:last_id_processed => 123)
search_since = mock(Twitter::Search)
Twitter::Search.should_receive(:new).and_return(new_search)
new_search.should_receive(:containing).with('protip:').and_return(search_containing)
search_containing.should_receive(:not_retweeted).and_return(search_not_retweeted)
search_not_retweeted.should_receive(:since).with(123).and_return(search_since)
search_since.should_receive(:fetch)
Tweet.fetch_new_tweets
end
it "should get the last tweet_id processed from the database" do
last_tweet = mock(Tweet)
Tweet.should_receive(:last).and_return(last_tweet)
last_tweet.should_receive(:object_id)
Tweet.last_id_processed
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment