Permalink
Browse files

Added Twitter::Mention#source

  • Loading branch information...
tricon committed Feb 29, 2012
1 parent f50ff25 commit 6829994f4d8ca1e6d444fa75dc78c06bd01a5d74
Showing with 18 additions and 0 deletions.
  1. +7 −0 lib/twitter/mention.rb
  2. +11 −0 spec/twitter/mention_spec.rb
View
@@ -14,6 +14,13 @@ def sources
end
end
+ # The user who mentioned a user
+ #
+ # @return [Twitter::User]
+ def source
+ @source = sources.first
+ end
+
# A collection of statuses that mention a user
#
# @return [Array<Twitter::Status>]
@@ -14,6 +14,17 @@
end
end
+ describe "#source" do
+ it "should return the user who mentioned a user" do
+ source = Twitter::Mention.new('sources' => [{}]).source
+ source.should be_a Twitter::User
+ end
+ it "should be nil when not set" do
+ source = Twitter::Mention.new.source
+ source.should be_nil
+ end
+ end
+
describe "#target_objects" do
it "should return a collection of statuses that mention a user" do
targets = Twitter::Mention.new('target_objects' => [{}]).target_objects

0 comments on commit 6829994

Please sign in to comment.