Sha256: 0063369bc46ee9dc1f85086f998272fce5c20643718d015cd11616041cc0bab4

Contents?: true

Size: 1.26 KB

Versions: 14

Compression:

Stored size: 1.26 KB

Contents

require 'helper'

describe Twitter::Suggestion do

  describe '#==' do
    it 'returns true for empty objects' do
      suggestion = Twitter::Suggestion.new
      other = Twitter::Suggestion.new
      expect(suggestion == other).to be true
    end
    it 'returns true when objects slugs are the same' do
      suggestion = Twitter::Suggestion.new(:slug => 1, :name => 'foo')
      other = Twitter::Suggestion.new(:slug => 1, :name => 'bar')
      expect(suggestion == other).to be true
    end
    it 'returns false when objects slugs are different' do
      suggestion = Twitter::Suggestion.new(:slug => 1)
      other = Twitter::Suggestion.new(:slug => 2)
      expect(suggestion == other).to be false
    end
    it 'returns false when classes are different' do
      suggestion = Twitter::Suggestion.new(:slug => 1)
      other = Twitter::Base.new(:slug => 1)
      expect(suggestion == other).to be false
    end
  end

  describe '#users' do
    it 'returns a User when user is set' do
      users = Twitter::Suggestion.new(:users => [{:id => 7_505_382}]).users
      expect(users).to be_an Array
      expect(users.first).to be_a Twitter::User
    end
    it 'is empty when not set' do
      users = Twitter::Suggestion.new.users
      expect(users).to be_empty
    end
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

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