Sha256: fd33a71a5cb045fa71a75edc61e7be527197dbfe68e9d81ea32817efe6343501

Contents?: true

Size: 1.32 KB

Versions: 16

Compression:

Stored size: 1.32 KB

Contents

require 'helper'

describe Twitter::Media::Photo do

  describe "#==" do
    it "returns true when objects IDs are the same" do
      photo = Twitter::Media::Photo.new(:id => 1, :url => "foo")
      other = Twitter::Media::Photo.new(:id => 1, :url => "bar")
      expect(photo == other).to be_true
    end
    it "returns false when objects IDs are different" do
      photo = Twitter::Media::Photo.new(:id => 1)
      other = Twitter::Media::Photo.new(:id => 2)
      expect(photo == other).to be_false
    end
    it "returns false when classes are different" do
      photo = Twitter::Media::Photo.new(:id => 1)
      other = Twitter::Identity.new(:id => 1)
      expect(photo == other).to be_false
    end
  end

  describe "#sizes" do
    it "returns a hash of Sizes when sizes is set" do
      sizes = Twitter::Media::Photo.new(:id => 110102452988157952, :sizes => {:small => {:h => 226, :w => 340, :resize => 'fit'}, :large => {:h => 466, :w => 700, :resize => 'fit'}, :medium => {:h => 399, :w => 600, :resize => 'fit'}, :thumb => {:h => 150, :w => 150, :resize => 'crop'}}).sizes
      expect(sizes).to be_a Hash
      expect(sizes[:small]).to be_a Twitter::Size
    end
    it "is empty when sizes is not set" do
      sizes = Twitter::Media::Photo.new(:id => 110102452988157952).sizes
      expect(sizes).to be_empty
    end
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

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