Sha256: 54836677fdc1da6d0124df79971723ea8153d73cbecc417110a0b7efd850305e

Contents?: true

Size: 1.3 KB

Versions: 2

Compression:

Stored size: 1.3 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")
      (photo == other).should 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)
      (photo == other).should be_false
    end
    it "returns false when classes are different" do
      photo = Twitter::Media::Photo.new(:id => 1)
      other = Twitter::Identity.new(:id => 1)
      (photo == other).should 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
      sizes.should be_a Hash
      sizes[:small].should be_a Twitter::Size
    end
    it "is empty when sizes is not set" do
      sizes = Twitter::Media::Photo.new(:id => 110102452988157952).sizes
      sizes.should be_empty
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
twitter-4.1.0 spec/twitter/media/photo_spec.rb
twitter-4.0.0 spec/twitter/media/photo_spec.rb