spec/utils_spec.rb in cloudinary-1.0.32 vs spec/utils_spec.rb in cloudinary-1.0.33
- old
+ new
@@ -102,10 +102,16 @@
result = Cloudinary::Utils.cloudinary_url("test", options)
options.should == {:width=>100}
result.should == "http://res.cloudinary.com/test123/image/upload/c_fill,w_200,x_100,y_100/r_10/c_crop,w_100/test"
end
+ it "should support array of tranformations" do
+ options = [{:x=>100, :y=>100, :width=>200, :crop=>:fill}, {:radius=>10}]
+ result = Cloudinary::Utils.generate_transformation_string(options)
+ result.should == "c_fill,w_200,x_100,y_100/r_10"
+ end
+
it "should not include empty tranformations" do
options = {:transformation=>[{}, {:x=>100, :y=>100, :crop=>:fill}, {}]}
result = Cloudinary::Utils.cloudinary_url("test", options)
options.should == {}
result.should == "http://res.cloudinary.com/test123/image/upload/c_fill,x_100,y_100/test"
@@ -189,10 +195,15 @@
it "should support angle" do
options = {:angle=>"55"}
result = Cloudinary::Utils.cloudinary_url("test", options)
options.should == {}
result.should == "http://res.cloudinary.com/test123/image/upload/a_55/test"
+
+ options = {:angle=>["auto", "55"]}
+ result = Cloudinary::Utils.cloudinary_url("test", options)
+ options.should == {}
+ result.should == "http://res.cloudinary.com/test123/image/upload/a_auto.55/test"
end
it "should support format for fetch urls" do
options = {:format=>"jpg", :type=>:fetch}
result = Cloudinary::Utils.cloudinary_url("http://cloudinary.com/images/logo.png", options)
@@ -271,6 +282,14 @@
options = {:cname=>"hello.com", :cdn_subdomain=>true}
result = Cloudinary::Utils.cloudinary_url("test", options)
options.should == {}
result.should == "http://a2.hello.com/test123/image/upload/test"
end
+
+ it "should support string param" do
+ options = {"effect"=>{"sepia"=>10}}
+ result = Cloudinary::Utils.cloudinary_url("test", options)
+ options.should == {}
+ result.should == "http://res.cloudinary.com/test123/image/upload/e_sepia:10/test"
+ end
+
end