./spec/animoto/assets/image_spec.rb in animoto-1.5.3 vs ./spec/animoto/assets/image_spec.rb in animoto-1.5.4
- old
+ new
@@ -3,11 +3,11 @@
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
+ :rotation => 2, :spotlit => true, :cover => true, :caption => 'This is my caption'
end
it "should set the source to the given url" do
@image.source.should == 'http://website.com/image.png'
end
@@ -21,10 +21,14 @@
end
it "should set the cover to the given value" do
@image.should be_a_cover
end
+
+ it "should set the caption to the given text" do
+ @image.caption.should == 'This is my caption'
+ end
end
describe "#to_hash" do
before do
@image = Animoto::Assets::Image.new 'http://website.com/image.png'
@@ -65,7 +69,19 @@
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
+
+ describe "if caption is given" do
+ before do
+ @image.caption = "This is my caption"
+ end
+
+ it "it should have a 'caption' key with the caption value" do
+ @image.to_hash.should have_key('caption')
+ @image.to_hash['caption'].should == @image.caption
+ end
+ end
+
end
-end
\ No newline at end of file
+end