Sha256: 76968786a1ec54cac7ce2e1a8a762913c366b2e63216d3eb2f29f38653380815

Contents?: true

Size: 1.64 KB

Versions: 14

Compression:

Stored size: 1.64 KB

Contents

require 'helper'

describe Twitter::Relationship do

  describe '#source' do
    it 'returns a User when source is set' do
      relationship = Twitter::Relationship.new(:relationship => {:source => {:id => 7_505_382}})
      expect(relationship.source).to be_a Twitter::SourceUser
    end
    it 'returns nil when source is not set' do
      relationship = Twitter::Relationship.new(:relationship => {})
      expect(relationship.source).to be_nil
    end
  end

  describe '#source?' do
    it 'returns true when source is set' do
      relationship = Twitter::Relationship.new(:relationship => {:source => {:id => 7_505_382}})
      expect(relationship.source?).to be true
    end
    it 'returns false when source is not set' do
      relationship = Twitter::Relationship.new(:relationship => {})
      expect(relationship.source?).to be false
    end
  end

  describe '#target' do
    it 'returns a User when target is set' do
      relationship = Twitter::Relationship.new(:relationship => {:target => {:id => 7_505_382}})
      expect(relationship.target).to be_a Twitter::TargetUser
    end
    it 'returns nil when target is not set' do
      relationship = Twitter::Relationship.new(:relationship => {})
      expect(relationship.target).to be_nil
    end
  end

  describe '#target?' do
    it 'returns true when target is set' do
      relationship = Twitter::Relationship.new(:relationship => {:target => {:id => 7_505_382}})
      expect(relationship.target?).to be true
    end
    it 'returns false when target is not set' do
      relationship = Twitter::Relationship.new(:relationship => {})
      expect(relationship.target?).to be false
    end
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
twitter-5.11.0 spec/twitter/relationship_spec.rb
twitter-5.10.0 spec/twitter/relationship_spec.rb
twitter-5.9.0 spec/twitter/relationship_spec.rb
twitter-5.8.0 spec/twitter/relationship_spec.rb
twitter-5.7.1 spec/twitter/relationship_spec.rb
twitter-5.7.0 spec/twitter/relationship_spec.rb
twitter-5.6.0 spec/twitter/relationship_spec.rb
twitter-5.5.1 spec/twitter/relationship_spec.rb
twitter-5.5.0 spec/twitter/relationship_spec.rb
twitter-5.4.1 spec/twitter/relationship_spec.rb
twitter-5.4.0 spec/twitter/relationship_spec.rb
twitter-5.3.1 spec/twitter/relationship_spec.rb
twitter-5.3.0 spec/twitter/relationship_spec.rb
twitter-5.2.0 spec/twitter/relationship_spec.rb