uploadcare-rails 3.2.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/uploadcare/rails/api/rest/base.rb +3 -2
- data/lib/uploadcare/rails/api/upload/base.rb +2 -0
- data/lib/uploadcare/rails/configuration.rb +3 -1
- data/lib/uploadcare/rails/transformations/image_transformations.rb +1 -1
- data/lib/uploadcare/rails/version.rb +1 -1
- metadata +28 -139
- data/spec/fixtures/kitten.jpeg +0 -0
- data/spec/fixtures/vcr_cassettes/conversion_api_convert_document.yml +0 -62
- data/spec/fixtures/vcr_cassettes/conversion_api_convert_document_with_error.yml +0 -62
- data/spec/fixtures/vcr_cassettes/conversion_api_convert_video.yml +0 -62
- data/spec/fixtures/vcr_cassettes/conversion_api_convert_video_with_error.yml +0 -62
- data/spec/fixtures/vcr_cassettes/conversion_api_get_document_conversion_status.yml +0 -59
- data/spec/fixtures/vcr_cassettes/conversion_api_get_video_conversion_status.yml +0 -59
- data/spec/fixtures/vcr_cassettes/file_api_copy_file.yml +0 -60
- data/spec/fixtures/vcr_cassettes/file_api_delete_file.yml +0 -61
- data/spec/fixtures/vcr_cassettes/file_api_delete_files.yml +0 -58
- data/spec/fixtures/vcr_cassettes/file_api_get_file.yml +0 -61
- data/spec/fixtures/vcr_cassettes/file_api_get_files.yml +0 -61
- data/spec/fixtures/vcr_cassettes/file_api_load_file.yml +0 -57
- data/spec/fixtures/vcr_cassettes/file_api_store_file.yml +0 -61
- data/spec/fixtures/vcr_cassettes/file_api_store_files.yml +0 -57
- data/spec/fixtures/vcr_cassettes/group_api_create_group.yml +0 -61
- data/spec/fixtures/vcr_cassettes/group_api_get_group.yml +0 -56
- data/spec/fixtures/vcr_cassettes/group_api_get_groups.yml +0 -57
- data/spec/fixtures/vcr_cassettes/group_api_store_group.yml +0 -177
- data/spec/fixtures/vcr_cassettes/project_api_get_project.yml +0 -59
- data/spec/fixtures/vcr_cassettes/upload_upload_many_files.yml +0 -59
- data/spec/fixtures/vcr_cassettes/upload_upload_one_file.yml +0 -105
- data/spec/fixtures/vcr_cassettes/upload_upload_one_file_from_cdn.yml +0 -111
- data/spec/fixtures/vcr_cassettes/webhook_api_create_webhook.yml +0 -59
- data/spec/fixtures/vcr_cassettes/webhook_api_delete_webhook.yml +0 -59
- data/spec/fixtures/vcr_cassettes/webhook_api_get_webhooks.yml +0 -59
- data/spec/fixtures/vcr_cassettes/webhook_api_update_webhook.yml +0 -59
- data/spec/generators/uploadcare_config_generator_spec.rb +0 -31
- data/spec/spec_helper.rb +0 -27
- data/spec/support/generators.rb +0 -41
- data/spec/support/vcr.rb +0 -14
- data/spec/uploadcare/rails/action_view/uploadcare_uploader_tags_spec.rb +0 -40
- data/spec/uploadcare/rails/action_view/uploadcare_widget_tags_spec.rb +0 -46
- data/spec/uploadcare/rails/active_record/mount_uploadcare_file_spec.rb +0 -33
- data/spec/uploadcare/rails/active_record/mount_uploadcare_group_spec.rb +0 -32
- data/spec/uploadcare/rails/api/rest/conversion_api_spec.rb +0 -110
- data/spec/uploadcare/rails/api/rest/file_api_spec.rb +0 -76
- data/spec/uploadcare/rails/api/rest/group_api_spec.rb +0 -61
- data/spec/uploadcare/rails/api/rest/project_api_spec.rb +0 -33
- data/spec/uploadcare/rails/api/rest/webhook_api_spec.rb +0 -67
- data/spec/uploadcare/rails/api/upload/upload_api_spec.rb +0 -82
- data/spec/uploadcare/rails/jobs/delete_file_job_spec.rb +0 -15
- data/spec/uploadcare/rails/jobs/store_file_job_spec.rb +0 -15
- data/spec/uploadcare/rails/jobs/store_group_job_spec.rb +0 -15
- data/spec/uploadcare/rails/objects/file_spec.rb +0 -77
- data/spec/uploadcare/rails/objects/group_spec.rb +0 -65
- data/spec/uploadcare/rails/services/id_extractor_spec.rb +0 -26
- data/spec/uploadcare/rails/transformations/image_transformations_spec.rb +0 -120
- data/spec/uploadcare/rails_spec.rb +0 -7
@@ -1,120 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
require 'uploadcare/rails/transformations/image_transformations'
|
5
|
-
|
6
|
-
describe Uploadcare::Rails::Transformations::ImageTransformations do
|
7
|
-
subject { described_class.new(**arguments).call }
|
8
|
-
|
9
|
-
let(:arguments) do
|
10
|
-
{
|
11
|
-
# Resize and crop
|
12
|
-
preview: '300x500',
|
13
|
-
resize: '300x500',
|
14
|
-
smart_resize: '300x500',
|
15
|
-
crop: {
|
16
|
-
dimensions: '300x500',
|
17
|
-
coords: '2400,700',
|
18
|
-
alignment: 'center'
|
19
|
-
},
|
20
|
-
scale_crop: {
|
21
|
-
dimensions: '300x500',
|
22
|
-
offsets: '50%,50%',
|
23
|
-
smart_mode: 'smart'
|
24
|
-
},
|
25
|
-
setfill: 'ece3d2',
|
26
|
-
# Compression
|
27
|
-
format: 'png',
|
28
|
-
quality: 'smart',
|
29
|
-
progressive: 'yes',
|
30
|
-
gif2video: true,
|
31
|
-
# Colors
|
32
|
-
brightness: '50',
|
33
|
-
exposure: '50',
|
34
|
-
gamma: '50',
|
35
|
-
contrast: '50',
|
36
|
-
saturation: '50',
|
37
|
-
vibrance: '50',
|
38
|
-
warmth: '50',
|
39
|
-
enhance: '50',
|
40
|
-
grayscale: true,
|
41
|
-
invert: true,
|
42
|
-
filter: {
|
43
|
-
name: 'adaris',
|
44
|
-
amount: 50
|
45
|
-
},
|
46
|
-
srgb: 'fast',
|
47
|
-
max_icc_size: 2,
|
48
|
-
# Blur and sharpen
|
49
|
-
blur: {
|
50
|
-
strength: 50,
|
51
|
-
amount: 90
|
52
|
-
},
|
53
|
-
blur_region: {
|
54
|
-
dimensions: '300x500',
|
55
|
-
coords: '2400,700',
|
56
|
-
strength: 50
|
57
|
-
},
|
58
|
-
sharp: 50,
|
59
|
-
# Overlay
|
60
|
-
overlay: {
|
61
|
-
uuid: 'self',
|
62
|
-
relative_dimensions: '50%x50%',
|
63
|
-
relative_coordinates: 'center',
|
64
|
-
opacity: '20p'
|
65
|
-
},
|
66
|
-
# Rotate and flip
|
67
|
-
autorotate: 'yes',
|
68
|
-
rotate: 90,
|
69
|
-
flip: true,
|
70
|
-
mirror: true
|
71
|
-
}
|
72
|
-
end
|
73
|
-
let(:expected_string) do
|
74
|
-
"/preview/#{arguments[:preview]}/-" \
|
75
|
-
"/resize/#{arguments[:resize]}/-" \
|
76
|
-
"/smart_resize/#{arguments[:smart_resize]}/-" \
|
77
|
-
"/crop/#{arguments[:crop].values.join('/')}/-" \
|
78
|
-
"/scale_crop/#{arguments[:scale_crop].values.join('/')}/-" \
|
79
|
-
"/setfill/#{arguments[:setfill]}/-" \
|
80
|
-
"/format/#{arguments[:format]}/-" \
|
81
|
-
"/quality/#{arguments[:quality]}/-" \
|
82
|
-
"/progressive/#{arguments[:progressive]}/-" \
|
83
|
-
'/gif2video/-' \
|
84
|
-
"/brightness/#{arguments[:brightness]}/-" \
|
85
|
-
"/exposure/#{arguments[:exposure]}/-" \
|
86
|
-
"/gamma/#{arguments[:gamma]}/-" \
|
87
|
-
"/contrast/#{arguments[:contrast]}/-" \
|
88
|
-
"/saturation/#{arguments[:saturation]}/-" \
|
89
|
-
"/vibrance/#{arguments[:vibrance]}/-" \
|
90
|
-
"/warmth/#{arguments[:warmth]}/-" \
|
91
|
-
"/enhance/#{arguments[:enhance]}/-" \
|
92
|
-
'/grayscale/-' \
|
93
|
-
'/invert/-' \
|
94
|
-
"/filter/#{arguments[:filter].values.join('/')}/-" \
|
95
|
-
"/srgb/#{arguments[:srgb]}/-" \
|
96
|
-
"/max_icc_size/#{arguments[:max_icc_size]}/-" \
|
97
|
-
"/blur/#{arguments[:blur].values.join('/')}/-" \
|
98
|
-
"/blur_region/#{arguments[:blur_region].values.join('/')}/-" \
|
99
|
-
"/sharp/#{arguments[:sharp]}/-" \
|
100
|
-
"/overlay/#{arguments[:overlay].values.join('/')}/-" \
|
101
|
-
"/autorotate/#{arguments[:autorotate]}/-" \
|
102
|
-
"/rotate/#{arguments[:rotate]}/-" \
|
103
|
-
'/flip/-' \
|
104
|
-
'/mirror/'
|
105
|
-
end
|
106
|
-
|
107
|
-
it 'builds image transformations params url' do
|
108
|
-
expect(subject).to eq expected_string
|
109
|
-
end
|
110
|
-
|
111
|
-
context 'when sending invalid data' do
|
112
|
-
context 'and when including spaces in params' do
|
113
|
-
let(:arguments) { { preview: '300x 500' } }
|
114
|
-
|
115
|
-
it 'removes all spaces from the result string' do
|
116
|
-
expect(subject).not_to match(/\s/)
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|