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
@@ -1,32 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
-
# If you change this key, all old signed cookies will become invalid!
|
5
|
-
|
6
|
-
# Make sure the secret is at least 30 characters and all random,
|
7
|
-
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
-
# You can use `rails secret` to generate a secure secret key.
|
9
|
-
|
10
|
-
# Make sure the secrets in this file are kept private
|
11
|
-
# if you're sharing your code publicly.
|
12
|
-
|
13
|
-
# Shared secrets are available across all environments.
|
14
|
-
|
15
|
-
# shared:
|
16
|
-
# api_key: a1B2c3D4e5F6
|
17
|
-
|
18
|
-
# Environmental secrets are only available for that specific environment.
|
19
|
-
|
20
|
-
development:
|
21
|
-
secret_key_base: e0ef5744b10d988669be6b2660c259749779964f3dcb487fd6199743b3558e2d89f7681d6a15d16d144e28979cbdae41885f4fb4c2cf56ff92ac22df282ffb66
|
22
|
-
|
23
|
-
test:
|
24
|
-
secret_key_base: 6fb1f3a828a8dcd6ac8dc07b43be4a5265ad64379120d417252a1578fe1f790e7b85ade4f95994de1ac8fb78581690de6e3a6ac4af36a0f0139667418c750d05
|
25
|
-
|
26
|
-
# Do not keep production secrets in the unencrypted secrets file.
|
27
|
-
# Instead, either read values from the environment.
|
28
|
-
# Or, use `rails secrets:setup` to configure encrypted secrets
|
29
|
-
# and move the `production:` environment over there.
|
30
|
-
|
31
|
-
production:
|
32
|
-
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
@@ -1,72 +0,0 @@
|
|
1
|
-
# Note: You must restart bin/webpack-dev-server for changes to take effect
|
2
|
-
|
3
|
-
default: &default
|
4
|
-
source_path: app/javascript
|
5
|
-
source_entry_path: packs
|
6
|
-
public_output_path: packs
|
7
|
-
cache_path: tmp/cache/webpacker
|
8
|
-
check_yarn_integrity: false
|
9
|
-
|
10
|
-
# Additional paths webpack should lookup modules
|
11
|
-
# ['app/assets', 'engine/foo/app/assets']
|
12
|
-
resolved_paths: []
|
13
|
-
|
14
|
-
# Reload manifest.json on all requests so we reload latest compiled packs
|
15
|
-
cache_manifest: false
|
16
|
-
|
17
|
-
extensions:
|
18
|
-
- .js
|
19
|
-
- .sass
|
20
|
-
- .scss
|
21
|
-
- .css
|
22
|
-
- .module.sass
|
23
|
-
- .module.scss
|
24
|
-
- .module.css
|
25
|
-
- .png
|
26
|
-
- .svg
|
27
|
-
- .gif
|
28
|
-
- .jpeg
|
29
|
-
- .jpg
|
30
|
-
|
31
|
-
development:
|
32
|
-
<<: *default
|
33
|
-
compile: true
|
34
|
-
|
35
|
-
# Verifies that versions and hashed value of the package contents in the project's package.json
|
36
|
-
check_yarn_integrity: true
|
37
|
-
|
38
|
-
# Reference: https://webpack.js.org/configuration/dev-server/
|
39
|
-
dev_server:
|
40
|
-
https: false
|
41
|
-
host: localhost
|
42
|
-
port: 3035
|
43
|
-
public: localhost:3035
|
44
|
-
hmr: false
|
45
|
-
# Inline should be set to true if using HMR
|
46
|
-
inline: true
|
47
|
-
overlay: true
|
48
|
-
compress: true
|
49
|
-
disable_host_check: true
|
50
|
-
use_local_ip: false
|
51
|
-
quiet: false
|
52
|
-
headers:
|
53
|
-
'Access-Control-Allow-Origin': '*'
|
54
|
-
watch_options:
|
55
|
-
ignored: /node_modules/
|
56
|
-
|
57
|
-
|
58
|
-
test:
|
59
|
-
<<: *default
|
60
|
-
compile: true
|
61
|
-
|
62
|
-
# Compile test packs to a separate directory
|
63
|
-
public_output_path: packs-test
|
64
|
-
|
65
|
-
production:
|
66
|
-
<<: *default
|
67
|
-
|
68
|
-
# Production depends on precompilation of packs prior to booting for performance.
|
69
|
-
compile: false
|
70
|
-
|
71
|
-
# Cache manifest.json for performance
|
72
|
-
cache_manifest: true
|
@@ -1,67 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
-
<style>
|
7
|
-
.rails-default-error-page {
|
8
|
-
background-color: #EFEFEF;
|
9
|
-
color: #2E2F30;
|
10
|
-
text-align: center;
|
11
|
-
font-family: arial, sans-serif;
|
12
|
-
margin: 0;
|
13
|
-
}
|
14
|
-
|
15
|
-
.rails-default-error-page div.dialog {
|
16
|
-
width: 95%;
|
17
|
-
max-width: 33em;
|
18
|
-
margin: 4em auto 0;
|
19
|
-
}
|
20
|
-
|
21
|
-
.rails-default-error-page div.dialog > div {
|
22
|
-
border: 1px solid #CCC;
|
23
|
-
border-right-color: #999;
|
24
|
-
border-left-color: #999;
|
25
|
-
border-bottom-color: #BBB;
|
26
|
-
border-top: #B00100 solid 4px;
|
27
|
-
border-top-left-radius: 9px;
|
28
|
-
border-top-right-radius: 9px;
|
29
|
-
background-color: white;
|
30
|
-
padding: 7px 12% 0;
|
31
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
-
}
|
33
|
-
|
34
|
-
.rails-default-error-page h1 {
|
35
|
-
font-size: 100%;
|
36
|
-
color: #730E15;
|
37
|
-
line-height: 1.5em;
|
38
|
-
}
|
39
|
-
|
40
|
-
.rails-default-error-page div.dialog > p {
|
41
|
-
margin: 0 0 1em;
|
42
|
-
padding: 1em;
|
43
|
-
background-color: #F7F7F7;
|
44
|
-
border: 1px solid #CCC;
|
45
|
-
border-right-color: #999;
|
46
|
-
border-left-color: #999;
|
47
|
-
border-bottom-color: #999;
|
48
|
-
border-bottom-left-radius: 4px;
|
49
|
-
border-bottom-right-radius: 4px;
|
50
|
-
border-top-color: #DADADA;
|
51
|
-
color: #666;
|
52
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
-
}
|
54
|
-
</style>
|
55
|
-
</head>
|
56
|
-
|
57
|
-
<body class="rails-default-error-page">
|
58
|
-
<!-- This file lives in public/404.html -->
|
59
|
-
<div class="dialog">
|
60
|
-
<div>
|
61
|
-
<h1>The page you were looking for doesn't exist.</h1>
|
62
|
-
<p>You may have mistyped the address or the page may have moved.</p>
|
63
|
-
</div>
|
64
|
-
<p>If you are the application owner check the logs for more information.</p>
|
65
|
-
</div>
|
66
|
-
</body>
|
67
|
-
</html>
|
@@ -1,67 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The change you wanted was rejected (422)</title>
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
-
<style>
|
7
|
-
.rails-default-error-page {
|
8
|
-
background-color: #EFEFEF;
|
9
|
-
color: #2E2F30;
|
10
|
-
text-align: center;
|
11
|
-
font-family: arial, sans-serif;
|
12
|
-
margin: 0;
|
13
|
-
}
|
14
|
-
|
15
|
-
.rails-default-error-page div.dialog {
|
16
|
-
width: 95%;
|
17
|
-
max-width: 33em;
|
18
|
-
margin: 4em auto 0;
|
19
|
-
}
|
20
|
-
|
21
|
-
.rails-default-error-page div.dialog > div {
|
22
|
-
border: 1px solid #CCC;
|
23
|
-
border-right-color: #999;
|
24
|
-
border-left-color: #999;
|
25
|
-
border-bottom-color: #BBB;
|
26
|
-
border-top: #B00100 solid 4px;
|
27
|
-
border-top-left-radius: 9px;
|
28
|
-
border-top-right-radius: 9px;
|
29
|
-
background-color: white;
|
30
|
-
padding: 7px 12% 0;
|
31
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
-
}
|
33
|
-
|
34
|
-
.rails-default-error-page h1 {
|
35
|
-
font-size: 100%;
|
36
|
-
color: #730E15;
|
37
|
-
line-height: 1.5em;
|
38
|
-
}
|
39
|
-
|
40
|
-
.rails-default-error-page div.dialog > p {
|
41
|
-
margin: 0 0 1em;
|
42
|
-
padding: 1em;
|
43
|
-
background-color: #F7F7F7;
|
44
|
-
border: 1px solid #CCC;
|
45
|
-
border-right-color: #999;
|
46
|
-
border-left-color: #999;
|
47
|
-
border-bottom-color: #999;
|
48
|
-
border-bottom-left-radius: 4px;
|
49
|
-
border-bottom-right-radius: 4px;
|
50
|
-
border-top-color: #DADADA;
|
51
|
-
color: #666;
|
52
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
-
}
|
54
|
-
</style>
|
55
|
-
</head>
|
56
|
-
|
57
|
-
<body class="rails-default-error-page">
|
58
|
-
<!-- This file lives in public/422.html -->
|
59
|
-
<div class="dialog">
|
60
|
-
<div>
|
61
|
-
<h1>The change you wanted was rejected.</h1>
|
62
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
63
|
-
</div>
|
64
|
-
<p>If you are the application owner check the logs for more information.</p>
|
65
|
-
</div>
|
66
|
-
</body>
|
67
|
-
</html>
|
@@ -1,66 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>We're sorry, but something went wrong (500)</title>
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
-
<style>
|
7
|
-
.rails-default-error-page {
|
8
|
-
background-color: #EFEFEF;
|
9
|
-
color: #2E2F30;
|
10
|
-
text-align: center;
|
11
|
-
font-family: arial, sans-serif;
|
12
|
-
margin: 0;
|
13
|
-
}
|
14
|
-
|
15
|
-
.rails-default-error-page div.dialog {
|
16
|
-
width: 95%;
|
17
|
-
max-width: 33em;
|
18
|
-
margin: 4em auto 0;
|
19
|
-
}
|
20
|
-
|
21
|
-
.rails-default-error-page div.dialog > div {
|
22
|
-
border: 1px solid #CCC;
|
23
|
-
border-right-color: #999;
|
24
|
-
border-left-color: #999;
|
25
|
-
border-bottom-color: #BBB;
|
26
|
-
border-top: #B00100 solid 4px;
|
27
|
-
border-top-left-radius: 9px;
|
28
|
-
border-top-right-radius: 9px;
|
29
|
-
background-color: white;
|
30
|
-
padding: 7px 12% 0;
|
31
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
-
}
|
33
|
-
|
34
|
-
.rails-default-error-page h1 {
|
35
|
-
font-size: 100%;
|
36
|
-
color: #730E15;
|
37
|
-
line-height: 1.5em;
|
38
|
-
}
|
39
|
-
|
40
|
-
.rails-default-error-page div.dialog > p {
|
41
|
-
margin: 0 0 1em;
|
42
|
-
padding: 1em;
|
43
|
-
background-color: #F7F7F7;
|
44
|
-
border: 1px solid #CCC;
|
45
|
-
border-right-color: #999;
|
46
|
-
border-left-color: #999;
|
47
|
-
border-bottom-color: #999;
|
48
|
-
border-bottom-left-radius: 4px;
|
49
|
-
border-bottom-right-radius: 4px;
|
50
|
-
border-top-color: #DADADA;
|
51
|
-
color: #666;
|
52
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
-
}
|
54
|
-
</style>
|
55
|
-
</head>
|
56
|
-
|
57
|
-
<body class="rails-default-error-page">
|
58
|
-
<!-- This file lives in public/500.html -->
|
59
|
-
<div class="dialog">
|
60
|
-
<div>
|
61
|
-
<h1>We're sorry, but something went wrong.</h1>
|
62
|
-
</div>
|
63
|
-
<p>If you are the application owner check the logs for more information.</p>
|
64
|
-
</div>
|
65
|
-
</body>
|
66
|
-
</html>
|
File without changes
|
File without changes
|
File without changes
|
Binary file
|
File without changes
|
Binary file
|
Binary file
|
@@ -1,13 +0,0 @@
|
|
1
|
-
<!-- The XML declaration is intentionally omitted. -->
|
2
|
-
<svg width="792px" height="584px" viewBox="0 0 792 584" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
3
|
-
<path d="M9.51802657,28.724593 C9.51802657,18.2155955 18.1343454,9.60822622 28.6542694,9.60822622 L763.245541,9.60822622 C773.765465,9.60822622 782.381784,18.2155955 782.381784,28.724593 L782.381784,584 L792,584 L792,28.724593 C792,12.911054 779.075522,0 763.245541,0 L28.7544592,0 C12.9244782,0 0,12.911054 0,28.724593 L0,584 L9.61821632,584 C9.51802657,584 9.51802657,28.724593 9.51802657,28.724593 L9.51802657,28.724593 Z" id="Shape" opacity="0.3" fill="#CCCCCC"></path>
|
4
|
-
<circle id="Oval" fill="#FFCC33" cx="119.1" cy="147.2" r="33"></circle>
|
5
|
-
<circle id="Oval" fill="#3399FF" cx="119.1" cy="281.1" r="33"></circle>
|
6
|
-
<circle id="Oval" fill="#FF3333" cx="676.1" cy="376.8" r="33"></circle>
|
7
|
-
<circle id="Oval" fill="#FFCC33" cx="119.1" cy="477.2" r="33"></circle>
|
8
|
-
<rect id="Rectangle-path" opacity="0.75" fill="#CCCCCC" x="176.5" y="130.5" width="442.1" height="33.5"></rect>
|
9
|
-
<rect id="Rectangle-path" opacity="0.75" fill="#CCCCCC" x="176.5" y="183.1" width="442.1" height="33.5"></rect>
|
10
|
-
<rect id="Rectangle-path" opacity="0.75" fill="#CCCCCC" x="176.5" y="265.8" width="442.1" height="33.5"></rect>
|
11
|
-
<rect id="Rectangle-path" opacity="0.75" fill="#CCCCCC" x="176.5" y="363.4" width="442.1" height="33.5"></rect>
|
12
|
-
<rect id="Rectangle-path" opacity="0.75" fill="#CCCCCC" x="176.5" y="465.3" width="442.1" height="33.5"></rect>
|
13
|
-
</svg>
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,107 +0,0 @@
|
|
1
|
-
if RUBY_VERSION > '2.2.2'
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
AS_TAG = "active_storage_" + SUFFIX
|
5
|
-
BASENAME = File.basename(TEST_IMG, '.*')
|
6
|
-
|
7
|
-
CONFIGURATION_PATH = Pathname.new(File.expand_path("service/configurations.yml", __dir__))
|
8
|
-
SERVICE = ActiveStorage::Service.configure(:cloudinary, SERVICE_CONFIGURATIONS)
|
9
|
-
|
10
|
-
TEST_IMG_PATH = Pathname.new(TEST_IMG)
|
11
|
-
TEST_VIDEO_PATH = Pathname.new(TEST_VIDEO)
|
12
|
-
TEST_RAW_PATH = Pathname.new(TEST_RAW)
|
13
|
-
|
14
|
-
describe 'active_storage' do
|
15
|
-
let(:key) {ActiveStorage::BlobKey.new({key: SecureRandom.base58(24), filename: BASENAME})}
|
16
|
-
|
17
|
-
before :all do
|
18
|
-
@key = ActiveStorage::BlobKey.new key: SecureRandom.base58(24), filename: BASENAME
|
19
|
-
@service = self.class.const_get(:SERVICE)
|
20
|
-
@service.upload @key, TEST_IMG_PATH, tags: [TEST_TAG, TIMESTAMP_TAG, AS_TAG]
|
21
|
-
end
|
22
|
-
|
23
|
-
after :all do
|
24
|
-
Cloudinary::Api.delete_resources_by_tag AS_TAG
|
25
|
-
end
|
26
|
-
|
27
|
-
describe :url_for_direct_upload do
|
28
|
-
it "should use the key" do
|
29
|
-
key = SecureRandom.base58(24)
|
30
|
-
url = @service.url_for_direct_upload(key)
|
31
|
-
expect(url).not_to include(BASENAME)
|
32
|
-
expect(url).to include("public_id=#{key}")
|
33
|
-
end
|
34
|
-
it "should include the key in a context field" do
|
35
|
-
key = SecureRandom.base58(24)
|
36
|
-
url = @service.url_for_direct_upload(key)
|
37
|
-
expect(url).to include("context=active_storage_key%3D#{key}")
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should support uploading to Cloudinary" do
|
42
|
-
url = @service.url_for_direct_upload(key, tags: [TEST_TAG, TIMESTAMP_TAG, AS_TAG])
|
43
|
-
uri = URI.parse url
|
44
|
-
request = Net::HTTP::Put.new uri.request_uri
|
45
|
-
file = File.open(TEST_IMG)
|
46
|
-
request.body_stream = file
|
47
|
-
request['content-length'] = file.size
|
48
|
-
request['content-type'] = 'image/png'
|
49
|
-
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
|
50
|
-
http.request request
|
51
|
-
end
|
52
|
-
result = Cloudinary::Utils.json_decode(response.body)
|
53
|
-
expect(result['error']).not_to be_truthy
|
54
|
-
#Same test as uploader_spec "should successfully upload file"
|
55
|
-
expect(result["width"]).to eq(TEST_IMG_W)
|
56
|
-
expect(result["height"]).to eq(TEST_IMG_H)
|
57
|
-
expected_signature = Cloudinary::Utils.api_sign_request({:public_id => result["public_id"], :version => result["version"]}, Cloudinary.config.api_secret)
|
58
|
-
expect(result["signature"]).to eq(expected_signature)
|
59
|
-
end
|
60
|
-
|
61
|
-
it "should check if resource exists" do
|
62
|
-
expect(@service.exist?(@key)).to be_truthy
|
63
|
-
expect(@service.exist?(@key + "nonsense")).to be_falsey
|
64
|
-
end
|
65
|
-
|
66
|
-
it "should delete a resource" do
|
67
|
-
@service.delete @key
|
68
|
-
expect(@service.exist?(@key)).to be_falsey
|
69
|
-
end
|
70
|
-
|
71
|
-
it "should fail to delete nonexistent key" do
|
72
|
-
expect {@service.delete SecureRandom.base58(24)}.not_to raise_error
|
73
|
-
end
|
74
|
-
|
75
|
-
it "should support transformations" do
|
76
|
-
url = @service.url(@key, crop: 'scale', width: 100)
|
77
|
-
expect(url).to match(/c_scale,w_100/)
|
78
|
-
end
|
79
|
-
|
80
|
-
it "should use global configuration options" do
|
81
|
-
tags = SERVICE_CONFIGURATIONS[:cloudinary][:tags]
|
82
|
-
expect(tags).not_to be_empty, "Please set a tags value under cloudinary in #{CONFIGURATION_PATH}"
|
83
|
-
expect(Cloudinary::Uploader).to receive(:upload).with(TEST_IMG, hash_including(tags: tags))
|
84
|
-
@service.upload(key, TEST_IMG, tags: tags)
|
85
|
-
end
|
86
|
-
|
87
|
-
it "should accept options that override global configuration" do
|
88
|
-
tags = SERVICE_CONFIGURATIONS[:cloudinary][:tags]
|
89
|
-
expect(tags).not_to be_empty, "Please set a tags value under cloudinary in #{CONFIGURATION_PATH}"
|
90
|
-
override_tags = [TEST_TAG, TIMESTAMP_TAG, AS_TAG]
|
91
|
-
expect(override_tags).not_to eql(tags), "Overriding tags should be different from configuration"
|
92
|
-
expect(Cloudinary::Uploader).to receive(:upload).with(TEST_IMG, hash_including(tags: override_tags))
|
93
|
-
@service.upload(key, TEST_IMG, tags: override_tags)
|
94
|
-
end
|
95
|
-
|
96
|
-
it "should correctly identify resource_type" do
|
97
|
-
expect(Cloudinary::Uploader).to receive(:upload).with(TEST_IMG_PATH, hash_including(resource_type: 'image'))
|
98
|
-
@service.upload(key, TEST_IMG_PATH)
|
99
|
-
|
100
|
-
expect(Cloudinary::Uploader).to receive(:upload).with(TEST_VIDEO_PATH, hash_including(resource_type: 'video'))
|
101
|
-
@service.upload(key, TEST_VIDEO_PATH)
|
102
|
-
|
103
|
-
expect(Cloudinary::Uploader).to receive(:upload).with(TEST_RAW_PATH, hash_including(resource_type: 'raw'))
|
104
|
-
@service.upload(key, TEST_RAW_PATH)
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|