Skip to content

Commit

Permalink
Correct retweet response. Retweeted status should be the original tweet
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian-Choi committed Mar 4, 2014
1 parent ee40768 commit 70fede7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
4 changes: 1 addition & 3 deletions lib/twitter/rest/tweets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,7 @@ def parallel_tweets_from_response(request_method, path, args)

def post_retweet(tweet, options)
response = post("/1.1/statuses/retweet/#{extract_id(tweet)}.json", options).body
retweeted_status = response.delete(:retweeted_status)
retweeted_status[:retweeted_status] = response
Twitter::Tweet.new(retweeted_status)
Twitter::Tweet.new(response)
end
end
end
Expand Down
1 change: 0 additions & 1 deletion lib/twitter/tweet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class Tweet < Twitter::Identity
object_attr_reader :Metadata, :metadata
object_attr_reader :Place, :place
object_attr_reader :Tweet, :retweeted_status
alias_method :retweet, :retweeted_status
alias_method :retweeted_tweet, :retweeted_status
alias_method :retweet?, :retweeted_status?
alias_method :retweeted_tweet?, :retweeted_status?
Expand Down
8 changes: 4 additions & 4 deletions spec/twitter/rest/tweets_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,8 @@
tweets = @client.retweet(25_938_088_801)
expect(tweets).to be_an Array
expect(tweets.first).to be_a Twitter::Tweet
expect(tweets.first.text).to eq("As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush.")
expect(tweets.first.retweeted_tweet.text).to eq("RT @gruber: As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush.")
expect(tweets.first.text).to eq("RT @gruber: As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush.")
expect(tweets.first.retweeted_tweet.text).to eq("As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush.")
expect(tweets.first.retweeted_tweet.id).not_to eq(tweets.first.id)
end
context 'already retweeted' do
Expand Down Expand Up @@ -393,8 +393,8 @@
tweets = @client.retweet!(25_938_088_801)
expect(tweets).to be_an Array
expect(tweets.first).to be_a Twitter::Tweet
expect(tweets.first.text).to eq("As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush.")
expect(tweets.first.retweeted_tweet.text).to eq("RT @gruber: As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush.")
expect(tweets.first.text).to eq("RT @gruber: As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush.")
expect(tweets.first.retweeted_tweet.text).to eq("As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush.")
expect(tweets.first.retweeted_tweet.id).not_to eq(tweets.first.id)
end
context 'forbidden' do
Expand Down

0 comments on commit 70fede7

Please sign in to comment.