Skip to content

Commit

Permalink
Alias Twitter::Tweet#reply? to Twitter::Tweet#in_reply_to_user_id?
Browse files Browse the repository at this point in the history
Before this patch, manual replies (created without pressing a reply
button) would return false, since they do not have an
in_reply_to_status_id.
  • Loading branch information
sferik committed Feb 15, 2014
1 parent 7bfc7e5 commit 5714728
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/twitter/tweet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Tweet < Twitter::Identity
deprecate_alias :favorites_count, :favorite_count
deprecate_alias :favoriters_count, :favorite_count
alias_method :in_reply_to_tweet_id, :in_reply_to_status_id
alias_method :reply?, :in_reply_to_status_id?
alias_method :reply?, :in_reply_to_user_id?
deprecate_alias :retweeters_count, :retweet_count
object_attr_reader :GeoFactory, :geo
object_attr_reader :Metadata, :metadata
Expand Down
6 changes: 3 additions & 3 deletions spec/twitter/tweet_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,11 @@
end

describe '#reply?' do
it 'returns true when there is an in-reply-to status' do
tweet = Twitter::Tweet.new(:id => 28_669_546_014, :in_reply_to_status_id => 114_749_583_439_036_416)
it 'returns true when there is an in-reply-to user' do
tweet = Twitter::Tweet.new(:id => 28_669_546_014, :in_reply_to_user_id => 7_505_382)
expect(tweet.reply?).to be true
end
it 'returns false when in_reply_to_status_id is not set' do
it 'returns false when in_reply_to_user_id is not set' do
tweet = Twitter::Tweet.new(:id => 28_669_546_014)
expect(tweet.reply?).to be false
end
Expand Down

0 comments on commit 5714728

Please sign in to comment.