spec/utils_spec.rb in cloudinary-1.1.6 vs spec/utils_spec.rb in cloudinary-1.1.7

- old
+ new

@@ -347,10 +347,22 @@ expect(["test", { :effect => ["sepia", 10] }]) .to produce_url("#{upload_path}/e_sepia:10/test") .and empty_options end + it "should support keyframe_interval" do + expect(["test", { :keyframe_interval => 10 }]) + .to produce_url("#{upload_path}/ki_10/test") + .and empty_options + end + + it "should support streaming_profile" do + expect(["test", { :streaming_profile => "some-profile" }]) + .to produce_url("#{upload_path}/sp_some-profile/test") + .and empty_options + end + shared_examples "a signed url" do |specific_options = {}, specific_transformation = ""| let(:expected_transformation) do (specific_transformation.blank? || specific_transformation.match(/\/$/)) ? specific_transformation : "#{specific_transformation}/" end let! (:authenticated_image) do @@ -359,27 +371,20 @@ :tags => TEST_TAG end let(:options) { { :version => authenticated_image['version'], :sign_url => true, :type => :authenticated }.merge(specific_options) } let(:authenticated_path) { "#{root_path}/image/authenticated" } - it "should not serve resource with the wrong signature" do - expect(authenticated_image["url"].sub(/(?:s--)([\w-]+)(?:--)/) { |s| s.succ }) - .not_to be_served_by_cloudinary - end - it "should correctly sign URL with version" do expect(["#{authenticated_image['public_id']}.jpg", options]) .to produce_url(%r"#{authenticated_path}/s--[\w-]+--/#{expected_transformation}v#{authenticated_image['version']}/#{authenticated_image['public_id']}.jpg") .and empty_options - .and be_served_by_cloudinary end it "should correctly sign URL with transformation and version" do options[:transformation] = { :crop => "crop", :width => 10, :height => 20 } expect(["#{authenticated_image['public_id']}.jpg", options]) .to produce_url(%r"#{authenticated_path}/s--[\w-]+--/c_crop,h_20,w_10/#{expected_transformation}v#{authenticated_image['version']}/#{authenticated_image['public_id']}.jpg") .and empty_options - .and be_served_by_cloudinary end it "should correctly sign URL with transformation" do options[:transformation] = { :crop => "crop", :width => 10, :height => 20 } expect(["#{authenticated_image['public_id']}.jpg", options]) .to produce_url(%r"#{authenticated_path}/s--[\w-]+--/c_crop,h_20,w_10/#{expected_transformation}v#{authenticated_image['version']}/#{authenticated_image['public_id']}.jpg") @@ -389,11 +394,10 @@ it "should correctly sign fetch URL" do options[:type] = :fetch expect(["http://res.cloudinary.com/demo/sample.png", options]) .to produce_url(%r"^#{root_path}/image/fetch/s--[\w-]+--/#{expected_transformation}v#{authenticated_image['version']}/http://res.cloudinary.com/demo/sample.png$") .and empty_options - .and be_served_by_cloudinary end end { 'overlay' => :l, :underlay => :u }.each do |param, letter| @@ -447,11 +451,11 @@ srt.unlink end include_context "cleanup" - { 'overlay' => 'l', 'underlay' => 'u' }.each do |param, short| + { 'overlay' => 'l' }.each do |param, short| # 'underlay' => 'u' behaves the same as overlay describe param do let(:root_path) { "http://res.cloudinary.com/#{cloud_name}" } # [name, options, result] layers_options= [ ["string", "text:test_text:hello", "text:test_text:hello"], @@ -463,12 +467,12 @@ ["subtitles with font family and size", { :resource_type => "subtitles", :public_id => "subtitles.srt", :font_family => "Arial", :font_size => "40" }, "subtitles:Arial_40:subtitles.srt"] ] layers_options.each do |name, options, result| it "should support #{name}" do expect(["sample.jpg", { param => options }]).to produce_url("#{upload_path}/#{short}_#{result}/sample.jpg").and empty_options - expect("#{upload_path}/#{short}_#{result}/sample.jpg").to be_served_by_cloudinary + # expect("#{upload_path}/#{short}_#{result}/sample.jpg").to be_served_by_cloudinary end - unless options.is_a? String + unless options.is_a? String || param == 'underlay' op = Hash.new op[param] = options it_behaves_like "a signed url", op, "#{short}_#{result}" end end