Sha256: 14019b68e4bdccdaa36dda0fd8e44976d2762562d3966f5ba15add49c259486a

Contents?: true

Size: 1.1 KB

Versions: 16

Compression:

Stored size: 1.1 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
      expect(source).to be_a Twitter::SourceUser
    end
    it "returns nil when source is not set" do
      source = Twitter::Relationship.new(:relationship => {}).source
      expect(source).to 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
      expect(target).to be_a Twitter::TargetUser
    end
    it "returns nil when target is not set" do
      target = Twitter::Relationship.new(:relationship => {}).target
      expect(target).to 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}})
      expect(relationship.target.id).to eq 14100886
    end
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
twitter-4.8.1 spec/twitter/relationship_spec.rb
twitter-4.8.0 spec/twitter/relationship_spec.rb
twitter-4.7.0 spec/twitter/relationship_spec.rb
twitter-4.6.2 spec/twitter/relationship_spec.rb
twitter-4.6.1 spec/twitter/relationship_spec.rb
twitter-4.6.0 spec/twitter/relationship_spec.rb
twitter-4.5.0 spec/twitter/relationship_spec.rb
twitter-4.4.4 spec/twitter/relationship_spec.rb
twitter-4.4.3 spec/twitter/relationship_spec.rb
twitter-4.4.2 spec/twitter/relationship_spec.rb
twitter-4.4.1 spec/twitter/relationship_spec.rb
twitter-4.4.0 spec/twitter/relationship_spec.rb
twitter-4.3.0 spec/twitter/relationship_spec.rb
twitter-4.2.0 spec/twitter/relationship_spec.rb
twitter-4.1.2 spec/twitter/relationship_spec.rb
twitter-4.1.1 spec/twitter/relationship_spec.rb