uploadcare-rails 1.2.0.pre.alpha3 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +5 -16
- data/lib/generators/templates/uploadcare_config_template.erb +138 -0
- data/lib/generators/uploadcare_config_generator.rb +7 -4
- data/lib/uploadcare/errors/type_error.rb +7 -0
- data/lib/uploadcare/rails/action_view/uploadcare_include_tags.rb +48 -0
- data/lib/uploadcare/rails/action_view/uploadcare_uploader_tags.rb +57 -0
- data/lib/uploadcare/rails/active_record/mount_uploadcare_file.rb +62 -0
- data/lib/uploadcare/rails/active_record/mount_uploadcare_file_group.rb +58 -0
- data/lib/uploadcare/rails/api/rest/base.rb +14 -0
- data/lib/uploadcare/rails/api/rest/conversion_api.rb +42 -0
- data/lib/uploadcare/rails/api/rest/file_api.rb +69 -0
- data/lib/uploadcare/rails/api/rest/group_api.rb +48 -0
- data/lib/uploadcare/rails/api/rest/project_api.rb +27 -0
- data/lib/uploadcare/rails/api/rest/webhook_api.rb +45 -0
- data/lib/uploadcare/rails/api/upload/base.rb +13 -0
- data/lib/uploadcare/rails/api/upload/upload_api.rb +53 -0
- data/lib/uploadcare/rails/configuration.rb +57 -0
- data/lib/uploadcare/rails/engine.rb +13 -17
- data/lib/uploadcare/rails/jobs/delete_file_job.rb +14 -0
- data/lib/uploadcare/rails/jobs/store_file_job.rb +14 -0
- data/lib/uploadcare/rails/jobs/store_group_job.rb +14 -0
- data/lib/uploadcare/rails/objects/concerns/loadable.rb +46 -0
- data/lib/uploadcare/rails/objects/file.rb +40 -20
- data/lib/uploadcare/rails/objects/group.rb +51 -57
- data/lib/uploadcare/rails/services/files_count_extractor.rb +14 -0
- data/lib/uploadcare/rails/services/id_extractor.rb +15 -0
- data/lib/uploadcare/rails/transformations/image_transformations.rb +45 -0
- data/lib/uploadcare/rails/version.rb +3 -1
- data/lib/uploadcare/rails.rb +10 -0
- data/lib/uploadcare-rails.rb +27 -16
- data/spec/fixtures/kitten.jpeg +0 -0
- data/spec/fixtures/vcr_cassettes/conversion_api_convert_document.yml +62 -0
- data/spec/fixtures/vcr_cassettes/conversion_api_convert_document_with_error.yml +62 -0
- data/spec/fixtures/vcr_cassettes/conversion_api_convert_video.yml +62 -0
- data/spec/fixtures/vcr_cassettes/conversion_api_convert_video_with_error.yml +62 -0
- data/spec/fixtures/vcr_cassettes/conversion_api_get_document_conversion_status.yml +59 -0
- data/spec/fixtures/vcr_cassettes/conversion_api_get_video_conversion_status.yml +59 -0
- data/spec/fixtures/vcr_cassettes/file_api_copy_file.yml +60 -0
- data/spec/fixtures/vcr_cassettes/file_api_delete_file.yml +58 -0
- data/spec/fixtures/vcr_cassettes/file_api_delete_files.yml +58 -0
- data/spec/fixtures/vcr_cassettes/file_api_get_file.yml +58 -0
- data/spec/fixtures/vcr_cassettes/file_api_get_files.yml +61 -0
- data/spec/fixtures/vcr_cassettes/file_api_load_file.yml +57 -0
- data/spec/fixtures/vcr_cassettes/file_api_store_file.yml +58 -0
- data/spec/fixtures/vcr_cassettes/file_api_store_files.yml +57 -0
- data/spec/fixtures/vcr_cassettes/group_api_create_group.yml +57 -0
- data/spec/fixtures/vcr_cassettes/group_api_get_group.yml +52 -0
- data/spec/fixtures/vcr_cassettes/group_api_get_groups.yml +57 -0
- data/spec/fixtures/vcr_cassettes/group_api_store_group.yml +57 -0
- data/spec/fixtures/vcr_cassettes/project_api_get_project.yml +59 -0
- data/spec/fixtures/vcr_cassettes/upload_upload_many_files.yml +55 -0
- data/spec/fixtures/vcr_cassettes/upload_upload_one_file.yml +105 -0
- data/spec/fixtures/vcr_cassettes/upload_upload_one_file_from_cdn.yml +111 -0
- data/spec/fixtures/vcr_cassettes/webhook_api_create_webhook.yml +59 -0
- data/spec/fixtures/vcr_cassettes/webhook_api_delete_webhook.yml +57 -0
- data/spec/fixtures/vcr_cassettes/webhook_api_get_webhooks.yml +59 -0
- data/spec/fixtures/vcr_cassettes/webhook_api_update_webhook.yml +59 -0
- data/spec/generators/uploadcare_config_generator_spec.rb +18 -26
- data/spec/spec_helper.rb +17 -62
- data/spec/support/generators.rb +8 -5
- data/spec/support/vcr.rb +14 -0
- data/spec/uploadcare/rails/action_view/uploadcare_uploader_tags_spec.rb +40 -0
- data/spec/uploadcare/rails/action_view/uploadcare_widget_tags_spec.rb +46 -0
- data/spec/uploadcare/rails/active_record/mount_uploadcare_file_spec.rb +33 -0
- data/spec/uploadcare/rails/active_record/mount_uploadcare_group_spec.rb +32 -0
- data/spec/uploadcare/rails/api/rest/conversion_api_spec.rb +110 -0
- data/spec/uploadcare/rails/api/rest/file_api_spec.rb +85 -0
- data/spec/uploadcare/rails/api/rest/group_api_spec.rb +61 -0
- data/spec/uploadcare/rails/api/rest/project_api_spec.rb +33 -0
- data/spec/uploadcare/rails/api/rest/webhook_api_spec.rb +67 -0
- data/spec/uploadcare/rails/api/upload/upload_api_spec.rb +82 -0
- data/spec/uploadcare/rails/jobs/delete_file_job_spec.rb +15 -0
- data/spec/uploadcare/rails/jobs/store_file_job_spec.rb +15 -0
- data/spec/uploadcare/rails/jobs/store_group_job_spec.rb +15 -0
- data/spec/uploadcare/rails/objects/file_spec.rb +77 -0
- data/spec/uploadcare/rails/objects/group_spec.rb +87 -0
- data/spec/uploadcare/rails/services/id_extractor_spec.rb +26 -0
- data/spec/uploadcare/rails/transformations/image_transformations_spec.rb +120 -0
- data/spec/uploadcare/rails_spec.rb +7 -0
- metadata +129 -393
- data/config/initializers/uploadcare.rb +0 -26
- data/config/uploadcare_defaults.yml +0 -12
- data/lib/generators/templates/uploadcare_config_template.yml +0 -71
- data/lib/tasks/uploadcare_rails_tasks.rake +0 -4
- data/lib/uploadcare/rails/action_view/include_tags.rb +0 -47
- data/lib/uploadcare/rails/action_view/uploader_tags.rb +0 -76
- data/lib/uploadcare/rails/active_record/has_file.rb +0 -89
- data/lib/uploadcare/rails/active_record/has_group.rb +0 -84
- data/lib/uploadcare/rails/active_record/has_object.rb +0 -9
- data/lib/uploadcare/rails/formtastic/formtastic.rb +0 -73
- data/lib/uploadcare/rails/operations.rb +0 -57
- data/lib/uploadcare/rails/settings.rb +0 -81
- data/lib/uploadcare/rails/simple_form/simple_form.rb +0 -63
- data/spec/caching/file_caching_spec.rb +0 -26
- data/spec/caching/group_caching_spec.rb +0 -40
- data/spec/cassettes/Uploadcare_Rails_File/should_load_itself.yml +0 -263
- data/spec/cassettes/Uploadcare_Rails_Group/group_should_stay_loaded.yml +0 -263
- data/spec/cassettes/Uploadcare_Rails_Group/rails_cache_should_updates_after_load_call.yml +0 -263
- data/spec/cassettes/group_cahsing_file_load.yml +0 -263
- data/spec/cassettes/has_uploadcare_file/object_with_uploadcare_file/deletes_file_after_destroy.yml +0 -1763
- data/spec/cassettes/has_uploadcare_file/object_with_uploadcare_file/stores_file_after_save.yml +0 -543
- data/spec/cassettes/has_uploadcare_group/object_attachment/contains_files_inside.yml +0 -679
- data/spec/cassettes/has_uploadcare_group_save.yml +0 -705
- data/spec/cassettes/load_group.yml +0 -263
- data/spec/dummy/README.rdoc +0 -28
- data/spec/dummy/Rakefile +0 -6
- data/spec/dummy/app/assets/javascripts/application.js +0 -13
- data/spec/dummy/app/assets/javascripts/post_with_collections.js +0 -2
- data/spec/dummy/app/assets/javascripts/posts.js +0 -2
- data/spec/dummy/app/assets/javascripts/posts_with_collection_and_files.js +0 -2
- data/spec/dummy/app/assets/stylesheets/application.css +0 -13
- data/spec/dummy/app/assets/stylesheets/post_with_collections.css +0 -4
- data/spec/dummy/app/assets/stylesheets/posts.css +0 -4
- data/spec/dummy/app/assets/stylesheets/posts_with_collection_and_files.css +0 -4
- data/spec/dummy/app/assets/stylesheets/scaffold.css +0 -56
- data/spec/dummy/app/controllers/application_controller.rb +0 -5
- data/spec/dummy/app/controllers/post_with_collections_controller.rb +0 -58
- data/spec/dummy/app/controllers/posts_controller.rb +0 -58
- data/spec/dummy/app/controllers/posts_with_collection_and_files_controller.rb +0 -58
- data/spec/dummy/app/helpers/application_helper.rb +0 -2
- data/spec/dummy/app/helpers/post_with_collections_helper.rb +0 -2
- data/spec/dummy/app/helpers/posts_helper.rb +0 -2
- data/spec/dummy/app/helpers/posts_with_collection_and_files_helper.rb +0 -2
- data/spec/dummy/app/models/post.rb +0 -3
- data/spec/dummy/app/models/post_with_collection.rb +0 -3
- data/spec/dummy/app/models/posts_with_collection_and_file.rb +0 -4
- data/spec/dummy/app/views/layouts/application.html.erb +0 -16
- data/spec/dummy/app/views/post_with_collections/_form.html.erb +0 -25
- data/spec/dummy/app/views/post_with_collections/edit.html.erb +0 -6
- data/spec/dummy/app/views/post_with_collections/index.html.erb +0 -29
- data/spec/dummy/app/views/post_with_collections/new.html.erb +0 -5
- data/spec/dummy/app/views/post_with_collections/show.html.erb +0 -14
- data/spec/dummy/app/views/post_with_collections/show.json.jbuilder +0 -1
- data/spec/dummy/app/views/posts/_form.html.erb +0 -31
- data/spec/dummy/app/views/posts/edit.html.erb +0 -6
- data/spec/dummy/app/views/posts/index.html.erb +0 -37
- data/spec/dummy/app/views/posts/new.html.erb +0 -5
- data/spec/dummy/app/views/posts/post.json.builder +0 -1
- data/spec/dummy/app/views/posts/show.html.erb +0 -15
- data/spec/dummy/app/views/posts_with_collection_and_files/_form.html.erb +0 -27
- data/spec/dummy/app/views/posts_with_collection_and_files/edit.html.erb +0 -6
- data/spec/dummy/app/views/posts_with_collection_and_files/index.html.erb +0 -25
- data/spec/dummy/app/views/posts_with_collection_and_files/new.html.erb +0 -5
- data/spec/dummy/app/views/posts_with_collection_and_files/show.html.erb +0 -4
- data/spec/dummy/app/views/posts_with_collection_and_files/show.json.jbuilder +0 -1
- data/spec/dummy/bin/bundle +0 -3
- data/spec/dummy/bin/rails +0 -4
- data/spec/dummy/bin/rake +0 -4
- data/spec/dummy/config/application.rb +0 -23
- data/spec/dummy/config/boot.rb +0 -5
- data/spec/dummy/config/database.yml +0 -25
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -29
- data/spec/dummy/config/environments/production.rb +0 -80
- data/spec/dummy/config/environments/test.rb +0 -36
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/dummy/config/initializers/formtastic.rb +0 -111
- data/spec/dummy/config/initializers/inflections.rb +0 -16
- data/spec/dummy/config/initializers/mime_types.rb +0 -5
- data/spec/dummy/config/initializers/secret_token.rb +0 -12
- data/spec/dummy/config/initializers/session_store.rb +0 -3
- data/spec/dummy/config/initializers/simple_form.rb +0 -167
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/locales/en.yml +0 -23
- data/spec/dummy/config/locales/simple_form.en.yml +0 -31
- data/spec/dummy/config/routes.rb +0 -63
- data/spec/dummy/config/uploadcare.yml +0 -68
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/db/migrate/20171012001801_create_tables.rb +0 -27
- data/spec/dummy/db/schema.rb +0 -37
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/templates/erb/scaffold/_form.html.erb +0 -13
- data/spec/dummy/log/development.log +0 -0
- data/spec/dummy/log/test.log +0 -3276
- data/spec/dummy/public/404.html +0 -58
- data/spec/dummy/public/422.html +0 -58
- data/spec/dummy/public/500.html +0 -57
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/tmp/cache/293/091/https%3A%2F%2Fucarecdn.com%2F19073296-2315-4726-817b-46398b2c7431%7E2%2F +0 -0
- data/spec/dummy/tmp/cache/2AF/761/https%3A%2F%2Fucarecdn.com%2F595319d0-a113-459f-91bd-b29c7183467b%2F +0 -0
- data/spec/dummy/tmp/cache/301/D41/https%3A%2F%2Fucarecdn.com%2F81332043-fa2c-452f-936b-737d87ab2ae2%2F +0 -0
- data/spec/dummy/tmp/cache/30A/7C1/https%3A%2F%2Fucarecdn.com%2F39b34128-a001-46fd-9773-1b6ad46e6b9e%2F +0 -0
- data/spec/dummy/tmp/cache/340/A41/https%3A%2F%2Fucarecdn.com%2F090bcb5f-6d19-456c-b4a3-d753e690926f%2F +0 -0
- data/spec/dummy/tmp/cache/3AB/5A1/https%3A%2F%2Fucarecdn.com%2F7eb0161b-cebe-4316-946b-694de6f77ef9%2F +0 -0
- data/spec/dummy/tmp/cache/3FC/5C1/https%3A%2F%2Fucarecdn.com%2Fc3f0464b-ce9a-4281-8eaa-5c55783ccedf%2F +0 -0
- data/spec/dummy/tmp/cache/431/5C1/https%3A%2F%2Fucarecdn.com%2Fa1b1bb40-bd89-4f9c-b809-e84920f24a01%7E2%2F +0 -0
- data/spec/dummy/tmp/cache/44B/7A1/https%3A%2F%2Fucarecdn.com%2Fd6c785a8-9761-4602-88de-65ddb04ddc6a%7E2%2F +0 -0
- data/spec/dummy/tmp/cache/45B/F31/https%3A%2F%2Fucarecdn.com%2F73e3cdbc-6495-4cf2-bbd1-413e6cb70004%7E2%2F +0 -0
- data/spec/dummy/tmp/cache/461/AA1/https%3A%2F%2Fucarecdn.com%2Fc50e9a53-0b95-48ac-a4a9-6744052dbdab%7E2%2F +0 -0
- data/spec/helpers/form_helpers_has_file_spec.rb +0 -30
- data/spec/helpers/form_helpers_has_group_spec.rb +0 -30
- data/spec/helpers/form_helpers_spec.rb +0 -33
- data/spec/helpers/formtastic_spec.rb +0 -25
- data/spec/helpers/include_tags_spec.rb +0 -54
- data/spec/helpers/simple_form_spec.rb +0 -25
- data/spec/helpers/uploader_tags_spec.rb +0 -21
- data/spec/models/has_both_file_and_group_spec.rb +0 -43
- data/spec/models/has_file_spec.rb +0 -46
- data/spec/models/has_group_spec.rb +0 -57
- data/spec/objects/file_spec.rb +0 -27
- data/spec/objects/group_spec.rb +0 -51
- data/spec/operations_spec.rb +0 -28
- data/spec/tmp/config/uploadcare.yml +0 -71
- data/spec/uploadcare/rails/settings_spec.rb +0 -136
- data/spec/uploadcare_rails_settings_spec.rb +0 -56
- data/spec/view.png +0 -0
- data/spec/view2.jpg +0 -0
data/spec/dummy/public/404.html
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
-
<style>
|
6
|
-
body {
|
7
|
-
background-color: #EFEFEF;
|
8
|
-
color: #2E2F30;
|
9
|
-
text-align: center;
|
10
|
-
font-family: arial, sans-serif;
|
11
|
-
}
|
12
|
-
|
13
|
-
div.dialog {
|
14
|
-
width: 25em;
|
15
|
-
margin: 4em auto 0 auto;
|
16
|
-
border: 1px solid #CCC;
|
17
|
-
border-right-color: #999;
|
18
|
-
border-left-color: #999;
|
19
|
-
border-bottom-color: #BBB;
|
20
|
-
border-top: #B00100 solid 4px;
|
21
|
-
border-top-left-radius: 9px;
|
22
|
-
border-top-right-radius: 9px;
|
23
|
-
background-color: white;
|
24
|
-
padding: 7px 4em 0 4em;
|
25
|
-
}
|
26
|
-
|
27
|
-
h1 {
|
28
|
-
font-size: 100%;
|
29
|
-
color: #730E15;
|
30
|
-
line-height: 1.5em;
|
31
|
-
}
|
32
|
-
|
33
|
-
body > p {
|
34
|
-
width: 33em;
|
35
|
-
margin: 0 auto 1em;
|
36
|
-
padding: 1em 0;
|
37
|
-
background-color: #F7F7F7;
|
38
|
-
border: 1px solid #CCC;
|
39
|
-
border-right-color: #999;
|
40
|
-
border-bottom-color: #999;
|
41
|
-
border-bottom-left-radius: 4px;
|
42
|
-
border-bottom-right-radius: 4px;
|
43
|
-
border-top-color: #DADADA;
|
44
|
-
color: #666;
|
45
|
-
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
-
}
|
47
|
-
</style>
|
48
|
-
</head>
|
49
|
-
|
50
|
-
<body>
|
51
|
-
<!-- This file lives in public/404.html -->
|
52
|
-
<div class="dialog">
|
53
|
-
<h1>The page you were looking for doesn't exist.</h1>
|
54
|
-
<p>You may have mistyped the address or the page may have moved.</p>
|
55
|
-
</div>
|
56
|
-
<p>If you are the application owner check the logs for more information.</p>
|
57
|
-
</body>
|
58
|
-
</html>
|
data/spec/dummy/public/422.html
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The change you wanted was rejected (422)</title>
|
5
|
-
<style>
|
6
|
-
body {
|
7
|
-
background-color: #EFEFEF;
|
8
|
-
color: #2E2F30;
|
9
|
-
text-align: center;
|
10
|
-
font-family: arial, sans-serif;
|
11
|
-
}
|
12
|
-
|
13
|
-
div.dialog {
|
14
|
-
width: 25em;
|
15
|
-
margin: 4em auto 0 auto;
|
16
|
-
border: 1px solid #CCC;
|
17
|
-
border-right-color: #999;
|
18
|
-
border-left-color: #999;
|
19
|
-
border-bottom-color: #BBB;
|
20
|
-
border-top: #B00100 solid 4px;
|
21
|
-
border-top-left-radius: 9px;
|
22
|
-
border-top-right-radius: 9px;
|
23
|
-
background-color: white;
|
24
|
-
padding: 7px 4em 0 4em;
|
25
|
-
}
|
26
|
-
|
27
|
-
h1 {
|
28
|
-
font-size: 100%;
|
29
|
-
color: #730E15;
|
30
|
-
line-height: 1.5em;
|
31
|
-
}
|
32
|
-
|
33
|
-
body > p {
|
34
|
-
width: 33em;
|
35
|
-
margin: 0 auto 1em;
|
36
|
-
padding: 1em 0;
|
37
|
-
background-color: #F7F7F7;
|
38
|
-
border: 1px solid #CCC;
|
39
|
-
border-right-color: #999;
|
40
|
-
border-bottom-color: #999;
|
41
|
-
border-bottom-left-radius: 4px;
|
42
|
-
border-bottom-right-radius: 4px;
|
43
|
-
border-top-color: #DADADA;
|
44
|
-
color: #666;
|
45
|
-
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
-
}
|
47
|
-
</style>
|
48
|
-
</head>
|
49
|
-
|
50
|
-
<body>
|
51
|
-
<!-- This file lives in public/422.html -->
|
52
|
-
<div class="dialog">
|
53
|
-
<h1>The change you wanted was rejected.</h1>
|
54
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
55
|
-
</div>
|
56
|
-
<p>If you are the application owner check the logs for more information.</p>
|
57
|
-
</body>
|
58
|
-
</html>
|
data/spec/dummy/public/500.html
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>We're sorry, but something went wrong (500)</title>
|
5
|
-
<style>
|
6
|
-
body {
|
7
|
-
background-color: #EFEFEF;
|
8
|
-
color: #2E2F30;
|
9
|
-
text-align: center;
|
10
|
-
font-family: arial, sans-serif;
|
11
|
-
}
|
12
|
-
|
13
|
-
div.dialog {
|
14
|
-
width: 25em;
|
15
|
-
margin: 4em auto 0 auto;
|
16
|
-
border: 1px solid #CCC;
|
17
|
-
border-right-color: #999;
|
18
|
-
border-left-color: #999;
|
19
|
-
border-bottom-color: #BBB;
|
20
|
-
border-top: #B00100 solid 4px;
|
21
|
-
border-top-left-radius: 9px;
|
22
|
-
border-top-right-radius: 9px;
|
23
|
-
background-color: white;
|
24
|
-
padding: 7px 4em 0 4em;
|
25
|
-
}
|
26
|
-
|
27
|
-
h1 {
|
28
|
-
font-size: 100%;
|
29
|
-
color: #730E15;
|
30
|
-
line-height: 1.5em;
|
31
|
-
}
|
32
|
-
|
33
|
-
body > p {
|
34
|
-
width: 33em;
|
35
|
-
margin: 0 auto 1em;
|
36
|
-
padding: 1em 0;
|
37
|
-
background-color: #F7F7F7;
|
38
|
-
border: 1px solid #CCC;
|
39
|
-
border-right-color: #999;
|
40
|
-
border-bottom-color: #999;
|
41
|
-
border-bottom-left-radius: 4px;
|
42
|
-
border-bottom-right-radius: 4px;
|
43
|
-
border-top-color: #DADADA;
|
44
|
-
color: #666;
|
45
|
-
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
-
}
|
47
|
-
</style>
|
48
|
-
</head>
|
49
|
-
|
50
|
-
<body>
|
51
|
-
<!-- This file lives in public/500.html -->
|
52
|
-
<div class="dialog">
|
53
|
-
<h1>We're sorry, but something went wrong.</h1>
|
54
|
-
</div>
|
55
|
-
<p>If you are the application owner check the logs for more information.</p>
|
56
|
-
</body>
|
57
|
-
</html>
|
File without changes
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Uploadcare::Rails::ActionView::FormBuilder, type: :helper do
|
4
|
-
before :each do
|
5
|
-
@post = Post.new
|
6
|
-
@form = ActionView::Helpers::FormBuilder.new(:post, @post, helper, {})
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should include uploader tag for name" do
|
10
|
-
# not that post has uc file
|
11
|
-
tag = @form.uploadcare_field :file
|
12
|
-
tag.should be_kind_of(String)
|
13
|
-
expect(tag).to have_selector('input[type="hidden"][data-multiple="false"]', visible: :all)
|
14
|
-
end
|
15
|
-
|
16
|
-
it "should override uploadcare- attribute" do
|
17
|
-
tag = @form.uploadcare_field :file, :uploadcare => {:multiple => true}
|
18
|
-
expect(tag).to have_selector('input[type="hidden"][data-multiple="false"]', visible: :all)
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should override data- attribute" do
|
22
|
-
tag = @form.uploadcare_field :file, :data => {:multiple => true}
|
23
|
-
expect(tag).to have_selector('input[type="hidden"][data-multiple="false"]', visible: :all)
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should override data- and uploadcare- attributes" do
|
27
|
-
tag = @form.uploadcare_field :file, :data => {:multiple => true}, :uploadcare => {:multiple => true}
|
28
|
-
expect(tag).to have_selector('input[type="hidden"][data-multiple="false"]', visible: :all)
|
29
|
-
end
|
30
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Uploadcare::Rails::ActionView::FormBuilder, type: :helper do
|
4
|
-
before :each do
|
5
|
-
@post = PostWithCollection.new
|
6
|
-
@form = ActionView::Helpers::FormBuilder.new(:post, @post, helper, {})
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should include uploader tag for name" do
|
10
|
-
# not that post has uc file
|
11
|
-
tag = @form.uploadcare_field :file
|
12
|
-
expect(tag).to be_kind_of(String)
|
13
|
-
expect(tag).to have_selector('input[type="hidden"][data-multiple="true"]', visible: :all)
|
14
|
-
end
|
15
|
-
|
16
|
-
it "should override uploadcare- attribute" do
|
17
|
-
tag = @form.uploadcare_field :file, :uploadcare => {:multiple => false}
|
18
|
-
expect(tag).to have_selector('input[type="hidden"][data-multiple="true"]', visible: :all)
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should override data- attribute" do
|
22
|
-
tag = @form.uploadcare_field :file, :data => {:multiple => false}
|
23
|
-
expect(tag).to have_selector('input[type="hidden"][data-multiple="true"]', visible: :all)
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should override data- and uploadcare- attributes" do
|
27
|
-
tag = @form.uploadcare_field :file, :data => {:multiple => false}, :uploadcare => {:multiple => false}
|
28
|
-
expect(tag).to have_selector('input[type="hidden"][data-multiple="true"]', visible: :all)
|
29
|
-
end
|
30
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Uploadcare::Rails::ActionView::FormBuilder, type: :helper do
|
4
|
-
before :each do
|
5
|
-
@post = Post.new
|
6
|
-
@form = ActionView::Helpers::FormBuilder.new(:post, @post, helper, {})
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should include uploader tag for name" do
|
10
|
-
tag = @form.uploadcare_field :file
|
11
|
-
tag.should be_kind_of(String)
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should have role attr" do
|
15
|
-
tag = @form.uploadcare_field :file, :uploadcare => {:multiple => true}
|
16
|
-
expect(tag).to have_selector('input[role="uploadcare-uploader"]', visible: :all)
|
17
|
-
end
|
18
|
-
|
19
|
-
it "should have custom data-attributes" do
|
20
|
-
tag = @form.uploadcare_field :file, :data => {:custom => true}
|
21
|
-
expect(tag).to have_selector('input[data-custom="true"]', visible: :all)
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should have uploadcare namespace translated into data- attributes" do
|
25
|
-
tag = @form.uploadcare_field :file, :uploadcare => {:custom => true}
|
26
|
-
expect(tag).to have_selector('input[data-custom="true"]', visible: :all)
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should override data namespace with uploadcare namespace" do
|
30
|
-
tag = @form.uploadcare_field :file, :uploadcare => {:custom => true}, :data => {:custom => false}
|
31
|
-
expect(tag).to have_selector('input[data-custom="true"]', visible: :all)
|
32
|
-
end
|
33
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "Uploadcare::Rails::Formtastic", type: :helper do
|
4
|
-
before :each do
|
5
|
-
@post = Post.new
|
6
|
-
@form = Formtastic::FormBuilder.new(:post, @post, helper, {})
|
7
|
-
end
|
8
|
-
|
9
|
-
it 'should create smart uploader field' do
|
10
|
-
tag = @form.input :file, as: :uploadcare_uploader
|
11
|
-
expect(tag).to have_selector('input[role="uploadcare-uploader"]', visible: :all)
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'should create single uploader field' do
|
15
|
-
tag = @form.input :file, as: :uploadcare_single_uploader
|
16
|
-
expect(tag)
|
17
|
-
.to have_selector('input[role="uploadcare-uploader"][data-multiple="false"]', visible: :all)
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'should create multiple uploader field' do
|
21
|
-
tag = @form.input :file, as: :uploadcare_multiple_uploader
|
22
|
-
expect(tag)
|
23
|
-
.to have_selector('input[role="uploadcare-uploader"][data-multiple="true"]', visible: :all)
|
24
|
-
end
|
25
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Uploadcare::Rails do
|
4
|
-
it 'includes widget from cdn' do
|
5
|
-
tag = helper.include_uploadcare_widget_from_cdn
|
6
|
-
|
7
|
-
expect(tag).to eq(
|
8
|
-
[
|
9
|
-
"<script src=\"https://ucarecdn.com/libs/widget/",
|
10
|
-
UPLOADCARE_SETTINGS.widget_version,
|
11
|
-
'/uploadcare.min.js"></script>'
|
12
|
-
].join
|
13
|
-
)
|
14
|
-
end
|
15
|
-
|
16
|
-
describe 'for specifyed version' do
|
17
|
-
let(:version) { '0.13.3' }
|
18
|
-
|
19
|
-
it 'uses widget version' do
|
20
|
-
tag = helper.include_uploadcare_widget_from_cdn(version: version)
|
21
|
-
|
22
|
-
expect(tag).to eq(
|
23
|
-
"<script src=\"https://ucarecdn.com/libs/widget/#{ version }/"\
|
24
|
-
'uploadcare.min.js"></script>'
|
25
|
-
)
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'loads not minified version' do
|
29
|
-
tag =
|
30
|
-
helper.include_uploadcare_widget_from_cdn(version: version, min: false)
|
31
|
-
|
32
|
-
expect(tag).to eq(
|
33
|
-
"<script src=\"https://ucarecdn.com/libs/widget/#{ version }/"\
|
34
|
-
'uploadcare.js"></script>'
|
35
|
-
)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe 'uploadcare settings' do
|
40
|
-
let(:subject) { helper.uploadcare_settings }
|
41
|
-
|
42
|
-
it { is_expected.to be_a(String) }
|
43
|
-
it { is_expected.not_to be_empty }
|
44
|
-
%w(
|
45
|
-
UPLOADCARE_LOCALE UPLOADCARE_PREVIEW_STEP
|
46
|
-
UPLOADCARE_PUBLIC_KEY UPLOADCARE_CLEARABLE
|
47
|
-
UPLOADCARE_TABS UPLOADCARE_AUTOSTORE
|
48
|
-
UPLOADCARE_MANUAL_START UPLOADCARE_PATH_VALUE).each do |content|
|
49
|
-
it 'contains expected selector' do
|
50
|
-
is_expected.to have_xpath("//script[text()[contains(.,'UPLOADCARE')]]", visible: :all)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "Uploadcare::Rails::SimpleForm", type: :helper do
|
4
|
-
before :each do
|
5
|
-
@post = Post.new
|
6
|
-
@form = SimpleForm::FormBuilder.new(:post, @post, helper, {})
|
7
|
-
end
|
8
|
-
|
9
|
-
it 'should create smart uploader field' do
|
10
|
-
tag = @form.input :file, as: :uploadcare_uploader
|
11
|
-
expect(tag).to have_selector('input[role="uploadcare-uploader"]', visible: :all)
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'should create single uploader field' do
|
15
|
-
tag = @form.input :file, as: :uploadcare_single_uploader
|
16
|
-
expect(tag)
|
17
|
-
.to have_selector('input[role="uploadcare-uploader"][data-multiple="false"]', visible: :all)
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'should create multiple uploader field' do
|
21
|
-
tag = @form.input :file, as: :uploadcare_multiple_uploader
|
22
|
-
expect(tag)
|
23
|
-
.to have_selector('input[role="uploadcare-uploader"][data-multiple="true"]', visible: :all)
|
24
|
-
end
|
25
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Uploadcare::Rails::ActionView::UploaderTags do
|
4
|
-
let(:expected_selector) do
|
5
|
-
'input[type="hidden"][role="uploadcare-uploader"][data-path-value="true"]'
|
6
|
-
end
|
7
|
-
|
8
|
-
it "should include uploader tag for name" do
|
9
|
-
tag = helper.uploadcare_uploader_tag :file
|
10
|
-
|
11
|
-
expect(tag).to be_kind_of(String)
|
12
|
-
expect(tag).to have_selector(expected_selector, visible: :all)
|
13
|
-
end
|
14
|
-
|
15
|
-
it "should include uploader field for object" do
|
16
|
-
tag = helper.uploadcare_uploader_field :post, :file
|
17
|
-
|
18
|
-
expect(tag).to be_kind_of(String)
|
19
|
-
expect(tag).to have_selector(expected_selector, visible: :all)
|
20
|
-
end
|
21
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe :has_both_file_and_group_spec do
|
4
|
-
let(:subject) do
|
5
|
-
PostsWithCollectionAndFile.new(
|
6
|
-
title: "Post title",
|
7
|
-
group: GROUP_CDN_URL,
|
8
|
-
file: FILE_CDN_URL
|
9
|
-
)
|
10
|
-
end
|
11
|
-
|
12
|
-
after :each do
|
13
|
-
Rails.cache.delete FILE_CDN_URL
|
14
|
-
Rails.cache.delete GROUP_CDN_URL
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'creates empty post' do
|
18
|
-
expect(PostsWithCollectionAndFile.create).to be_persisted
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should respond to has_uploadcare_file? method" do
|
22
|
-
is_expected.to respond_to("has_file_as_uploadcare_file?".to_sym)
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should respond to has_uploadcare_group? method" do
|
26
|
-
is_expected.to respond_to("has_group_as_uploadcare_group?".to_sym)
|
27
|
-
end
|
28
|
-
|
29
|
-
it ":has_uploadcare_file? should return true" do
|
30
|
-
is_expected.to be_has_file_as_uploadcare_file
|
31
|
-
is_expected.to be_has_group_as_uploadcare_group
|
32
|
-
end
|
33
|
-
|
34
|
-
it ":has_uploadcare_group? should return false" do
|
35
|
-
is_expected.not_to be_has_group_as_uploadcare_file
|
36
|
-
is_expected.not_to be_has_file_as_uploadcare_group
|
37
|
-
end
|
38
|
-
|
39
|
-
it "should have uploadcare file" do
|
40
|
-
expect(subject.group).to be_an(Uploadcare::Rails::Group)
|
41
|
-
expect(subject.file).to be_an(Uploadcare::Rails::File)
|
42
|
-
end
|
43
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe :has_uploadcare_file, :vcr do
|
4
|
-
let(:post) { Post.new(title: 'Post title', file: FILE_CDN_URL) }
|
5
|
-
let(:subject) { post }
|
6
|
-
let(:method) { 'file' }
|
7
|
-
|
8
|
-
describe 'object with uploadcare_file' do
|
9
|
-
it 'creates blank post' do
|
10
|
-
Post.create!
|
11
|
-
end
|
12
|
-
it 'responds to has_uploadcare_file? method' do
|
13
|
-
is_expected.to respond_to(:has_file_as_uploadcare_file?)
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'responds to has_uploadcare_group? method' do
|
17
|
-
is_expected.to respond_to(:has_file_as_uploadcare_group?)
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'has Uploadcare::Rails::File' do
|
21
|
-
expect(post.file).to be_an(Uploadcare::Rails::File)
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'stores file after save' do
|
25
|
-
post.save
|
26
|
-
expect(post.file).to be_stored
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'deletes file after destroy',
|
30
|
-
vcr: 'has_upload_care_file_destroy_file' do
|
31
|
-
post.save
|
32
|
-
post.destroy
|
33
|
-
expect(post.file).to be_deleted
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
context 'instanse methods' do
|
38
|
-
it '#has_uploadcare_file? returns true' do
|
39
|
-
expect(post.has_file_as_uploadcare_file?).to be_truthy
|
40
|
-
end
|
41
|
-
|
42
|
-
it '#has_uploadcare_group? returns false' do
|
43
|
-
expect(post.has_file_as_uploadcare_group?).to be_falsey
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe :has_uploadcare_group, :vcr do
|
4
|
-
let(:post) { PostWithCollection.new(title: 'Title', file: GROUP_CDN_URL) }
|
5
|
-
let(:method) { 'file' }
|
6
|
-
|
7
|
-
after :each do
|
8
|
-
Rails.cache.delete(GROUP_CDN_URL)
|
9
|
-
end
|
10
|
-
|
11
|
-
describe 'object with group' do
|
12
|
-
let(:subject) { post }
|
13
|
-
it 'should respond to has_uploadcare_file? method' do
|
14
|
-
is_expected.to respond_to('has_file_as_uploadcare_file?'.to_sym)
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'should respond to has_uploadcare_group? method' do
|
18
|
-
is_expected.to respond_to('has_file_as_uploadcare_group?'.to_sym)
|
19
|
-
end
|
20
|
-
|
21
|
-
it ':has_uploadcare_file? should return true' do
|
22
|
-
is_expected.not_to be_has_file_as_uploadcare_file
|
23
|
-
end
|
24
|
-
|
25
|
-
it ':has_uploadcare_group? should return false' do
|
26
|
-
is_expected.to be_has_file_as_uploadcare_group
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe 'object attachment' do
|
31
|
-
let(:subject) { post.file }
|
32
|
-
|
33
|
-
it 'should have uploadcare file' do
|
34
|
-
is_expected.to be_an(Uploadcare::Rails::Group)
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'dont loads group by default' do
|
38
|
-
is_expected.not_to be_loaded
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'contains files inside' do
|
42
|
-
expect(subject.load.files.last).to be_an(Uploadcare::Rails::File)
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'stores group after save', vcr: { cassette_name: 'has_uploadcare_group_save' } do
|
46
|
-
post.save
|
47
|
-
is_expected.to be_stored
|
48
|
-
end
|
49
|
-
|
50
|
-
skip 'deleteds group after destroy' do
|
51
|
-
post.save
|
52
|
-
post.file.load
|
53
|
-
post.destroy
|
54
|
-
expect(post.file).to be_deleted
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
data/spec/objects/file_spec.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Uploadcare::Rails::File, :vcr do
|
4
|
-
let(:post) { Post.new(title: "Post title", file: FILE_CDN_URL) }
|
5
|
-
let(:file) { post.file }
|
6
|
-
|
7
|
-
after :each do
|
8
|
-
Rails.cache.delete FILE_CDN_URL
|
9
|
-
end
|
10
|
-
|
11
|
-
it "should be Uploadcare::Rails::File" do
|
12
|
-
expect(file).to be_a(Uploadcare::Rails::File)
|
13
|
-
end
|
14
|
-
|
15
|
-
it "should be not loaded by default" do
|
16
|
-
expect(file).not_to be_loaded
|
17
|
-
end
|
18
|
-
|
19
|
-
it "should load itself" do
|
20
|
-
file.load
|
21
|
-
expect(file).to be_loaded
|
22
|
-
end
|
23
|
-
|
24
|
-
it "file should respond to :cdn_url and :to_s methods" do
|
25
|
-
expect(file.to_s).to eq file.cdn_url
|
26
|
-
end
|
27
|
-
end
|
data/spec/objects/group_spec.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Uploadcare::Rails::Group, :vcr do
|
4
|
-
let(:post) { PostWithCollection.new(title: 'Title', file: GROUP_CDN_URL) }
|
5
|
-
let(:group) { post.file }
|
6
|
-
let(:subject) { group }
|
7
|
-
|
8
|
-
describe 'instance' do
|
9
|
-
it 'is Uploadcare::Rails::Gropu' do
|
10
|
-
is_expected.to be_an(Uploadcare::Rails::Group)
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'is not loaded by default' do
|
14
|
-
is_expected.not_to be_loaded
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'responds to :uuid and :to_s methods' do
|
18
|
-
expect(group.to_s).to eq(subject.uuid)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe 'loaded group', vcr: { cassette_name: :load_group} do
|
23
|
-
let(:subject) { group.load }
|
24
|
-
|
25
|
-
it 'loads itself' do
|
26
|
-
is_expected.to be_loaded
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'has files' do
|
30
|
-
expect(subject.files).to be_an(Array)
|
31
|
-
expect(subject.files.sample).to be_an(Uploadcare::Rails::File)
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'loaded group files should be loaded too' do
|
35
|
-
expect(subject.files.sample).to be_loaded
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe 'images workaround' do
|
40
|
-
it 'is an array' do
|
41
|
-
expect(subject.urls).to be_an(Array)
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'builds images url' do
|
45
|
-
allow_any_instance_of(Uploadcare::Api).to receive(:options) { {static_url_base: 'http://example.com'} }
|
46
|
-
expected = "http://example.com/#{ subject.uuid }/nth/0/-/resize/200x200/"
|
47
|
-
|
48
|
-
expect(subject.urls(size: '200x200').first).to eq(expected)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|