Sha256: 2a5b53111208f0794fdea8423c483b125492388024609bbafe72a58ce27ee471

Contents?: true

Size: 1.57 KB

Versions: 2

Compression:

Stored size: 1.57 KB

Contents

require 'helper'

describe Twitter::Action::Mention do

  describe "#sources" do
    it "returns a collection of users who mentioned a user" do
      sources = Twitter::Action::Mention.new(:sources => [{:id => 7505382}]).sources
      sources.should be_an Array
      sources.first.should be_a Twitter::User
    end
    it "is empty when not set" do
      sources = Twitter::Action::Mention.new.sources
      sources.should be_empty
    end
  end

  describe "#source" do
    it "returns the user who mentioned a user" do
      source = Twitter::Action::Mention.new(:sources => [{:id => 7505382}]).source
      source.should be_a Twitter::User
    end
    it "returns nil when not set" do
      source = Twitter::Action::Mention.new.source
      source.should be_nil
    end
  end

  describe "#target_objects" do
    it "returns a collection of Tweets that mention a user" do
      targets = Twitter::Action::Mention.new(:target_objects => [{:id => 25938088801}]).target_objects
      targets.should be_an Array
      targets.first.should be_a Twitter::Tweet
    end
    it "is empty when not set" do
      targets = Twitter::Action::Mention.new.target_objects
      targets.should be_empty
    end
  end

  describe "#targets" do
    it "returns a collection containing the mentioned user" do
      targets = Twitter::Action::Mention.new(:targets => [{:id => 7505382}]).targets
      targets.should be_an Array
      targets.first.should be_a Twitter::User
    end
    it "is empty when not set" do
      targets = Twitter::Action::Mention.new.targets
      targets.should be_empty
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
twitter-4.1.0 spec/twitter/action/mention_spec.rb
twitter-4.0.0 spec/twitter/action/mention_spec.rb