Sha256: c9ec7b987a43fc62991c3aecd53ffd665b9e6800aec99ed1af7a6da338d94c31

Contents?: true

Size: 1.5 KB

Versions: 2

Compression:

Stored size: 1.5 KB

Contents

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

describe Animoto::Song do
  
  describe "#to_hash" do
    before do
      @song = Animoto::Song.new 'http://website.com/song.mp3'
    end
    
    it "should have a 'source_url' key with the url" do
      @song.to_hash.should have_key('source_url')
      @song.to_hash['source_url'].should == @song.source_url
    end
    
    describe "if a start time was specified" do
      before do
        @song.start_time = 30.2
      end
      
      it "should have a 'start_time' key with the start time" do
        @song.to_hash.should have_key('start_time')
        @song.to_hash['start_time'].should == @song.start_time
      end
    end
    
    describe "if a duration was specified" do
      before do
        @song.duration = 300
      end
      
      it "should have a 'duration' key with the duration" do
        @song.to_hash.should have_key('duration')
        @song.to_hash['duration'].should == @song.duration
      end
    end
    
    describe "if a title and/or artist was specified" do
      before do
        @song.title = "Antarctican Drinking Song"
        @song.artist = "Gwar"
      end
      
      it "should have an 'artist' key with the artist" do
        @song.to_hash.should have_key('artist')
        @song.to_hash['artist'].should == @song.artist
      end
      
      it "should have a 'title' key with the title" do
        @song.to_hash.should have_key('title')
        @song.to_hash['title'].should == @song.title
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
animoto-0.0.0.alpha1 ./spec/animoto/song_spec.rb
animoto-0.0.0.alpha0 ./spec/animoto/song_spec.rb