cloudinary 1.13.0 → 1.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/cloudinary.gemspec +1 -2
- data/lib/active_storage/service/cloudinary_service.rb +0 -1
- data/lib/cloudinary/utils.rb +1 -1
- data/lib/cloudinary/version.rb +1 -1
- metadata +3 -185
- data/spec/access_control_spec.rb +0 -102
- data/spec/active_storage/Gemfile +0 -12
- data/spec/active_storage/application_system_test_case.rb +0 -5
- data/spec/active_storage/database/create_users_migration.rb +0 -9
- data/spec/active_storage/database/setup.rb +0 -7
- data/spec/active_storage/dummy/Rakefile +0 -5
- data/spec/active_storage/dummy/app/assets/config/manifest.js +0 -3
- data/spec/active_storage/dummy/app/assets/javascripts/application.js +0 -13
- data/spec/active_storage/dummy/app/assets/stylesheets/application.css +0 -15
- data/spec/active_storage/dummy/app/controllers/application_controller.rb +0 -5
- data/spec/active_storage/dummy/app/helpers/application_helper.rb +0 -4
- data/spec/active_storage/dummy/app/jobs/application_job.rb +0 -4
- data/spec/active_storage/dummy/app/models/application_record.rb +0 -5
- data/spec/active_storage/dummy/app/views/layouts/application.html.erb +0 -14
- data/spec/active_storage/dummy/bin/bundle +0 -5
- data/spec/active_storage/dummy/bin/rails +0 -6
- data/spec/active_storage/dummy/bin/rake +0 -6
- data/spec/active_storage/dummy/bin/yarn +0 -11
- data/spec/active_storage/dummy/config.ru +0 -7
- data/spec/active_storage/dummy/config/application.rb +0 -22
- data/spec/active_storage/dummy/config/boot.rb +0 -7
- data/spec/active_storage/dummy/config/database.yml +0 -25
- data/spec/active_storage/dummy/config/environment.rb +0 -7
- data/spec/active_storage/dummy/config/environments/development.rb +0 -52
- data/spec/active_storage/dummy/config/environments/production.rb +0 -83
- data/spec/active_storage/dummy/config/environments/test.rb +0 -38
- data/spec/active_storage/dummy/config/initializers/application_controller_renderer.rb +0 -7
- data/spec/active_storage/dummy/config/initializers/assets.rb +0 -16
- data/spec/active_storage/dummy/config/initializers/backtrace_silencers.rb +0 -8
- data/spec/active_storage/dummy/config/initializers/cookies_serializer.rb +0 -7
- data/spec/active_storage/dummy/config/initializers/filter_parameter_logging.rb +0 -6
- data/spec/active_storage/dummy/config/initializers/inflections.rb +0 -17
- data/spec/active_storage/dummy/config/initializers/mime_types.rb +0 -5
- data/spec/active_storage/dummy/config/initializers/wrap_parameters.rb +0 -16
- data/spec/active_storage/dummy/config/routes.rb +0 -4
- data/spec/active_storage/dummy/config/secrets.yml +0 -32
- data/spec/active_storage/dummy/config/spring.rb +0 -8
- data/spec/active_storage/dummy/config/storage.yml +0 -3
- data/spec/active_storage/dummy/config/webpacker.yml +0 -72
- data/spec/active_storage/dummy/package.json +0 -5
- data/spec/active_storage/dummy/public/404.html +0 -67
- data/spec/active_storage/dummy/public/422.html +0 -67
- data/spec/active_storage/dummy/public/500.html +0 -66
- data/spec/active_storage/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/active_storage/dummy/public/apple-touch-icon.png +0 -0
- data/spec/active_storage/dummy/public/favicon.ico +0 -0
- data/spec/active_storage/fixtures/files/colors.bmp +0 -0
- data/spec/active_storage/fixtures/files/empty_file.txt +0 -0
- data/spec/active_storage/fixtures/files/favicon.ico +0 -0
- data/spec/active_storage/fixtures/files/icon.psd +0 -0
- data/spec/active_storage/fixtures/files/icon.svg +0 -13
- data/spec/active_storage/fixtures/files/image.gif +0 -0
- data/spec/active_storage/fixtures/files/racecar.jpg +0 -0
- data/spec/active_storage/fixtures/files/racecar.tif +0 -0
- data/spec/active_storage/fixtures/files/racecar_rotated.jpg +0 -0
- data/spec/active_storage/fixtures/files/report.pdf +0 -0
- data/spec/active_storage/fixtures/files/rotated_video.mp4 +0 -0
- data/spec/active_storage/fixtures/files/video.mp4 +0 -0
- data/spec/active_storage/fixtures/files/video_with_rectangular_samples.mp4 +0 -0
- data/spec/active_storage/fixtures/files/video_with_undefined_display_aspect_ratio.mp4 +0 -0
- data/spec/active_storage/fixtures/files/video_without_video_stream.mp4 +0 -0
- data/spec/active_storage/service/cloudinary_service_spec.rb +0 -107
- data/spec/active_storage/service/configurations.yml +0 -4
- data/spec/active_storage/test_helper.rb +0 -43
- data/spec/api_spec.rb +0 -623
- data/spec/archive_spec.rb +0 -145
- data/spec/auth_token_spec.rb +0 -77
- data/spec/cache_spec.rb +0 -109
- data/spec/cloudinary_helper_spec.rb +0 -327
- data/spec/cloudinary_spec.rb +0 -56
- data/spec/data/sync_static/app/assets/javascripts/1.coffee +0 -1
- data/spec/data/sync_static/app/assets/javascripts/1.js +0 -1
- data/spec/data/sync_static/app/assets/stylesheets/1.css +0 -3
- data/spec/docx.docx +0 -0
- data/spec/favicon.ico +0 -0
- data/spec/image_spec.rb +0 -107
- data/spec/logo.png +0 -0
- data/spec/movie.mp4 +0 -0
- data/spec/rake_spec.rb +0 -160
- data/spec/sample_asset_file.tsv +0 -4
- data/spec/search_spec.rb +0 -109
- data/spec/spec_helper.rb +0 -273
- data/spec/storage_spec.rb +0 -44
- data/spec/streaminig_profiles_api_spec.rb +0 -74
- data/spec/support/helpers/temp_file_helpers.rb +0 -22
- data/spec/support/shared_contexts/rake.rb +0 -19
- data/spec/uploader_spec.rb +0 -409
- data/spec/utils_methods_spec.rb +0 -81
- data/spec/utils_spec.rb +0 -1052
- data/spec/video_tag_spec.rb +0 -253
- data/spec/video_url_spec.rb +0 -185
data/spec/utils_methods_spec.rb
DELETED
@@ -1,81 +0,0 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require 'spec_helper'
|
3
|
-
require 'cloudinary'
|
4
|
-
include Cloudinary
|
5
|
-
|
6
|
-
describe Utils do
|
7
|
-
|
8
|
-
it 'should parse integer range values' do
|
9
|
-
expect(Utils.instance_eval { norm_range_value("200") }).to eq("200")
|
10
|
-
end
|
11
|
-
it "should parse float range values" do
|
12
|
-
expect(Utils.instance_eval { norm_range_value("200.0") }).to eq("200.0"), "parse a float"
|
13
|
-
end
|
14
|
-
it "should parse a percent range value" do
|
15
|
-
expect(Utils.instance_eval { norm_range_value("20p") }).to eq("20p")
|
16
|
-
end
|
17
|
-
describe "json_array_param" do
|
18
|
-
let (:data) {{:one => 1, :two => 2, "three" => 3}}
|
19
|
-
let (:data_s) {"{\"one\":1,\"two\":2,\"three\":3}"}
|
20
|
-
let (:data2) {{:foo => "bar"}}
|
21
|
-
let (:data2_s) {"{\"foo\":\"bar\"}"}
|
22
|
-
it "should convert a hash to json array" do
|
23
|
-
result = Utils.json_array_param(data)
|
24
|
-
expect(result).to match(/^\[.+\]$/)
|
25
|
-
end
|
26
|
-
it "should convert an array of hash to json array" do
|
27
|
-
result = Utils.json_array_param([data, data2])
|
28
|
-
expect(result).to eql("[#{data_s},#{data2_s}]")
|
29
|
-
end
|
30
|
-
it "should convert a json string to json array string" do
|
31
|
-
result = Utils.json_array_param(data_s)
|
32
|
-
expect(result).to eql("[#{data_s}]")
|
33
|
-
end
|
34
|
-
it "should accept a JSON array string and return it" do
|
35
|
-
result = Utils.json_array_param("[#{data_s},#{data2_s}]")
|
36
|
-
expect(result).to eql("[#{data_s},#{data2_s}]")
|
37
|
-
end
|
38
|
-
it "should throw an error if input string is not valid json string" do
|
39
|
-
expect{Utils.json_array_param("I'm not a JSON object!")}.to raise_error(JSON::ParserError)
|
40
|
-
end
|
41
|
-
it "should support a block" do
|
42
|
-
hash = {:block => "works"}
|
43
|
-
hash_s = '{"block":"works"}'
|
44
|
-
result = Utils.json_array_param(data) do |array|
|
45
|
-
array[0]['foo'] = 'foobar'
|
46
|
-
array.push(hash)
|
47
|
-
|
48
|
-
end
|
49
|
-
expect(result).to include(hash_s)
|
50
|
-
expect(result).to include('foobar')
|
51
|
-
end
|
52
|
-
end
|
53
|
-
describe 'is_remote_url' do
|
54
|
-
it 'should identify remote URLs correctly' do
|
55
|
-
[
|
56
|
-
"ftp://ftp.cloudinary.com/images/old_logo.png",
|
57
|
-
"http://cloudinary.com/images/old_logo.png",
|
58
|
-
"https://cloudinary.com/images/old_logo.png",
|
59
|
-
"s3://s3-us-west-2.amazonaws.com/cloudinary/images/old_logo.png",
|
60
|
-
"gs://cloudinary/images/old_logo.png",
|
61
|
-
"data:image/gif;charset=utf8;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
|
62
|
-
"data:image/gif;param1=value1;param2=value2;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
|
63
|
-
].each do |url|
|
64
|
-
expect(Cloudinary::Utils.is_remote?(url)).to eq(true), url
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
describe "resource_type per format" do
|
69
|
-
it "should return the correct resource_type per format" do
|
70
|
-
format_to_resource_type = {
|
71
|
-
"jpg" => "image",
|
72
|
-
"mp4" => "video",
|
73
|
-
"txt" => "raw",
|
74
|
-
"mp3" => "video",
|
75
|
-
}
|
76
|
-
format_to_resource_type.each do |format, resource_type|
|
77
|
-
expect(Cloudinary::Utils.resource_type_for_format(format)).to eq(resource_type)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
data/spec/utils_spec.rb
DELETED
@@ -1,1052 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'cloudinary'
|
3
|
-
|
4
|
-
describe Cloudinary::Utils do
|
5
|
-
|
6
|
-
|
7
|
-
before :each do
|
8
|
-
Cloudinary.reset_config
|
9
|
-
Cloudinary.config do |config|
|
10
|
-
# config.cloud_name = "demo"
|
11
|
-
config.secure_distribution = nil
|
12
|
-
config.private_cdn = false
|
13
|
-
config.secure = false
|
14
|
-
config.cname = nil
|
15
|
-
config.cdn_subdomain = false
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
let(:cloud_name) { Cloudinary.config.cloud_name }
|
20
|
-
let(:root_path) { "http://res.cloudinary.com/#{cloud_name}" }
|
21
|
-
let(:upload_path) { "#{root_path}/image/upload" }
|
22
|
-
|
23
|
-
it "should allow overriding cloud_name in options" do
|
24
|
-
expect(["test", { :cloud_name => "test321" }])
|
25
|
-
.to produce_url("http://res.cloudinary.com/test321/image/upload/test")
|
26
|
-
.and empty_options
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should use default secure distribution if secure=true" do
|
30
|
-
expect(["test", { :secure => true }])
|
31
|
-
.to produce_url("https://res.cloudinary.com/#{cloud_name}/image/upload/test")
|
32
|
-
.and empty_options
|
33
|
-
end
|
34
|
-
|
35
|
-
it "should allow overriding secure distribution if secure=true" do
|
36
|
-
expect(["test", { :secure => true, :secure_distribution => "something.else.com" }])
|
37
|
-
.to produce_url("https://something.else.com/#{cloud_name}/image/upload/test")
|
38
|
-
.and empty_options
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should take secure distribution from config if secure=true" do
|
42
|
-
Cloudinary.config.secure_distribution = "config.secure.distribution.com"
|
43
|
-
expect(["test", { :secure => true }])
|
44
|
-
.to produce_url("https://config.secure.distribution.com/#{cloud_name}/image/upload/test")
|
45
|
-
.and empty_options
|
46
|
-
end
|
47
|
-
|
48
|
-
it "should default to akamai if secure is given with private_cdn and no secure_distribution" do
|
49
|
-
expect(["test", { :secure => true, :private_cdn => true }])
|
50
|
-
.to produce_url("https://#{cloud_name}-res.cloudinary.com/image/upload/test")
|
51
|
-
.and empty_options
|
52
|
-
end
|
53
|
-
|
54
|
-
it "should not add cloud_name if secure private_cdn and secure non akamai secure_distribution" do
|
55
|
-
expect(["test", { :secure => true, :private_cdn => true, :secure_distribution => "something.cloudfront.net" }])
|
56
|
-
.to produce_url("https://something.cloudfront.net/image/upload/test")
|
57
|
-
.and empty_options
|
58
|
-
end
|
59
|
-
|
60
|
-
it "should allow overriding private_cdn if private_cdn=true" do
|
61
|
-
expect(["test", { :private_cdn => true }])
|
62
|
-
.to produce_url("http://#{cloud_name}-res.cloudinary.com/image/upload/test")
|
63
|
-
.and empty_options
|
64
|
-
end
|
65
|
-
|
66
|
-
it "should allow overriding private_cdn if private_cdn=false" do
|
67
|
-
Cloudinary.config.private_cdn = true
|
68
|
-
expect(["test", { :private_cdn => false }])
|
69
|
-
.to produce_url("#{upload_path}/test")
|
70
|
-
.and empty_options
|
71
|
-
end
|
72
|
-
|
73
|
-
it "should allow overriding cname if cname=example.com" do
|
74
|
-
expect(["test", { :cname => "example.com" }])
|
75
|
-
.to produce_url("http://example.com/#{cloud_name}/image/upload/test")
|
76
|
-
.and empty_options
|
77
|
-
end
|
78
|
-
|
79
|
-
it "should allow overriding cname if cname=false" do
|
80
|
-
Cloudinary.config.cname = "example.com"
|
81
|
-
expect(["test", { :cname => false }])
|
82
|
-
.to produce_url("#{upload_path}/test")
|
83
|
-
.and empty_options
|
84
|
-
end
|
85
|
-
|
86
|
-
it "should use format from options" do
|
87
|
-
expect(["test", { :format => :jpg }])
|
88
|
-
.to produce_url("#{upload_path}/test.jpg")
|
89
|
-
.and empty_options
|
90
|
-
end
|
91
|
-
|
92
|
-
it "should support url_suffix in shared distribution" do
|
93
|
-
expect(["test", { :url_suffix => "hello" }])
|
94
|
-
.to produce_url("http://res.cloudinary.com/#{cloud_name}/images/test/hello")
|
95
|
-
.and empty_options
|
96
|
-
expect(["test", { :url_suffix => "hello", :angle => 0 }])
|
97
|
-
.to produce_url("http://res.cloudinary.com/#{cloud_name}/images/a_0/test/hello")
|
98
|
-
.and empty_options
|
99
|
-
end
|
100
|
-
|
101
|
-
it "should disallow url_suffix in non upload types" do
|
102
|
-
expect { Cloudinary::Utils.cloudinary_url("test", { :url_suffix => "hello", :private_cdn => true, :type => :facebook }) }.to raise_error(CloudinaryException)
|
103
|
-
end
|
104
|
-
|
105
|
-
it "should disallow url_suffix with / or ." do
|
106
|
-
expect { Cloudinary::Utils.cloudinary_url("test", { :url_suffix => "hello/world", :private_cdn => true }) }.to raise_error(CloudinaryException)
|
107
|
-
expect { Cloudinary::Utils.cloudinary_url("test", { :url_suffix => "hello.world", :private_cdn => true }) }.to raise_error(CloudinaryException)
|
108
|
-
end
|
109
|
-
|
110
|
-
it "should support url_suffix for private_cdn" do
|
111
|
-
expect(["test", { :url_suffix => "hello", :private_cdn => true }])
|
112
|
-
.to produce_url("http://#{cloud_name}-res.cloudinary.com/images/test/hello")
|
113
|
-
.and empty_options
|
114
|
-
expect(["test", { :url_suffix => "hello", :angle => 0, :private_cdn => true }])
|
115
|
-
.to produce_url("http://#{cloud_name}-res.cloudinary.com/images/a_0/test/hello")
|
116
|
-
.and empty_options
|
117
|
-
end
|
118
|
-
|
119
|
-
it "should put format after url_suffix" do
|
120
|
-
expect(["test", { :url_suffix => "hello", :private_cdn => true, :format => "jpg" }])
|
121
|
-
.to produce_url("http://#{cloud_name}-res.cloudinary.com/images/test/hello.jpg")
|
122
|
-
.and empty_options
|
123
|
-
end
|
124
|
-
|
125
|
-
it "should sign a url" do
|
126
|
-
expected = Cloudinary::Utils.cloudinary_url "some_public_id.jpg",
|
127
|
-
:cloud_name => "test",
|
128
|
-
:api_key => "123456789012345",
|
129
|
-
:api_secret => "AbcdEfghIjklmnopq1234567890",
|
130
|
-
:type => "authenticated",
|
131
|
-
:sign_url => true,
|
132
|
-
:overlay => "text:Helvetica_50:test+text"
|
133
|
-
expect(expected).to eq("http://res.cloudinary.com/test/image/authenticated/s--j5Z1ILxd--/l_text:Helvetica_50:test+text/some_public_id.jpg")
|
134
|
-
end
|
135
|
-
|
136
|
-
it "should not sign the url_suffix" do
|
137
|
-
expected_signture = Cloudinary::Utils.cloudinary_url("test", :format => "jpg", :sign_url => true).match(/s--[0-9A-Za-z_-]{8}--/).to_s
|
138
|
-
expect(["test", { :url_suffix => "hello", :private_cdn => true, :format => "jpg", :sign_url => true }])
|
139
|
-
.to produce_url("http://#{cloud_name}-res.cloudinary.com/images/#{expected_signture}/test/hello.jpg")
|
140
|
-
.and empty_options
|
141
|
-
|
142
|
-
expected_signture = Cloudinary::Utils.cloudinary_url("test", :format => "jpg", :angle => 0, :sign_url => true).match(/s--[0-9A-Za-z_-]{8}--/).to_s
|
143
|
-
expect(["test", { :url_suffix => "hello", :private_cdn => true, :format => "jpg", :angle => 0, :sign_url => true }])
|
144
|
-
.to produce_url("http://#{cloud_name}-res.cloudinary.com/images/#{expected_signture}/a_0/test/hello.jpg")
|
145
|
-
.and empty_options
|
146
|
-
end
|
147
|
-
|
148
|
-
it "should support url_suffix for raw uploads" do
|
149
|
-
expect(["test", { :url_suffix => "hello", :private_cdn => true, :resource_type => :raw }])
|
150
|
-
.to produce_url("http://#{cloud_name}-res.cloudinary.com/files/test/hello")
|
151
|
-
.and empty_options
|
152
|
-
end
|
153
|
-
|
154
|
-
it "should support url_suffix for videos" do
|
155
|
-
expect(["test", { :url_suffix => "hello", :private_cdn => true, :resource_type => :video }])
|
156
|
-
.to produce_url("http://#{cloud_name}-res.cloudinary.com/videos/test/hello")
|
157
|
-
.and empty_options
|
158
|
-
end
|
159
|
-
|
160
|
-
it "should support url_suffix for private images" do
|
161
|
-
expect(["test", { :url_suffix => "hello", :private_cdn => true, :resource_type => :image, :type => :private }])
|
162
|
-
.to produce_url("http://#{cloud_name}-res.cloudinary.com/private_images/test/hello")
|
163
|
-
.and empty_options
|
164
|
-
expect(["test", { :url_suffix => "hello", :private_cdn => true, :format => "jpg", :resource_type => :image, :type => :private }])
|
165
|
-
.to produce_url("http://#{cloud_name}-res.cloudinary.com/private_images/test/hello.jpg")
|
166
|
-
.and empty_options
|
167
|
-
end
|
168
|
-
|
169
|
-
it "should support url_suffix for authenticated images" do
|
170
|
-
expect(["test", { :url_suffix => "hello", :format => "jpg", :resource_type => :image, :type => :authenticated }])
|
171
|
-
.to produce_url("http://res.cloudinary.com/#{cloud_name}/authenticated_images/test/hello.jpg")
|
172
|
-
.and empty_options
|
173
|
-
end
|
174
|
-
|
175
|
-
|
176
|
-
describe 'root_path support' do
|
177
|
-
|
178
|
-
it "should allow use_root_path in shared distribution" do
|
179
|
-
# expect{Cloudinary::Utils.cloudinary_url("test", {:use_root_path=>true})}.to raise_error(CloudinaryException)
|
180
|
-
expect(["test", { :use_root_path => true, :private_cdn => false }])
|
181
|
-
.to produce_url("#{root_path}/test")
|
182
|
-
.and empty_options
|
183
|
-
expect(["test", { :use_root_path => true, :private_cdn => false, :angle => 0 }])
|
184
|
-
.to produce_url("#{root_path}/a_0/test")
|
185
|
-
.and empty_options
|
186
|
-
end
|
187
|
-
|
188
|
-
it "should support use_root_path for private_cdn" do
|
189
|
-
expect(["test", { :use_root_path => true, :private_cdn => true }])
|
190
|
-
.to produce_url("http://#{cloud_name}-res.cloudinary.com/test")
|
191
|
-
.and empty_options
|
192
|
-
expect(["test", { :use_root_path => true, :private_cdn => true, :angle => 0 }])
|
193
|
-
.to produce_url("http://#{cloud_name}-res.cloudinary.com/a_0/test")
|
194
|
-
.and empty_options
|
195
|
-
end
|
196
|
-
|
197
|
-
it "should support use_root_path together with url_suffix for private_cdn" do
|
198
|
-
expect(["test", { :use_root_path => true, :url_suffix => "hello", :private_cdn => true }])
|
199
|
-
.to produce_url("http://#{cloud_name}-res.cloudinary.com/test/hello")
|
200
|
-
.and empty_options
|
201
|
-
end
|
202
|
-
|
203
|
-
it "should disallow use_root_path if not image/upload" do
|
204
|
-
expect { Cloudinary::Utils.cloudinary_url("test", { :use_root_path => true, :private_cdn => true, :type => :facebook }) }.to raise_error(CloudinaryException)
|
205
|
-
expect { Cloudinary::Utils.cloudinary_url("test", { :use_root_path => true, :private_cdn => true, :resource_type => :raw }) }.to raise_error(CloudinaryException)
|
206
|
-
end
|
207
|
-
|
208
|
-
end
|
209
|
-
describe ":width, :height" do
|
210
|
-
it "should use width and height from options only if crop is given" do
|
211
|
-
expect(["test", { :width => 100, :height => 100 }])
|
212
|
-
.to produce_url("#{upload_path}/test")
|
213
|
-
.and mutate_options_to({ :width => 100, :height => 100 })
|
214
|
-
expect(["test", { :width => 100, :height => 100, :crop => :crop }])
|
215
|
-
.to produce_url("#{upload_path}/c_crop,h_100,w_100/test")
|
216
|
-
.and mutate_options_to({ :width => 100, :height => 100 })
|
217
|
-
end
|
218
|
-
|
219
|
-
it "should not pass width and height to html in case of fit, lfill or limit crop" do
|
220
|
-
expect(["test", { :width => 100, :height => 100, :crop => :limit }])
|
221
|
-
.to produce_url("#{upload_path}/c_limit,h_100,w_100/test")
|
222
|
-
.and empty_options
|
223
|
-
expect(["test", { :width => 100, :height => 100, :crop => :lfill }])
|
224
|
-
.to produce_url("#{upload_path}/c_lfill,h_100,w_100/test")
|
225
|
-
.and empty_options
|
226
|
-
expect(["test", { :width => 100, :height => 100, :crop => :fit }])
|
227
|
-
.to produce_url("#{upload_path}/c_fit,h_100,w_100/test")
|
228
|
-
.and empty_options
|
229
|
-
end
|
230
|
-
|
231
|
-
it "should not pass width and height to html in case angle was used" do
|
232
|
-
expect(["test", { :width => 100, :height => 100, :crop => :scale, :angle => :auto }])
|
233
|
-
.to produce_url("#{upload_path}/a_auto,c_scale,h_100,w_100/test")
|
234
|
-
.and empty_options
|
235
|
-
end
|
236
|
-
it "should support size" do
|
237
|
-
expect(["test", { :size => "10x10", :crop => :crop }])
|
238
|
-
.to produce_url("#{upload_path}/c_crop,h_10,w_10/test")
|
239
|
-
.and mutate_options_to({ :width => "10", :height => "10" })
|
240
|
-
end
|
241
|
-
it "should support auto width" do
|
242
|
-
expect(["test", { :width => "auto:20", :crop => :fill }])
|
243
|
-
.to produce_url("#{upload_path}/c_fill,w_auto:20/test")
|
244
|
-
expect(["test", { :width => "auto:20:350", :crop => :fill }])
|
245
|
-
.to produce_url("#{upload_path}/c_fill,w_auto:20:350/test")
|
246
|
-
expect(["test", { :width => "auto:breakpoints", :crop => :fill }])
|
247
|
-
.to produce_url("#{upload_path}/c_fill,w_auto:breakpoints/test")
|
248
|
-
expect(["test", { :width => "auto:breakpoints_100_1900_20_15", :crop => :fill }])
|
249
|
-
.to produce_url("#{upload_path}/c_fill,w_auto:breakpoints_100_1900_20_15/test")
|
250
|
-
expect(["test", { :width => "auto:breakpoints:json", :crop => :fill }])
|
251
|
-
.to produce_url("#{upload_path}/c_fill,w_auto:breakpoints:json/test")
|
252
|
-
end
|
253
|
-
it 'should support ih,iw' do
|
254
|
-
expect(["test", {:width => "iw", :height => "ih", :crop => :crop}])
|
255
|
-
.to produce_url("#{upload_path}/c_crop,h_ih,w_iw/test")
|
256
|
-
end
|
257
|
-
end
|
258
|
-
|
259
|
-
it "should use x, y, radius, prefix, gravity and quality from options" do
|
260
|
-
expect(["test", { :x => 1, :y => 2, :radius => 3, :gravity => :center, :quality => 0.4, :prefix => "a" }])
|
261
|
-
.to produce_url("#{upload_path}/g_center,p_a,q_0.4,r_3,x_1,y_2/test")
|
262
|
-
.and empty_options
|
263
|
-
|
264
|
-
expect(["test", { :width => 0.5, :crop => :crop, :gravity => :auto }])
|
265
|
-
.to produce_url("#{upload_path}/c_crop,g_auto,w_0.5/test")
|
266
|
-
.and empty_options
|
267
|
-
end
|
268
|
-
|
269
|
-
describe "gravity" do
|
270
|
-
it "should support auto" do
|
271
|
-
expect(["test", {width: 100, height: 100, crop: 'crop', gravity: 'auto'}])
|
272
|
-
.to produce_url("http://res.cloudinary.com/#{cloud_name}/image/upload/c_crop,g_auto,h_100,w_100/test")
|
273
|
-
.and mutate_options_to({width: 100, height: 100})
|
274
|
-
expect(["test", {width: 100, height: 100, crop: 'crop', gravity: 'auto'}])
|
275
|
-
.to produce_url("http://res.cloudinary.com/#{cloud_name}/image/upload/c_crop,g_auto,h_100,w_100/test")
|
276
|
-
.and mutate_options_to({width: 100, height: 100})
|
277
|
-
end
|
278
|
-
it "should support focal gravity" do
|
279
|
-
["adv_face", "adv_faces", "adv_eyes", "face", "faces", "body", "no_faces"].each do |focal|
|
280
|
-
expect(["test", {width: 100, height: 100, crop: 'crop', gravity: "auto:#{focal}"}])
|
281
|
-
.to produce_url("http://res.cloudinary.com/#{cloud_name}/image/upload/c_crop,g_auto:#{focal},h_100,w_100/test")
|
282
|
-
.and mutate_options_to({width: 100, height: 100})
|
283
|
-
end
|
284
|
-
end
|
285
|
-
it "should support auto level with thumb cropping" do
|
286
|
-
[0, 10, 100].each do |level|
|
287
|
-
expect(["test", {width: 100, height: 100, crop: 'thumb', gravity: "auto:#{level}"}])
|
288
|
-
.to produce_url("http://res.cloudinary.com/#{cloud_name}/image/upload/c_thumb,g_auto:#{level},h_100,w_100/test")
|
289
|
-
.and mutate_options_to({width: 100, height: 100})
|
290
|
-
expect(["test", {width: 100, height: 100, crop: 'thumb', gravity: "auto:adv_faces:#{level}"}])
|
291
|
-
.to produce_url("http://res.cloudinary.com/#{cloud_name}/image/upload/c_thumb,g_auto:adv_faces:#{level},h_100,w_100/test")
|
292
|
-
.and mutate_options_to({width: 100, height: 100})
|
293
|
-
end
|
294
|
-
end
|
295
|
-
it "should support custom_no_override" do
|
296
|
-
expect(["test", {width: 100, height: 100, crop: 'crop', gravity: "auto:custom_no_override"}])
|
297
|
-
.to produce_url("http://res.cloudinary.com/#{cloud_name}/image/upload/c_crop,g_auto:custom_no_override,h_100,w_100/test")
|
298
|
-
.and mutate_options_to({width: 100, height: 100})
|
299
|
-
end
|
300
|
-
end
|
301
|
-
|
302
|
-
describe ":quality" do
|
303
|
-
it "support a percent value" do
|
304
|
-
expect(["test", { :x => 1, :y => 2, :radius => 3, :gravity => :center, :quality => 80, :prefix => "a" }])
|
305
|
-
.to produce_url("#{upload_path}/g_center,p_a,q_80,r_3,x_1,y_2/test")
|
306
|
-
|
307
|
-
expect(["test", { :x => 1, :y => 2, :radius => 3, :gravity => :center, :quality => "80:444", :prefix => "a" }])
|
308
|
-
.to produce_url("#{upload_path}/g_center,p_a,q_80:444,r_3,x_1,y_2/test")
|
309
|
-
end
|
310
|
-
it "should support auto value" do
|
311
|
-
|
312
|
-
expect(["test", { :x => 1, :y => 2, :radius => 3, :gravity => :center, :quality => "auto", :prefix => "a" }])
|
313
|
-
.to produce_url("#{upload_path}/g_center,p_a,q_auto,r_3,x_1,y_2/test")
|
314
|
-
|
315
|
-
expect(["test", { :x => 1, :y => 2, :radius => 3, :gravity => :center, :quality => "auto:good", :prefix => "a" }])
|
316
|
-
.to produce_url("#{upload_path}/g_center,p_a,q_auto:good,r_3,x_1,y_2/test")
|
317
|
-
|
318
|
-
end
|
319
|
-
end
|
320
|
-
|
321
|
-
describe ":transformation" do
|
322
|
-
it "should support named transformation" do
|
323
|
-
expect(["test", { :transformation => "blip" }])
|
324
|
-
.to produce_url("#{upload_path}/t_blip/test")
|
325
|
-
.and empty_options
|
326
|
-
end
|
327
|
-
|
328
|
-
it "should support array of named transformation" do
|
329
|
-
expect(["test", { :transformation => ["blip", "blop"] }])
|
330
|
-
.to produce_url("#{upload_path}/t_blip.blop/test")
|
331
|
-
.and empty_options
|
332
|
-
end
|
333
|
-
|
334
|
-
it "should support base transformation" do
|
335
|
-
expect(["test", { :transformation => { :x => 100, :y => 100, :crop => :fill }, :crop => :crop, :width => 100 }])
|
336
|
-
.to produce_url("#{upload_path}/c_fill,x_100,y_100/c_crop,w_100/test")
|
337
|
-
.and mutate_options_to({ :width => 100 })
|
338
|
-
end
|
339
|
-
|
340
|
-
it "should support array of base transformation" do
|
341
|
-
expect(["test", { :transformation => [{ :x => 100, :y => 100, :width => 200, :crop => :fill }, { :radius => 10 }], :crop => :crop, :width => 100 }])
|
342
|
-
.to produce_url("#{upload_path}/c_fill,w_200,x_100,y_100/r_10/c_crop,w_100/test")
|
343
|
-
.and mutate_options_to({ :width => 100 })
|
344
|
-
end
|
345
|
-
|
346
|
-
it "should support array of transformation" do
|
347
|
-
result = Cloudinary::Utils.generate_transformation_string([{ :x => 100, :y => 100, :width => 200, :crop => :fill }, { :radius => 10 }])
|
348
|
-
expect(result).to eq("c_fill,w_200,x_100,y_100/r_10")
|
349
|
-
end
|
350
|
-
|
351
|
-
it "should not include empty transformation" do
|
352
|
-
expect(["test", { :transformation => [{}, { :x => 100, :y => 100, :crop => :fill }, {}] }])
|
353
|
-
.to produce_url("#{upload_path}/c_fill,x_100,y_100/test")
|
354
|
-
.and empty_options
|
355
|
-
end
|
356
|
-
|
357
|
-
describe "should support and translate arithmetic operators" do
|
358
|
-
it "should support * / + - ^" do
|
359
|
-
t = [{:width => 'initial_width * 2 / 3 ^ 2', :height => 'initial_height + 2 - 3', :crop => 'scale'}]
|
360
|
-
expected_trans = "c_scale,h_ih_add_2_sub_3,w_iw_mul_2_div_3_pow_2"
|
361
|
-
expect(Cloudinary::Utils.cloudinary_url('sample', :transformation => t)).to eq("#{upload_path}/#{expected_trans}/sample")
|
362
|
-
end
|
363
|
-
end
|
364
|
-
end
|
365
|
-
|
366
|
-
|
367
|
-
it "should use type from options" do
|
368
|
-
expect(["test", { :type => :facebook }])
|
369
|
-
.to produce_url("#{root_path}/image/facebook/test")
|
370
|
-
.and empty_options
|
371
|
-
end
|
372
|
-
|
373
|
-
it "should use resource_type from options" do
|
374
|
-
expect(["test", { :resource_type => :raw }])
|
375
|
-
.to produce_url("#{root_path}/raw/upload/test")
|
376
|
-
.and empty_options
|
377
|
-
end
|
378
|
-
|
379
|
-
it "should ignore http links only if type is not given or is asset" do
|
380
|
-
expect(["http://test", { :type => nil }])
|
381
|
-
.to produce_url("http://test")
|
382
|
-
.and empty_options
|
383
|
-
expect(["http://test", { :type => :asset }])
|
384
|
-
.to produce_url("http://test")
|
385
|
-
.and empty_options
|
386
|
-
expect(["http://test", { :type => :fetch }])
|
387
|
-
.to produce_url("#{root_path}/image/fetch/http://test")
|
388
|
-
.and empty_options
|
389
|
-
end
|
390
|
-
|
391
|
-
it "should use allow absolute links to /images" do
|
392
|
-
expect(["/images/test", {}])
|
393
|
-
.to produce_url("#{upload_path}/test")
|
394
|
-
.and empty_options
|
395
|
-
end
|
396
|
-
|
397
|
-
it "should use ignore absolute links not to /images" do
|
398
|
-
expect(["/js/test", {}])
|
399
|
-
.to produce_url("/js/test")
|
400
|
-
.and empty_options
|
401
|
-
end
|
402
|
-
|
403
|
-
it "should escape fetch urls" do
|
404
|
-
expect(["http://blah.com/hello?a=b", { :type => :fetch }])
|
405
|
-
.to produce_url("#{root_path}/image/fetch/http://blah.com/hello%3Fa%3Db")
|
406
|
-
.and empty_options
|
407
|
-
end
|
408
|
-
|
409
|
-
it "should should escape http urls" do
|
410
|
-
expect(["http://www.youtube.com/watch?v=d9NF2edxy-M", { :type => :youtube }])
|
411
|
-
.to produce_url("#{root_path}/image/youtube/http://www.youtube.com/watch%3Fv%3Dd9NF2edxy-M")
|
412
|
-
.and empty_options
|
413
|
-
end
|
414
|
-
|
415
|
-
it "should support background" do
|
416
|
-
expect(["test", { :background => "red" }])
|
417
|
-
.to produce_url("#{upload_path}/b_red/test")
|
418
|
-
.and empty_options
|
419
|
-
expect(["test", { :background => "#112233" }])
|
420
|
-
.to produce_url("#{upload_path}/b_rgb:112233/test")
|
421
|
-
.and empty_options
|
422
|
-
end
|
423
|
-
|
424
|
-
it "should support default_image" do
|
425
|
-
expect(["test", { :default_image => "default" }])
|
426
|
-
.to produce_url("#{upload_path}/d_default/test")
|
427
|
-
.and empty_options
|
428
|
-
end
|
429
|
-
|
430
|
-
it "should support angle" do
|
431
|
-
expect(["test", { :angle => "55" }])
|
432
|
-
.to produce_url("#{upload_path}/a_55/test")
|
433
|
-
.and empty_options
|
434
|
-
expect(["test", { :angle => ["auto", "55"] }])
|
435
|
-
.to produce_url("#{upload_path}/a_auto.55/test")
|
436
|
-
.and empty_options
|
437
|
-
end
|
438
|
-
|
439
|
-
it "should process the radius correctly when given valid values" do
|
440
|
-
valid_radius_test_values = [
|
441
|
-
[10, 'r_10'],
|
442
|
-
['10', 'r_10'],
|
443
|
-
['$v', 'r_$v'],
|
444
|
-
[[10, 20, 30], 'r_10:20:30'],
|
445
|
-
[[10, 20, '$v'], 'r_10:20:$v'],
|
446
|
-
[[10, 20, '$v', 40], 'r_10:20:$v:40'],
|
447
|
-
[['10:20'], 'r_10:20'],
|
448
|
-
[['10:20:$v:40'], 'r_10:20:$v:40']
|
449
|
-
]
|
450
|
-
valid_radius_test_values.each do |options, expected|
|
451
|
-
expect(["test", { :transformation => { :radius => options } }])
|
452
|
-
.to produce_url("#{root_path}/image/upload/#{expected}/test") .and empty_options
|
453
|
-
end
|
454
|
-
end
|
455
|
-
|
456
|
-
it "should throw an error when the radius is given invalid values" do
|
457
|
-
invalid_radius_test_values = [
|
458
|
-
[],
|
459
|
-
[10,20,30,40,50]
|
460
|
-
]
|
461
|
-
invalid_radius_test_values.each do |options|
|
462
|
-
expect{Cloudinary::Utils.cloudinary_url("test", {:transformation => {:radius => options}})}
|
463
|
-
.to raise_error(CloudinaryException)
|
464
|
-
end
|
465
|
-
end
|
466
|
-
|
467
|
-
it "should support format for fetch urls" do
|
468
|
-
expect(["http://cloudinary.com/images/logo.png", { :format => "jpg", :type => :fetch }])
|
469
|
-
.to produce_url("#{root_path}/image/fetch/f_jpg/http://cloudinary.com/images/logo.png")
|
470
|
-
.and empty_options
|
471
|
-
end
|
472
|
-
|
473
|
-
it "should support effect" do
|
474
|
-
expect(["test", { :effect => "sepia" }])
|
475
|
-
.to produce_url("#{upload_path}/e_sepia/test")
|
476
|
-
.and empty_options
|
477
|
-
end
|
478
|
-
|
479
|
-
it "should support effect with hash param" do
|
480
|
-
expect(["test", { :effect => { "sepia" => -10 } }])
|
481
|
-
.to produce_url("#{upload_path}/e_sepia:-10/test")
|
482
|
-
.and empty_options
|
483
|
-
end
|
484
|
-
|
485
|
-
it "should support effect with array param" do
|
486
|
-
expect(["test", { :effect => ["sepia", 10] }])
|
487
|
-
.to produce_url("#{upload_path}/e_sepia:10/test")
|
488
|
-
.and empty_options
|
489
|
-
end
|
490
|
-
|
491
|
-
it "should support blur effect with ocr gravity" do
|
492
|
-
expect(["test", { :effect => ["blur_region", 5000], :gravity => "ocr_text" }])
|
493
|
-
.to produce_url("#{upload_path}/e_blur_region:5000,g_ocr_text/test")
|
494
|
-
.and empty_options
|
495
|
-
end
|
496
|
-
|
497
|
-
it "should support artistic effect" do
|
498
|
-
expect(["test", { :effect => "art:incognito"}])
|
499
|
-
.to produce_url("#{upload_path}/e_art:incognito/test")
|
500
|
-
.and empty_options
|
501
|
-
end
|
502
|
-
|
503
|
-
it "should support keyframe_interval" do
|
504
|
-
expect(["test", { :keyframe_interval => 10 }])
|
505
|
-
.to produce_url("#{upload_path}/ki_10/test")
|
506
|
-
.and empty_options
|
507
|
-
end
|
508
|
-
|
509
|
-
it "should support streaming_profile" do
|
510
|
-
expect(["test", { :streaming_profile => "some-profile" }])
|
511
|
-
.to produce_url("#{upload_path}/sp_some-profile/test")
|
512
|
-
.and empty_options
|
513
|
-
end
|
514
|
-
|
515
|
-
shared_examples "a signed url" do |specific_options = {}, specific_transformation = ""|
|
516
|
-
let(:expected_transformation) do
|
517
|
-
(specific_transformation.blank? || specific_transformation.match(/\/$/)) ? specific_transformation : "#{specific_transformation}/"
|
518
|
-
end
|
519
|
-
let! (:authenticated_image) do
|
520
|
-
Cloudinary::Uploader.upload "http://res.cloudinary.com/demo/image/upload/sample.jpg",
|
521
|
-
:type => 'authenticated',
|
522
|
-
:tags => TEST_TAG
|
523
|
-
end
|
524
|
-
let(:options) { { :version => authenticated_image['version'], :sign_url => true, :type => :authenticated }.merge(specific_options) }
|
525
|
-
let(:authenticated_path) { "#{root_path}/image/authenticated" }
|
526
|
-
|
527
|
-
it "should correctly sign URL with version" do
|
528
|
-
expect(["#{authenticated_image['public_id']}.jpg", options])
|
529
|
-
.to produce_url(%r"#{authenticated_path}/s--[\w-]+--/#{expected_transformation}v#{authenticated_image['version']}/#{authenticated_image['public_id']}.jpg")
|
530
|
-
.and empty_options
|
531
|
-
end
|
532
|
-
it "should correctly sign URL with transformation and version" do
|
533
|
-
options[:transformation] = { :crop => "crop", :width => 10, :height => 20 }
|
534
|
-
expect(["#{authenticated_image['public_id']}.jpg", options])
|
535
|
-
.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")
|
536
|
-
.and empty_options
|
537
|
-
end
|
538
|
-
it "should correctly sign URL with transformation" do
|
539
|
-
options[:transformation] = { :crop => "crop", :width => 10, :height => 20 }
|
540
|
-
expect(["#{authenticated_image['public_id']}.jpg", options])
|
541
|
-
.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")
|
542
|
-
.and empty_options
|
543
|
-
.and be_served_by_cloudinary
|
544
|
-
end
|
545
|
-
it "should correctly sign fetch URL" do
|
546
|
-
options[:type] = :fetch
|
547
|
-
expect(["http://res.cloudinary.com/demo/sample.png", options])
|
548
|
-
.to produce_url(%r"^#{root_path}/image/fetch/s--[\w-]+--/#{expected_transformation}v#{authenticated_image['version']}/http://res.cloudinary.com/demo/sample.png$")
|
549
|
-
.and empty_options
|
550
|
-
end
|
551
|
-
end
|
552
|
-
|
553
|
-
|
554
|
-
{ 'overlay' => :l, :underlay => :u }.each do |param, letter|
|
555
|
-
describe param do
|
556
|
-
let(:root_path) { "http://res.cloudinary.com/#{cloud_name}" }
|
557
|
-
let(:layers_options) { [
|
558
|
-
# [name, options, result]
|
559
|
-
["string", "text:hello", "text:hello"],
|
560
|
-
["public_id", { "public_id" => "logo" }, "logo"],
|
561
|
-
["public_id with folder", { "public_id" => "folder/logo" }, "folder:logo"],
|
562
|
-
["private", { "public_id" => "logo", "type" => "private" }, "private:logo"],
|
563
|
-
["format", { "public_id" => "logo", "format" => "png" }, "logo.png"],
|
564
|
-
["video", { "resource_type" => "video", "public_id" => "cat" }, "video:cat"],
|
565
|
-
] }
|
566
|
-
it "should support #{param}" do
|
567
|
-
layers_options.each do |name, options, result|
|
568
|
-
expect(["test", { param => options }]).to produce_url("#{upload_path}/#{letter}_#{result}/test").and empty_options
|
569
|
-
end
|
570
|
-
end
|
571
|
-
|
572
|
-
it "should not pass width/height to html for #{param}" do
|
573
|
-
expect(["test", { param => "text:hello", :height => 100, :width => 100 }])
|
574
|
-
.to produce_url("#{upload_path}/h_100,#{letter}_text:hello,w_100/test")
|
575
|
-
.and empty_options
|
576
|
-
end
|
577
|
-
end
|
578
|
-
end
|
579
|
-
|
580
|
-
describe "text" do
|
581
|
-
|
582
|
-
text_layer = "Hello World, /Nice to meet you?"
|
583
|
-
text_encoded = "Hello%20World%252C%20%252FNice%20to%20meet%20you%3F"
|
584
|
-
|
585
|
-
before :all do
|
586
|
-
Cloudinary::Uploader.text(text_layer, {
|
587
|
-
:public_id => "test_text",
|
588
|
-
:overwrite => true,
|
589
|
-
:font_family => "Arial",
|
590
|
-
:font_size => "18",
|
591
|
-
:tags => TEST_TAG
|
592
|
-
})
|
593
|
-
srt = Tempfile.new(['test_subtitles', '.srt'])
|
594
|
-
srt.write <<-END
|
595
|
-
1
|
596
|
-
00:00:10,500 --> 00:00:13,000
|
597
|
-
Hello World, Nice to meet you?
|
598
|
-
|
599
|
-
END
|
600
|
-
srt.rewind
|
601
|
-
Cloudinary::Uploader.upload srt, :public_id => 'subtitles.srt', :resource_type => 'raw', :overwrite => true, :tags => TEST_TAG
|
602
|
-
srt.unlink
|
603
|
-
end
|
604
|
-
|
605
|
-
include_context "cleanup"
|
606
|
-
|
607
|
-
{ 'overlay' => 'l' }.each do |param, short| # 'underlay' => 'u' behaves the same as overlay
|
608
|
-
describe param do
|
609
|
-
let(:root_path) { "http://res.cloudinary.com/#{cloud_name}" }
|
610
|
-
# [name, options, result]
|
611
|
-
layers_options= [
|
612
|
-
["string", "text:test_text:hello", "text:test_text:hello"],
|
613
|
-
["explicit layer parameter", "text:test_text:#{text_encoded}", "text:test_text:#{text_encoded}"],
|
614
|
-
["text parameter", { :public_id => "test_text", :text => text_layer }, "text:test_text:#{text_encoded}"],
|
615
|
-
["text with font family and size parameters", { :text => text_layer, :font_family => "Arial", :font_size => "18" }, "text:Arial_18:#{text_encoded}"],
|
616
|
-
["text with text style parameter", { :text => text_layer, :font_family => "Arial", :font_size => "18", :font_weight => "bold", :font_style => "italic", :letter_spacing => 4, :line_spacing => 2 }, "text:Arial_18_bold_italic_letter_spacing_4_line_spacing_2:#{text_encoded}"],
|
617
|
-
["text with antialiasing and font hinting", { :text => "Hello World, Nice to meet you?", :font_family => "Arial", :font_size => "18", :font_antialiasing => "best", :font_hinting => "medium"}, "text:Arial_18_antialias_best_hinting_medium:Hello%20World%252C%20Nice%20to%20meet%20you%3F"],
|
618
|
-
["text with text style parameter (explicit)", "text:Arial_18_antialias_best_hinting_medium:Hello%20World%252C%20Nice%20to%20meet%20you%3F", "text:Arial_18_antialias_best_hinting_medium:Hello%20World%252C%20Nice%20to%20meet%20you%3F"],
|
619
|
-
["subtitles", { :resource_type => "subtitles", :public_id => "subtitles.srt" }, "subtitles:subtitles.srt"],
|
620
|
-
["subtitles with font family and size", { :resource_type => "subtitles", :public_id => "subtitles.srt", :font_family => "Arial", :font_size => "40" }, "subtitles:Arial_40:subtitles.srt"],
|
621
|
-
["image of type fetch", { :public_id => "http://res.cloudinary.com/demo/image/upload/ci", :type => "fetch" }, "fetch:aHR0cDovL3Jlcy5jbG91ZGluYXJ5LmNvbS9kZW1vL2ltYWdlL3VwbG9hZC9jaQ=="]
|
622
|
-
]
|
623
|
-
layers_options.each do |name, options, result|
|
624
|
-
it "should support #{name}" do
|
625
|
-
expect(["sample.jpg", { param => options }]).to produce_url("#{upload_path}/#{short}_#{result}/sample.jpg").and empty_options
|
626
|
-
# expect("#{upload_path}/#{short}_#{result}/sample.jpg").to be_served_by_cloudinary
|
627
|
-
end
|
628
|
-
unless options.is_a? String || param == 'underlay'
|
629
|
-
op = Hash.new
|
630
|
-
op[param] = options
|
631
|
-
it_behaves_like "a signed url", op, "#{short}_#{result}"
|
632
|
-
end
|
633
|
-
end
|
634
|
-
|
635
|
-
it "should not pass width/height to html for #{param}" do
|
636
|
-
expect(["test", { param => "text:test_text", :height => 100, :width => 100 }])
|
637
|
-
.to produce_url("#{upload_path}/h_100,#{short}_text:test_text,w_100/test")
|
638
|
-
.and empty_options
|
639
|
-
|
640
|
-
end
|
641
|
-
end
|
642
|
-
end
|
643
|
-
end
|
644
|
-
|
645
|
-
|
646
|
-
it "should use ssl_detected if secure is not given as parameter and not set to true in configuration" do
|
647
|
-
expect(["test", { :ssl_detected => true }])
|
648
|
-
.to produce_url("https://res.cloudinary.com/#{cloud_name}/image/upload/test")
|
649
|
-
.and empty_options
|
650
|
-
end
|
651
|
-
|
652
|
-
it "should use secure if given over ssl_detected and configuration" do
|
653
|
-
Cloudinary.config.secure = true
|
654
|
-
expect(["test", { :ssl_detected => true, :secure => false }])
|
655
|
-
.to produce_url("#{upload_path}/test")
|
656
|
-
.and empty_options
|
657
|
-
end
|
658
|
-
|
659
|
-
it "should use secure: true from configuration over ssl_detected" do
|
660
|
-
Cloudinary.config.secure = true
|
661
|
-
expect(["test", { :ssl_detected => false }])
|
662
|
-
.to produce_url("https://res.cloudinary.com/#{cloud_name}/image/upload/test")
|
663
|
-
.and empty_options
|
664
|
-
end
|
665
|
-
|
666
|
-
it "should support extenal cname" do
|
667
|
-
expect(["test", { :cname => "hello.com" }])
|
668
|
-
.to produce_url("http://hello.com/#{cloud_name}/image/upload/test")
|
669
|
-
.and empty_options
|
670
|
-
end
|
671
|
-
|
672
|
-
it "should support extenal cname with cdn_subdomain on" do
|
673
|
-
expect(["test", { :cname => "hello.com", :private_cdn => true, :cdn_subdomain => true}])
|
674
|
-
.to produce_url("http://a2.hello.com/image/upload/test")
|
675
|
-
.and empty_options
|
676
|
-
end
|
677
|
-
|
678
|
-
it "should support cdn_subdomain with secure on if using shared_domain" do
|
679
|
-
expect(["test", { :secure => true, :cdn_subdomain => true }])
|
680
|
-
.to produce_url("https://res-2.cloudinary.com/#{cloud_name}/image/upload/test")
|
681
|
-
.and empty_options
|
682
|
-
end
|
683
|
-
|
684
|
-
it "should support secure_cdn_subdomain false override with secure" do
|
685
|
-
expect(["test", { :secure => true, :cdn_subdomain => true, :secure_cdn_subdomain => false }])
|
686
|
-
.to produce_url("https://res.cloudinary.com/#{cloud_name}/image/upload/test")
|
687
|
-
.and empty_options
|
688
|
-
end
|
689
|
-
|
690
|
-
it "should support secure_cdn_subdomain true override with secure" do
|
691
|
-
expect(["test", { :secure => true, :cdn_subdomain => true, :secure_cdn_subdomain => true, :private_cdn => true }])
|
692
|
-
.to produce_url("https://#{cloud_name}-res-2.cloudinary.com/image/upload/test")
|
693
|
-
.and empty_options
|
694
|
-
end
|
695
|
-
|
696
|
-
it "should support string param" do
|
697
|
-
expect(["test", { "effect" => { "sepia" => 10 } }])
|
698
|
-
.to produce_url("#{upload_path}/e_sepia:10/test")
|
699
|
-
.and empty_options
|
700
|
-
end
|
701
|
-
|
702
|
-
it "should support border" do
|
703
|
-
expect(["test", { "border" => { :width => 5 } }])
|
704
|
-
.to produce_url("#{upload_path}/bo_5px_solid_black/test")
|
705
|
-
.and empty_options
|
706
|
-
expect(["test", { "border" => { :width => 5, :color => "#ffaabbdd" } }])
|
707
|
-
.to produce_url("#{upload_path}/bo_5px_solid_rgb:ffaabbdd/test")
|
708
|
-
.and empty_options
|
709
|
-
expect(["test", { "border" => "1px_solid_blue" }])
|
710
|
-
.to produce_url("#{upload_path}/bo_1px_solid_blue/test")
|
711
|
-
.and empty_options
|
712
|
-
expect(["test", { "border" => "2" }]).to produce_url("#{upload_path}/test").and mutate_options_to({ :border => "2" })
|
713
|
-
end
|
714
|
-
|
715
|
-
it "should support flags" do
|
716
|
-
expect(["test", { "flags" => "abc" }])
|
717
|
-
.to produce_url("#{upload_path}/fl_abc/test")
|
718
|
-
.and empty_options
|
719
|
-
expect(["test", { "flags" => ["abc", "def"] }])
|
720
|
-
.to produce_url("#{upload_path}/fl_abc.def/test")
|
721
|
-
.and empty_options
|
722
|
-
end
|
723
|
-
|
724
|
-
it "should support aspect ratio" do
|
725
|
-
expect(["test", { "aspect_ratio" => "1.0" }])
|
726
|
-
.to produce_url("#{upload_path}/ar_1.0/test")
|
727
|
-
.and empty_options
|
728
|
-
expect(["test", { "aspect_ratio" => "3:2" }])
|
729
|
-
.to produce_url("#{upload_path}/ar_3:2/test")
|
730
|
-
.and empty_options
|
731
|
-
end
|
732
|
-
|
733
|
-
it "build_upload_params should not destroy options" do
|
734
|
-
options = { :width => 100, :crop => :scale }
|
735
|
-
expect(Cloudinary::Uploader.build_upload_params(options)[:transformation]).to eq("c_scale,w_100")
|
736
|
-
expect(options.length).to eq(2)
|
737
|
-
end
|
738
|
-
|
739
|
-
it "build_upload_params canonize booleans" do
|
740
|
-
options = { :backup => true, :use_filename => false, :colors => :true,
|
741
|
-
:image_metadata => :false, :invalidate => 1 }
|
742
|
-
params = Cloudinary::Uploader.build_upload_params(options)
|
743
|
-
expect(Cloudinary::Api.only(params, *options.keys))
|
744
|
-
.to eq(:backup => 1,
|
745
|
-
:use_filename => 0,
|
746
|
-
:colors => 1,
|
747
|
-
:image_metadata => 0,
|
748
|
-
:invalidate => 1
|
749
|
-
)
|
750
|
-
options = { :colors => "true", :exif => "false", :eager_async => "1" }
|
751
|
-
params = Cloudinary::Uploader.build_upload_params(options)
|
752
|
-
expect(Cloudinary::Api.only(params, *options.keys))
|
753
|
-
.to eq(:exif => 0, :colors => 1, :eager_async => 1)
|
754
|
-
expect(Cloudinary::Uploader.build_upload_params(:backup => nil)[:backup]).to be_nil
|
755
|
-
expect(Cloudinary::Uploader.build_upload_params({})[:backup]).to be_nil
|
756
|
-
end
|
757
|
-
|
758
|
-
it "should add version if public_id contains /" do
|
759
|
-
expect(["folder/test", {}])
|
760
|
-
.to produce_url("#{upload_path}/v1/folder/test")
|
761
|
-
.and empty_options
|
762
|
-
expect(["folder/test", { :version => 123 }])
|
763
|
-
.to produce_url("#{upload_path}/v123/folder/test")
|
764
|
-
.and empty_options
|
765
|
-
end
|
766
|
-
|
767
|
-
it "should not add version if public_id contains version already" do
|
768
|
-
expect(["v1234/test", {}])
|
769
|
-
.to produce_url("#{upload_path}/v1234/test")
|
770
|
-
.and empty_options
|
771
|
-
end
|
772
|
-
|
773
|
-
it "should default force_version to True if no value is given" do
|
774
|
-
expect(["folder/test", {}])
|
775
|
-
.to produce_url("#{upload_path}/v1/folder/test")
|
776
|
-
.and empty_options
|
777
|
-
end
|
778
|
-
|
779
|
-
it "should exclude the version if resource is stored in a folder and force_version is False" do
|
780
|
-
expect(["folder/test", {:force_version => false}])
|
781
|
-
.to produce_url("#{upload_path}/folder/test")
|
782
|
-
.and empty_options
|
783
|
-
end
|
784
|
-
|
785
|
-
it "should include the version if given explicitly regardless of force_verison (without folder)" do
|
786
|
-
expect(["test", {:force_version => false, :version => 12345}])
|
787
|
-
.to produce_url("#{upload_path}/v12345/test")
|
788
|
-
.and empty_options
|
789
|
-
end
|
790
|
-
|
791
|
-
it "should include the version if given explicitly regardless of force_verison (with folder)" do
|
792
|
-
expect(["folder/test", {:force_version => false, :version => 12345}])
|
793
|
-
.to produce_url("#{upload_path}/v12345/folder/test")
|
794
|
-
.and empty_options
|
795
|
-
end
|
796
|
-
|
797
|
-
it "should use the force_version option if set in the global config" do
|
798
|
-
Cloudinary.config(:force_version => false)
|
799
|
-
expect(["folder/test", {}])
|
800
|
-
.to produce_url("#{upload_path}/folder/test")
|
801
|
-
.and empty_options
|
802
|
-
end
|
803
|
-
|
804
|
-
it "should ignore the global force_version config if version is set explicitly in the options" do
|
805
|
-
Cloudinary.config(:force_version => false)
|
806
|
-
expect(["folder/test", {:version => 12345}])
|
807
|
-
.to produce_url("#{upload_path}/v12345/folder/test")
|
808
|
-
.and empty_options
|
809
|
-
end
|
810
|
-
|
811
|
-
it "should override global config option if force_version is given within options" do
|
812
|
-
Cloudinary.config(:force_version => false)
|
813
|
-
expect(["folder/test", {:force_version => true}])
|
814
|
-
.to produce_url("#{upload_path}/v1/folder/test")
|
815
|
-
.and empty_options
|
816
|
-
end
|
817
|
-
|
818
|
-
it "should allow to shorted image/upload urls" do
|
819
|
-
expect(["test", { :shorten => true }])
|
820
|
-
.to produce_url("#{root_path}/iu/test")
|
821
|
-
.and empty_options
|
822
|
-
end
|
823
|
-
|
824
|
-
it "should allow to use folders in PreloadedFile" do
|
825
|
-
signature = Cloudinary::Utils.api_sign_request({ :public_id => "folder/file", :version => "1234" }, Cloudinary.config.api_secret)
|
826
|
-
preloaded = Cloudinary::PreloadedFile.new("image/upload/v1234/folder/file.jpg#" + signature)
|
827
|
-
expect(preloaded).to be_valid
|
828
|
-
[
|
829
|
-
[:filename, 'folder/file.jpg'],
|
830
|
-
[:version, '1234'],
|
831
|
-
[:public_id, 'folder/file'],
|
832
|
-
[:signature, signature],
|
833
|
-
[:resource_type, 'image'],
|
834
|
-
[:type, 'upload'],
|
835
|
-
[:format, 'jpg']
|
836
|
-
].each do |attr,value|
|
837
|
-
expect(preloaded.send(attr)).to eq(value)
|
838
|
-
end
|
839
|
-
end
|
840
|
-
|
841
|
-
it "should escape public_ids" do
|
842
|
-
[
|
843
|
-
["a b", "a%20b"],
|
844
|
-
["a+b", "a%2Bb"],
|
845
|
-
["a%20b", "a%20b"],
|
846
|
-
["a-b", "a-b"],
|
847
|
-
["a??b", "a%3F%3Fb"],
|
848
|
-
["parentheses(interject)", "parentheses%28interject%29"]
|
849
|
-
].each do
|
850
|
-
|source, target|
|
851
|
-
expect(Cloudinary::Utils.cloudinary_url(source)).to eq("#{upload_path}/#{target}")
|
852
|
-
end
|
853
|
-
end
|
854
|
-
|
855
|
-
|
856
|
-
describe ":sign_url" do
|
857
|
-
it_behaves_like "a signed url"
|
858
|
-
end
|
859
|
-
|
860
|
-
describe ":sign_version (deprecated)" do
|
861
|
-
it_behaves_like "a signed url", :sign_version => true
|
862
|
-
end
|
863
|
-
|
864
|
-
it "should correctly sign_request" do
|
865
|
-
params = Cloudinary::Utils.sign_request(
|
866
|
-
{
|
867
|
-
:public_id => "folder/file",
|
868
|
-
:version => "1234" },
|
869
|
-
{
|
870
|
-
:cloud_name => "demo",
|
871
|
-
:api_key => "1234",
|
872
|
-
:api_secret => "b"
|
873
|
-
}
|
874
|
-
)
|
875
|
-
expect(params).to include(:signature => "7a3349cbb373e4812118d625047ede50b90e7b67")
|
876
|
-
end
|
877
|
-
|
878
|
-
it "should support responsive width" do
|
879
|
-
expect(["test", { :width => 100, :height => 100, :crop => :crop, :responsive_width => true }])
|
880
|
-
.to produce_url("#{upload_path}/c_crop,h_100,w_100/c_limit,w_auto/test")
|
881
|
-
.and mutate_options_to({ :responsive => true })
|
882
|
-
Cloudinary.config.responsive_width_transformation = { :width => :auto, :crop => :pad }
|
883
|
-
expect(["test", { :width => 100, :height => 100, :crop => :crop, :responsive_width => true }])
|
884
|
-
.to produce_url("#{upload_path}/c_crop,h_100,w_100/c_pad,w_auto/test")
|
885
|
-
.and mutate_options_to({ :responsive => true })
|
886
|
-
end
|
887
|
-
|
888
|
-
it "should correctly encode double arrays" do
|
889
|
-
expect(Cloudinary::Utils.encode_double_array([1, 2, 3, 4])).to eq("1,2,3,4")
|
890
|
-
expect(Cloudinary::Utils.encode_double_array([[1, 2, 3, 4], [5, 6, 7, 8]])).to eq("1,2,3,4|5,6,7,8")
|
891
|
-
end
|
892
|
-
|
893
|
-
describe ":if" do
|
894
|
-
describe 'with literal condition string' do
|
895
|
-
it "should include the if parameter as the first component in the transformation string" do
|
896
|
-
expect(["sample", { if: "w_lt_200", crop: "fill", height: 120, width: 80 }])
|
897
|
-
.to produce_url("#{upload_path}/if_w_lt_200,c_fill,h_120,w_80/sample")
|
898
|
-
expect(["sample", { crop: "fill", height: 120, if: "w_lt_200", width: 80 }])
|
899
|
-
.to produce_url("#{upload_path}/if_w_lt_200,c_fill,h_120,w_80/sample")
|
900
|
-
|
901
|
-
end
|
902
|
-
it "should allow multiple conditions when chaining transformations " do
|
903
|
-
expect(["sample", transformation: [{ if: "w_lt_200", crop: "fill", height: 120, width: 80 },
|
904
|
-
{ if: "w_gt_400", crop: "fit", width: 150, height: 150 },
|
905
|
-
{ effect: "sepia" }]])
|
906
|
-
.to produce_url("#{upload_path}/if_w_lt_200,c_fill,h_120,w_80/if_w_gt_400,c_fit,h_150,w_150/e_sepia/sample")
|
907
|
-
end
|
908
|
-
it "should allow multiple tags condition" do
|
909
|
-
expect(["sample", transformation: [{ if: "!tag1:tag2:tag3!_in_tags", crop: "fill", height: 120, width: 80 },
|
910
|
-
{ if: "else", crop: "fit", width: 150, height: 150 },
|
911
|
-
{ effect: "sepia" }]])
|
912
|
-
.to produce_url("#{upload_path}/if_!tag1:tag2:tag3!_in_tags,c_fill,h_120,w_80/if_else,c_fit,h_150,w_150/e_sepia/sample")
|
913
|
-
end
|
914
|
-
|
915
|
-
describe "including spaces and operators" do
|
916
|
-
it "should translate operators" do
|
917
|
-
expect(["sample", { if: "w < 200", crop: "fill", height: 120, width: 80 }])
|
918
|
-
.to produce_url("#{upload_path}/if_w_lt_200,c_fill,h_120,w_80/sample")
|
919
|
-
end
|
920
|
-
end
|
921
|
-
|
922
|
-
describe 'if end' do
|
923
|
-
it "should include the if_end as the last parameter in its component" do
|
924
|
-
expect(["sample", transformation: [{ if: "w_lt_200" },
|
925
|
-
{ crop: "fill", height: 120, width: 80, effect: "sharpen" },
|
926
|
-
{ effect: "brightness:50" },
|
927
|
-
{ effect: "shadow", color: "red" },
|
928
|
-
{ if: "end" }]])
|
929
|
-
.to produce_url("#{upload_path}/if_w_lt_200/c_fill,e_sharpen,h_120,w_80/e_brightness:50/co_red,e_shadow/if_end/sample")
|
930
|
-
end
|
931
|
-
it "should support if_else with transformation parameters" do
|
932
|
-
expect(["sample", transformation: [{ if: "w_lt_200", crop: "fill", height: 120, width: 80 },
|
933
|
-
{ if: "else", crop: "fill", height: 90, width: 100 }]])
|
934
|
-
.to produce_url("#{upload_path}/if_w_lt_200,c_fill,h_120,w_80/if_else,c_fill,h_90,w_100/sample")
|
935
|
-
end
|
936
|
-
it "if_else should be without any transformation parameters" do
|
937
|
-
expect(["sample", transformation: [{ if: "w_lt_200" },
|
938
|
-
{ crop: "fill", height: 120, width: 80 },
|
939
|
-
{ if: "else" },
|
940
|
-
{ crop: "fill", height: 90, width: 100 }]])
|
941
|
-
.to produce_url("#{upload_path}/if_w_lt_200/c_fill,h_120,w_80/if_else/c_fill,h_90,w_100/sample")
|
942
|
-
end
|
943
|
-
end
|
944
|
-
it "should support and translate operators: '=', '!=', '<', '>', '<=', '>=', '&&', '||'" do
|
945
|
-
|
946
|
-
all_operators =
|
947
|
-
'if_' +
|
948
|
-
'w_eq_0_and' +
|
949
|
-
'_w_ne_0_or' +
|
950
|
-
'_h_lt_0_and' +
|
951
|
-
'_ar_gt_0_and' +
|
952
|
-
'_pc_lte_0_and' +
|
953
|
-
'_fc_gte_0' +
|
954
|
-
',e_grayscale'
|
955
|
-
|
956
|
-
expect( ["sample",
|
957
|
-
:if =>"width = 0 && w != 0 || height < 0 and aspect_ratio > 0 and page_count <= 0 and face_count >= 0",
|
958
|
-
:effect =>"grayscale"])
|
959
|
-
.to produce_url("#{upload_path}/#{all_operators}/sample")
|
960
|
-
end
|
961
|
-
end
|
962
|
-
|
963
|
-
describe "variables" do
|
964
|
-
it "array should define a set of variables" do
|
965
|
-
options = {
|
966
|
-
:if => "face_count > 2",
|
967
|
-
:variables => [ ["$z", 5], ["$foo", "$z * 2"] ],
|
968
|
-
:crop => "scale", :width => "$foo * 200"
|
969
|
-
}
|
970
|
-
t = Cloudinary::Utils.generate_transformation_string options
|
971
|
-
expect(t).to eq("if_fc_gt_2,$z_5,$foo_$z_mul_2,c_scale,w_$foo_mul_200")
|
972
|
-
end
|
973
|
-
it "'$key' should define a variable" do
|
974
|
-
options = { :transformation => [
|
975
|
-
{"$foo" => 10 },
|
976
|
-
{:if => "face_count > 2"},
|
977
|
-
{:crop => "scale", :width => "$foo * 200 / face_count"},
|
978
|
-
{:if => "end"}
|
979
|
-
] }
|
980
|
-
t = Cloudinary::Utils.generate_transformation_string options
|
981
|
-
expect(t).to eq("$foo_10/if_fc_gt_2/c_scale,w_$foo_mul_200_div_fc/if_end")
|
982
|
-
end
|
983
|
-
it "should support text values" do
|
984
|
-
expect( ["sample", :effect => "$efname:100", "$efname" => "!blur!"]).to produce_url "#{upload_path}/$efname_!blur!,e_$efname:100/sample"
|
985
|
-
|
986
|
-
end
|
987
|
-
it "should support string interpolation" do
|
988
|
-
expect( ["sample", :crop => "scale", :overlay => {:text => "$(start)Hello $(name)$(ext), $(no ) $( no)$(end)", :font_family => "Arial", :font_size => "18"} ]).to produce_url "#{upload_path}/c_scale,l_text:Arial_18:$(start)Hello%20$(name)$(ext)%252C%20%24%28no%20%29%20%24%28%20no%29$(end)/sample"
|
989
|
-
|
990
|
-
end
|
991
|
-
end
|
992
|
-
|
993
|
-
describe "context" do
|
994
|
-
it 'should escape pipe and backslash characters' do
|
995
|
-
context = {"caption" => "different = caption", "alt2" => "alt|alternative"}
|
996
|
-
result = Cloudinary::Utils.encode_context(context)
|
997
|
-
expect(result).to eq("caption=different \\= caption|alt2=alt\\|alternative")
|
998
|
-
.or eq("alt2=alt\\|alternative|caption=different \\= caption")
|
999
|
-
|
1000
|
-
end
|
1001
|
-
it 'should support symbols' do
|
1002
|
-
context = {:symbol_key => "string_value", "string_key" => :symbol_value}
|
1003
|
-
result = Cloudinary::Utils.encode_context(context)
|
1004
|
-
expect(result).to eq("string_key=symbol_value|symbol_key=string_value")
|
1005
|
-
.or eq("symbol_key=string_value|string_key=symbol_value")
|
1006
|
-
end
|
1007
|
-
end
|
1008
|
-
|
1009
|
-
describe "customFunction" do
|
1010
|
-
custom_function_wasm = {
|
1011
|
-
:function_type => 'wasm',
|
1012
|
-
:source => 'blur.wasm'
|
1013
|
-
}
|
1014
|
-
custom_function_wasm_str = 'wasm:blur.wasm'
|
1015
|
-
|
1016
|
-
custom_function_remote = {
|
1017
|
-
:function_type => 'remote',
|
1018
|
-
:source => 'https://df34ra4a.execute-api.us-west-2.amazonaws.com/default/cloudinaryFunction'
|
1019
|
-
}
|
1020
|
-
custom_function_remote_str = 'remote:aHR0cHM6Ly9kZjM0cmE0YS5leGVjdXRlLWFwaS51cy13ZXN0LTIuYW1hem9uYXdzLmNvbS9kZWZhdWx0L2Nsb3VkaW5hcnlGdW5jdGlvbg=='
|
1021
|
-
|
1022
|
-
it 'should accept a string value' do
|
1023
|
-
actual = Cloudinary::Utils.generate_transformation_string :custom_function => custom_function_wasm_str
|
1024
|
-
expect( actual).to eq("fn_#{custom_function_wasm_str}")
|
1025
|
-
end
|
1026
|
-
it 'should accept a hash of options' do
|
1027
|
-
actual = Cloudinary::Utils.generate_transformation_string :custom_function => custom_function_wasm
|
1028
|
-
expect( actual).to eq("fn_#{custom_function_wasm_str}")
|
1029
|
-
end
|
1030
|
-
it 'should base64 encoded URL for a remote function' do
|
1031
|
-
actual = Cloudinary::Utils.generate_transformation_string :custom_function => custom_function_remote
|
1032
|
-
expect( actual).to eq("fn_#{custom_function_remote_str}")
|
1033
|
-
|
1034
|
-
end
|
1035
|
-
|
1036
|
-
it 'should accept a string value' do
|
1037
|
-
actual = Cloudinary::Utils.generate_transformation_string :custom_pre_function => custom_function_wasm_str
|
1038
|
-
expect( actual).to eq("fn_pre:#{custom_function_wasm_str}")
|
1039
|
-
end
|
1040
|
-
it 'should accept a hash of options' do
|
1041
|
-
actual = Cloudinary::Utils.generate_transformation_string :custom_pre_function => custom_function_wasm
|
1042
|
-
expect( actual).to eq("fn_pre:#{custom_function_wasm_str}")
|
1043
|
-
end
|
1044
|
-
it 'should base64 encoded URL for a remote function' do
|
1045
|
-
actual = Cloudinary::Utils.generate_transformation_string :custom_pre_function => custom_function_remote
|
1046
|
-
expect( actual).to eq("fn_pre:#{custom_function_remote_str}")
|
1047
|
-
|
1048
|
-
end
|
1049
|
-
|
1050
|
-
end
|
1051
|
-
end
|
1052
|
-
end
|