Sha256: dcb4ad0b36e6cb94c1e549a9af6b9a609ea953a579f13b09393e3de08ce8b41d

Contents?: true

Size: 1.54 KB

Versions: 11

Compression:

Stored size: 1.54 KB

Contents

require File.expand_path('../../../test_helper', __FILE__)

module Etsy
  class ImageTest < Test::Unit::TestCase

    context "The Image class" do

      context "without oauth" do
        should "be able to find all images for a listing" do
          images = mock_request('/listings/1/images', {}, 'Image', 'findAllListingImages.json')
          Image.find_all_by_listing_id(1, {}).should == images
        end
      end

      context "with options" do
        should "be able to find all images for a listing with options in request" do
          images = mock_request('/listings/1/images', {foo: "bar"}, 'Image', 'findAllListingImages.json')
          Image.find_all_by_listing_id(1, {foo: "bar"}).should == images
        end
      end
    end

    context "An instance of the Image class" do

      context "with response data" do
        setup do
          data = read_fixture('image/findAllListingImages.json')
          @image = Image.new(data.first)
        end

        should "have a value for :square" do
          @image.square.should == "http://ny-image0.etsy.com/il_75x75.185073072.jpg"
        end

        should "have a value for :small" do
          @image.small.should == "http://ny-image0.etsy.com/il_170x135.185073072.jpg"
        end

        should "have a value for :thumbnail" do
          @image.thumbnail.should == "http://ny-image0.etsy.com/il_570xN.185073072.jpg"
        end

        should "have a value for :full" do
          @image.full.should == "http://ny-image0.etsy.com/il_fullxfull.185073072.jpg"
        end
      end

    end

  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
etsy-0.3.3 test/unit/etsy/image_test.rb
cardmagic-etsy-0.3.9 test/unit/etsy/image_test.rb
cardmagic-etsy-0.3.8 test/unit/etsy/image_test.rb
cardmagic-etsy-0.3.7 test/unit/etsy/image_test.rb
cardmagic-etsy-0.3.6 test/unit/etsy/image_test.rb
cardmagic-etsy-0.3.5 test/unit/etsy/image_test.rb
cardmagic-etsy-0.3.4 test/unit/etsy/image_test.rb
cardmagic-etsy-0.3.3 test/unit/etsy/image_test.rb
cardmagic-etsy-0.3.2 test/unit/etsy/image_test.rb
etsy-0.3.2 test/unit/etsy/image_test.rb
etsy-0.3.1 test/unit/etsy/image_test.rb