Sha256: cadba080f2742a40b29699c591dfd443342c6c49d6e35ec96f9a91d69041aa15

Contents?: true

Size: 1.92 KB

Versions: 6

Compression:

Stored size: 1.92 KB

Contents

require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")

describe Animoto::Assets::Image do
  
  describe "initialization" do
    before do
      @image = Animoto::Assets::Image.new 'http://website.com/image.png',
        :rotation => 2, :spotlit => true, :cover => true
    end
    
    it "should set the source to the given url" do
      @image.source.should == 'http://website.com/image.png'
    end
    
    it "should set the rotation to the given amount" do
      @image.rotation.should == 2
    end
    
    it "should set the spotlighting to the given value" do
      @image.should be_spotlit
    end
    
    it "should set the cover to the given value" do
      @image.should be_a_cover
    end
  end

  describe "#to_hash" do
    before do
      @image = Animoto::Assets::Image.new 'http://website.com/image.png'
    end
    
    it "should have a 'source_url' key with the url" do
      @image.to_hash.should have_key('source_url')
      @image.to_hash['source_url'].should == @image.source
    end
    
    describe "if rotated" do
      before do
        @image.rotation = 2
      end
      
      it "should have a 'rotation' key with the rotation value" do
        @image.to_hash.should have_key('rotation')
        @image.to_hash['rotation'].should == @image.rotation
      end
    end
    
    describe "if spotlit" do
      before do
        @image.spotlit = true
      end
      
      it "should have a 'spotlit' key telling whether or not this image is spotlit" do
        @image.to_hash.should have_key('spotlit')
        @image.to_hash['spotlit'].should == @image.spotlit?
      end
    end
    
    describe "if this image is the cover" do
      before do
        @image.cover = true
      end
      
      it "should have a 'cover' key telling whether or not this image is the cover" do
        @image.to_hash.should have_key('cover')
        @image.to_hash['cover'].should == @image.cover?
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
animoto-1.5.3 ./spec/animoto/assets/image_spec.rb
animoto-1.5.2 ./spec/animoto/assets/image_spec.rb
animoto-1.5.1 ./spec/animoto/assets/image_spec.rb
animoto-1.5.0 ./spec/animoto/assets/image_spec.rb
animoto-1.3.1 ./spec/animoto/assets/image_spec.rb
animoto-1.3.0 ./spec/animoto/assets/image_spec.rb