./spec/animoto/resources/storyboard_spec.rb in animoto-1.1.1 vs ./spec/animoto/resources/storyboard_spec.rb in animoto-1.2.0

- old
+ new

@@ -1,8 +1,54 @@ require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper") describe Animoto::Resources::Storyboard do - def storyboard options = {} - @storyboard ||= Animoto::Resources::Storyboard.new options + + it "should have content type 'application/vnd.animoto.storyboard'" do + Animoto::Resources::Storyboard.content_type.should == 'storyboard' + end + + it "should have payload key 'storyboard'" do + Animoto::Resources::Storyboard.payload_key.should == 'storyboard' + end + + describe "initialization" do + before do + @body = { + 'response' => { + 'status' => { + 'code' => 200 + }, + 'payload' => { + 'storyboard' => { + 'metadata' => { + 'duration' => 300.0, + 'visuals_count' => 60 + }, + 'links' => { + 'self' => 'https://platform.animoto.com/storyboards/1', + 'preview' => 'http://storage.com/previews/1.mp4' + } + } + } + } + } + @storyboard = Animoto::Resources::Storyboard.load(@body) + end + + it "should set its url from the 'self' link given" do + @storyboard.url.should == 'https://platform.animoto.com/storyboards/1' + end + + it "should set its preview url from the 'preview' link given" do + @storyboard.preview_url.should == 'http://storage.com/previews/1.mp4' + end + + it "should set its duration from the 'duration' metadata given" do + @storyboard.duration.should == 300.0 + end + + it "should set its visuals count from the visuals_count metadata given" do + @storyboard.visuals_count.should == 60 + end end end