Sha256: 7390e5065bb7d16e7bd840bcf00c7f8c907bb8585ab873fd79f99f166da6d0ed

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

require 'helper'

describe Twitter::Relationship do

  describe "#source" do
    it "returns a User when source is set" do
      source = Twitter::Relationship.new(:relationship => {:source => {:id => 7505382}}).source
      source.should be_a Twitter::SourceUser
    end
    it "returns nil when source is not set" do
      source = Twitter::Relationship.new(:relationship => {}).source
      source.should be_nil
    end
  end

  describe "#target" do
    it "returns a User when target is set" do
      target = Twitter::Relationship.new(:relationship => {:target => {:id => 7505382}}).target
      target.should be_a Twitter::TargetUser
    end
    it "returns nil when target is not set" do
      target = Twitter::Relationship.new(:relationship => {}).target
      target.should be_nil
    end
  end

  describe "#update" do
    it "updates a relationship" do
      relationship = Twitter::Relationship.new(:relationship => {:target => {:id => 7505382}})
      relationship.update(:relationship => {:target => {:id => 14100886}})
      relationship.target.id.should eq 14100886
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
twitter-4.1.0 spec/twitter/relationship_spec.rb
twitter-4.0.0 spec/twitter/relationship_spec.rb