kt-paperclip 6.4.0 → 7.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +1 -1
- data/.hound.yml +3 -1057
- data/.rubocop.yml +1059 -1
- data/.travis.yml +5 -5
- data/Appraisals +6 -0
- data/CONTRIBUTING.md +4 -5
- data/Gemfile +2 -2
- data/NEWS +31 -0
- data/README.md +5 -4
- data/features/step_definitions/attachment_steps.rb +11 -1
- data/gemfiles/4.2.gemfile +1 -1
- data/gemfiles/5.0.gemfile +1 -1
- data/gemfiles/5.1.gemfile +1 -1
- data/gemfiles/5.2.gemfile +1 -1
- data/gemfiles/6.0.gemfile +1 -1
- data/gemfiles/6.1.gemfile +21 -0
- data/gemfiles/7.0.gemfile +21 -0
- data/lib/paperclip/attachment.rb +1 -1
- data/lib/paperclip/content_type_detector.rb +9 -5
- data/lib/paperclip/io_adapters/uri_adapter.rb +13 -3
- data/lib/paperclip/storage/filesystem.rb +1 -1
- data/lib/paperclip/storage/fog.rb +1 -1
- data/lib/paperclip/storage/s3.rb +1 -1
- data/lib/paperclip/validators/attachment_content_type_validator.rb +1 -1
- data/lib/paperclip/validators/attachment_file_name_validator.rb +2 -2
- data/lib/paperclip/validators/attachment_presence_validator.rb +1 -1
- data/lib/paperclip/validators/attachment_size_validator.rb +4 -3
- data/lib/paperclip/version.rb +1 -1
- data/lib/paperclip.rb +1 -2
- data/paperclip.gemspec +3 -3
- data/spec/paperclip/content_type_detector_spec.rb +7 -0
- data/spec/paperclip/io_adapters/abstract_adapter_spec.rb +1 -1
- data/spec/paperclip/io_adapters/file_adapter_spec.rb +1 -1
- data/spec/paperclip/io_adapters/uri_adapter_spec.rb +13 -3
- data/spec/paperclip/storage/filesystem_spec.rb +23 -0
- data/spec/paperclip/storage/fog_spec.rb +46 -0
- data/spec/paperclip/storage/s3_spec.rb +13 -0
- data/spec/paperclip/validators_spec.rb +21 -6
- data/spec/support/fixtures/sample.xlsm +0 -0
- metadata +10 -7
@@ -1,6 +1,11 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe Paperclip::Validators do
|
4
|
+
# required to support a range of rubies
|
5
|
+
def error_attribute_names(error)
|
6
|
+
error.try(:attribute_names) || error.keys
|
7
|
+
end
|
8
|
+
|
4
9
|
context "using the helper" do
|
5
10
|
before do
|
6
11
|
rebuild_class
|
@@ -22,7 +27,9 @@ describe Paperclip::Validators do
|
|
22
27
|
it "prevents you from attaching a file that violates that validation" do
|
23
28
|
Dummy.class_eval { validate(:name) { raise "DO NOT RUN THIS" } }
|
24
29
|
dummy = Dummy.new(avatar: File.new(fixture_file("12k.png")))
|
25
|
-
expect(dummy.errors
|
30
|
+
expect(error_attribute_names(dummy.errors)).to match_array(
|
31
|
+
%i[avatar_content_type avatar avatar_file_size]
|
32
|
+
)
|
26
33
|
assert_raises(RuntimeError) { dummy.valid? }
|
27
34
|
end
|
28
35
|
end
|
@@ -47,21 +54,27 @@ describe Paperclip::Validators do
|
|
47
54
|
it "prevents you from attaching a file that violates all of these validations" do
|
48
55
|
Dummy.class_eval { validate(:name) { raise "DO NOT RUN THIS" } }
|
49
56
|
dummy = Dummy.new(avatar: File.new(fixture_file("spaced file.png")))
|
50
|
-
expect(dummy.errors
|
57
|
+
expect(error_attribute_names(dummy.errors)).to match_array(
|
58
|
+
%i[avatar avatar_file_name]
|
59
|
+
)
|
51
60
|
assert_raises(RuntimeError) { dummy.valid? }
|
52
61
|
end
|
53
62
|
|
54
63
|
it "prevents you from attaching a file that violates only first of these validations" do
|
55
64
|
Dummy.class_eval { validate(:name) { raise "DO NOT RUN THIS" } }
|
56
65
|
dummy = Dummy.new(avatar: File.new(fixture_file("5k.png")))
|
57
|
-
expect(dummy.errors
|
66
|
+
expect(error_attribute_names(dummy.errors)).to match_array(
|
67
|
+
%i[avatar avatar_file_name]
|
68
|
+
)
|
58
69
|
assert_raises(RuntimeError) { dummy.valid? }
|
59
70
|
end
|
60
71
|
|
61
72
|
it "prevents you from attaching a file that violates only second of these validations" do
|
62
73
|
Dummy.class_eval { validate(:name) { raise "DO NOT RUN THIS" } }
|
63
74
|
dummy = Dummy.new(avatar: File.new(fixture_file("spaced file.jpg")))
|
64
|
-
expect(dummy.errors
|
75
|
+
expect(error_attribute_names(dummy.errors)).to match_array(
|
76
|
+
%i[avatar avatar_file_name]
|
77
|
+
)
|
65
78
|
assert_raises(RuntimeError) { dummy.valid? }
|
66
79
|
end
|
67
80
|
|
@@ -88,7 +101,9 @@ describe Paperclip::Validators do
|
|
88
101
|
end
|
89
102
|
end
|
90
103
|
dummy = Dummy.new(avatar: File.new(fixture_file("12k.png")))
|
91
|
-
expect(dummy.errors
|
104
|
+
expect(error_attribute_names(dummy.errors)).to match_array(
|
105
|
+
%i[avatar_content_type avatar avatar_file_size]
|
106
|
+
)
|
92
107
|
end
|
93
108
|
|
94
109
|
it "does not validate attachment if title is not present" do
|
@@ -98,7 +113,7 @@ describe Paperclip::Validators do
|
|
98
113
|
end
|
99
114
|
end
|
100
115
|
dummy = Dummy.new(avatar: File.new(fixture_file("12k.png")))
|
101
|
-
assert_equal [], dummy.errors
|
116
|
+
assert_equal [], error_attribute_names(dummy.errors)
|
102
117
|
end
|
103
118
|
end
|
104
119
|
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kt-paperclip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 7.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Surendra Singhi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -53,19 +53,19 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: marcel
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 1.0.1
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 1.0.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: terrapin
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -393,6 +393,8 @@ files:
|
|
393
393
|
- gemfiles/5.1.gemfile
|
394
394
|
- gemfiles/5.2.gemfile
|
395
395
|
- gemfiles/6.0.gemfile
|
396
|
+
- gemfiles/6.1.gemfile
|
397
|
+
- gemfiles/7.0.gemfile
|
396
398
|
- lib/generators/paperclip/USAGE
|
397
399
|
- lib/generators/paperclip/paperclip_generator.rb
|
398
400
|
- lib/generators/paperclip/templates/paperclip_migration.rb.erb
|
@@ -532,6 +534,7 @@ files:
|
|
532
534
|
- spec/support/fixtures/fog.yml
|
533
535
|
- spec/support/fixtures/rotated.jpg
|
534
536
|
- spec/support/fixtures/s3.yml
|
537
|
+
- spec/support/fixtures/sample.xlsm
|
535
538
|
- spec/support/fixtures/spaced file.jpg
|
536
539
|
- spec/support/fixtures/spaced file.png
|
537
540
|
- spec/support/fixtures/text.txt
|
@@ -547,7 +550,7 @@ files:
|
|
547
550
|
- spec/support/reporting.rb
|
548
551
|
- spec/support/test_data.rb
|
549
552
|
- spec/support/version_helper.rb
|
550
|
-
homepage: https://github.com/kreeti/paperclip
|
553
|
+
homepage: https://github.com/kreeti/kt-paperclip
|
551
554
|
licenses:
|
552
555
|
- MIT
|
553
556
|
metadata: {}
|
@@ -576,7 +579,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
576
579
|
requirements:
|
577
580
|
- - ">="
|
578
581
|
- !ruby/object:Gem::Version
|
579
|
-
version: 2.
|
582
|
+
version: 2.3.0
|
580
583
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
581
584
|
requirements:
|
582
585
|
- - ">="
|