file_validators 2.0.2 → 3.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +3 -0
  3. data/.rubocop.yml +32 -0
  4. data/.tool-versions +1 -0
  5. data/.travis.yml +33 -5
  6. data/Appraisals +16 -10
  7. data/CHANGELOG.md +26 -0
  8. data/Gemfile +2 -0
  9. data/README.md +32 -21
  10. data/Rakefile +3 -1
  11. data/file_validators.gemspec +13 -7
  12. data/gemfiles/activemodel_3.2.gemfile +2 -1
  13. data/gemfiles/activemodel_4.0.gemfile +2 -1
  14. data/gemfiles/activemodel_4.1.gemfile +1 -0
  15. data/gemfiles/activemodel_4.2.gemfile +2 -1
  16. data/gemfiles/{activemodel_3.0.gemfile → activemodel_5.0.gemfile} +1 -1
  17. data/gemfiles/{activemodel_3.1.gemfile → activemodel_5.2.gemfile} +1 -1
  18. data/lib/file_validators.rb +11 -2
  19. data/lib/file_validators/error.rb +6 -0
  20. data/lib/file_validators/locale/en.yml +0 -2
  21. data/lib/file_validators/mime_type_analyzer.rb +106 -0
  22. data/lib/file_validators/validators/file_content_type_validator.rb +37 -42
  23. data/lib/file_validators/validators/file_size_validator.rb +62 -19
  24. data/lib/file_validators/version.rb +3 -1
  25. data/spec/integration/combined_validators_integration_spec.rb +3 -1
  26. data/spec/integration/file_content_type_validation_integration_spec.rb +117 -11
  27. data/spec/integration/file_size_validator_integration_spec.rb +100 -10
  28. data/spec/lib/file_validators/mime_type_analyzer_spec.rb +139 -0
  29. data/spec/lib/file_validators/validators/file_content_type_validator_spec.rb +93 -36
  30. data/spec/lib/file_validators/validators/file_size_validator_spec.rb +87 -34
  31. data/spec/spec_helper.rb +9 -1
  32. data/spec/support/fakeio.rb +17 -0
  33. data/spec/support/helpers.rb +7 -0
  34. data/spec/support/matchers/allow_content_type.rb +2 -0
  35. data/spec/support/matchers/allow_file_size.rb +2 -0
  36. metadata +87 -27
  37. data/lib/file_validators/utils/content_type_detector.rb +0 -46
  38. data/lib/file_validators/utils/media_type_spoof_detector.rb +0 -46
  39. data/spec/lib/file_validators/utils/content_type_detector_spec.rb +0 -27
  40. data/spec/lib/file_validators/utils/media_type_spoof_detector_spec.rb +0 -31
@@ -1,5 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
- require 'file_validators/validators/file_size_validator'
3
4
 
4
5
  describe ActiveModel::Validations::FileSizeValidator do
5
6
  class Dummy
@@ -8,9 +9,9 @@ describe ActiveModel::Validations::FileSizeValidator do
8
9
 
9
10
  def storage_units
10
11
  if defined?(ActiveSupport::NumberHelper) # Rails 4.0+
11
- { 5120 => '5 KB', 10240 => '10 KB' }
12
+ { 5120 => '5 KB', 10_240 => '10 KB' }
12
13
  else
13
- { 5120 => '5120 Bytes', 10240 => '10240 Bytes' }
14
+ { 5120 => '5120 Bytes', 10_240 => '10240 Bytes' }
14
15
  end
15
16
  end
16
17
 
@@ -21,7 +22,7 @@ describe ActiveModel::Validations::FileSizeValidator do
21
22
  subject { Dummy }
22
23
 
23
24
  def build_validator(options)
24
- @validator = ActiveModel::Validations::FileSizeValidator.new(options.merge(attributes: :avatar))
25
+ @validator = described_class.new(options.merge(attributes: :avatar))
25
26
  end
26
27
 
27
28
  context 'with :in option' do
@@ -34,7 +35,7 @@ describe ActiveModel::Validations::FileSizeValidator do
34
35
  end
35
36
 
36
37
  context 'as a proc' do
37
- before { build_validator in: lambda { |record| (5.kilobytes..10.kilobytes) } }
38
+ before { build_validator in: ->(_record) { (5.kilobytes..10.kilobytes) } }
38
39
 
39
40
  it { is_expected.to allow_file_size(7.kilobytes, @validator) }
40
41
  it { is_expected.not_to allow_file_size(4.kilobytes, @validator) }
@@ -52,7 +53,7 @@ describe ActiveModel::Validations::FileSizeValidator do
52
53
  end
53
54
 
54
55
  context 'as a proc' do
55
- before { build_validator greater_than_or_equal_to: lambda { |record| 10.kilobytes } }
56
+ before { build_validator greater_than_or_equal_to: ->(_record) { 10.kilobytes } }
56
57
 
57
58
  it { is_expected.to allow_file_size(11.kilobytes, @validator) }
58
59
  it { is_expected.to allow_file_size(10.kilobytes, @validator) }
@@ -70,7 +71,7 @@ describe ActiveModel::Validations::FileSizeValidator do
70
71
  end
71
72
 
72
73
  context 'as a proc' do
73
- before { build_validator less_than_or_equal_to: lambda { |record| 10.kilobytes } }
74
+ before { build_validator less_than_or_equal_to: ->(_record) { 10.kilobytes } }
74
75
 
75
76
  it { is_expected.to allow_file_size(9.kilobytes, @validator) }
76
77
  it { is_expected.to allow_file_size(10.kilobytes, @validator) }
@@ -87,7 +88,7 @@ describe ActiveModel::Validations::FileSizeValidator do
87
88
  end
88
89
 
89
90
  context 'as a proc' do
90
- before { build_validator greater_than: lambda { |record| 10.kilobytes } }
91
+ before { build_validator greater_than: ->(_record) { 10.kilobytes } }
91
92
 
92
93
  it { is_expected.to allow_file_size(11.kilobytes, @validator) }
93
94
  it { is_expected.not_to allow_file_size(10.kilobytes, @validator) }
@@ -103,7 +104,7 @@ describe ActiveModel::Validations::FileSizeValidator do
103
104
  end
104
105
 
105
106
  context 'as a proc' do
106
- before { build_validator less_than: lambda { |record| 10.kilobytes } }
107
+ before { build_validator less_than: ->(_record) { 10.kilobytes } }
107
108
 
108
109
  it { is_expected.to allow_file_size(9.kilobytes, @validator) }
109
110
  it { is_expected.not_to allow_file_size(10.kilobytes, @validator) }
@@ -120,8 +121,10 @@ describe ActiveModel::Validations::FileSizeValidator do
120
121
  end
121
122
 
122
123
  context 'as a proc' do
123
- before { build_validator greater_than: lambda { |record| 5.kilobytes },
124
- less_than: lambda { |record| 10.kilobytes } }
124
+ before do
125
+ build_validator greater_than: ->(_record) { 5.kilobytes },
126
+ less_than: ->(_record) { 10.kilobytes }
127
+ end
125
128
 
126
129
  it { is_expected.to allow_file_size(7.kilobytes, @validator) }
127
130
  it { is_expected.not_to allow_file_size(5.kilobytes, @validator) }
@@ -130,51 +133,101 @@ describe ActiveModel::Validations::FileSizeValidator do
130
133
  end
131
134
 
132
135
  context 'with :message option' do
133
- before { build_validator in: (5.kilobytes..10.kilobytes),
134
- message: 'is invalid. (Between %{min} and %{max} please.)' }
136
+ before do
137
+ build_validator in: (5.kilobytes..10.kilobytes),
138
+ message: 'is invalid. (Between %{min} and %{max} please.)'
139
+ end
135
140
 
136
- it { is_expected.not_to allow_file_size(11.kilobytes, @validator,
137
- message: "Avatar is invalid. (Between #{@storage_units[5120]} and #{@storage_units[10240]} please.)") }
141
+ it do
142
+ is_expected.not_to allow_file_size(
143
+ 11.kilobytes, @validator,
144
+ message: "Avatar is invalid. (Between #{@storage_units[5120]}" \
145
+ " and #{@storage_units[10_240]} please.)"
146
+ )
147
+ end
138
148
 
139
- it { is_expected.to allow_file_size(7.kilobytes, @validator,
140
- message: "Avatar is invalid. (Between #{@storage_units[5120]} and #{@storage_units[10240]} please.)") }
149
+ it do
150
+ is_expected.to allow_file_size(
151
+ 7.kilobytes, @validator,
152
+ message: "Avatar is invalid. (Between #{@storage_units[5120]}" \
153
+ " and #{@storage_units[10_240]} please.)"
154
+ )
155
+ end
141
156
  end
142
157
 
143
158
  context 'default error message' do
144
159
  context 'given :in options' do
145
160
  before { build_validator in: 5.kilobytes..10.kilobytes }
146
161
 
147
- it { is_expected.not_to allow_file_size(11.kilobytes, @validator,
148
- message: "Avatar file size must be between #{@storage_units[5120]} and #{@storage_units[10240]}") }
149
- it { is_expected.not_to allow_file_size(4.kilobytes, @validator,
150
- message: "Avatar file size must be between #{@storage_units[5120]} and #{@storage_units[10240]}") }
162
+ it do
163
+ is_expected.not_to allow_file_size(
164
+ 11.kilobytes, @validator,
165
+ message: "Avatar file size must be between #{@storage_units[5120]}" \
166
+ " and #{@storage_units[10_240]}"
167
+ )
168
+ end
169
+
170
+ it do
171
+ is_expected.not_to allow_file_size(
172
+ 4.kilobytes, @validator,
173
+ message: "Avatar file size must be between #{@storage_units[5120]}" \
174
+ " and #{@storage_units[10_240]}"
175
+ )
176
+ end
151
177
  end
152
178
 
153
179
  context 'given :greater_than and :less_than options' do
154
180
  before { build_validator greater_than: 5.kilobytes, less_than: 10.kilobytes }
155
181
 
156
- it { is_expected.not_to allow_file_size(11.kilobytes, @validator,
157
- message: "Avatar file size must be less than #{@storage_units[10240]}") }
158
- it { is_expected.not_to allow_file_size(4.kilobytes, @validator,
159
- message: "Avatar file size must be greater than #{@storage_units[5120]}") }
182
+ it do
183
+ is_expected.not_to allow_file_size(
184
+ 11.kilobytes, @validator,
185
+ message: "Avatar file size must be less than #{@storage_units[10_240]}"
186
+ )
187
+ end
188
+
189
+ it do
190
+ is_expected.not_to allow_file_size(
191
+ 4.kilobytes, @validator,
192
+ message: "Avatar file size must be greater than #{@storage_units[5120]}"
193
+ )
194
+ end
160
195
  end
161
196
 
162
197
  context 'given :greater_than_or_equal_to and :less_than_or_equal_to options' do
163
- before { build_validator greater_than_or_equal_to: 5.kilobytes, less_than_or_equal_to: 10.kilobytes }
198
+ before do
199
+ build_validator greater_than_or_equal_to: 5.kilobytes,
200
+ less_than_or_equal_to: 10.kilobytes
201
+ end
202
+
203
+ it do
204
+ is_expected.not_to allow_file_size(
205
+ 11.kilobytes, @validator,
206
+ message: "Avatar file size must be less than or equal to #{@storage_units[10_240]}"
207
+ )
208
+ end
164
209
 
165
- it { is_expected.not_to allow_file_size(11.kilobytes, @validator,
166
- message: "Avatar file size must be less than or equal to #{@storage_units[10240]}") }
167
- it { is_expected.not_to allow_file_size(4.kilobytes, @validator,
168
- message: "Avatar file size must be greater than or equal to #{@storage_units[5120]}") }
210
+ it do
211
+ is_expected.not_to allow_file_size(
212
+ 4.kilobytes, @validator,
213
+ message: "Avatar file size must be greater than or equal to #{@storage_units[5120]}"
214
+ )
215
+ end
169
216
  end
170
217
  end
171
218
 
219
+ context 'exceptional file size' do
220
+ before { build_validator less_than: 3.kilobytes }
221
+
222
+ it { is_expected.to allow_file_size(0, @validator) } # zero-byte file
223
+ it { is_expected.not_to allow_file_size(nil, @validator) }
224
+ end
172
225
 
173
226
  context 'using the helper' do
174
227
  before { Dummy.validates_file_size :avatar, in: (5.kilobytes..10.kilobytes) }
175
228
 
176
229
  it 'adds the validator to the class' do
177
- expect(Dummy.validators_on(:avatar)).to include(ActiveModel::Validations::FileSizeValidator)
230
+ expect(Dummy.validators_on(:avatar)).to include(described_class)
178
231
  end
179
232
  end
180
233
 
@@ -183,10 +236,10 @@ describe ActiveModel::Validations::FileSizeValidator do
183
236
  expect { build_validator message: 'Some message' }.to raise_error(ArgumentError)
184
237
  end
185
238
 
186
- (ActiveModel::Validations::FileSizeValidator::CHECKS.keys - [:in]).each do |argument|
239
+ (described_class::CHECKS.keys - [:in]).each do |argument|
187
240
  it "does not raise argument error if :#{argument} is numeric or a proc" do
188
241
  expect { build_validator argument => 5.kilobytes }.not_to raise_error
189
- expect { build_validator argument => lambda { |record| 5.kilobytes } }.not_to raise_error
242
+ expect { build_validator argument => ->(_record) { 5.kilobytes } }.not_to raise_error
190
243
  end
191
244
 
192
245
  it "raises error if :#{argument} is neither a number nor a proc" do
@@ -196,7 +249,7 @@ describe ActiveModel::Validations::FileSizeValidator do
196
249
 
197
250
  it 'does not raise argument error if :in is a range or a proc' do
198
251
  expect { build_validator in: 5.kilobytes..10.kilobytes }.not_to raise_error
199
- expect { build_validator in: lambda { |record| 5.kilobytes..10.kilobytes } }.not_to raise_error
252
+ expect { build_validator in: ->(_record) { 5.kilobytes..10.kilobytes } }.not_to raise_error
200
253
  end
201
254
 
202
255
  it 'raises error if :in is neither a range nor a proc' do
@@ -1,8 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ENV['RAILS_ENV'] ||= 'test'
2
4
 
3
5
  require 'active_support'
6
+ require 'active_support/deprecation'
4
7
  require 'active_support/core_ext'
5
- require_relative '../lib/file_validators'
8
+ require 'file_validators'
6
9
  require 'rspec'
7
10
  require 'coveralls'
8
11
 
@@ -10,8 +13,13 @@ Coveralls.wear!
10
13
 
11
14
  locale_path = Dir.glob(File.dirname(__FILE__) + '/locale/*.yml')
12
15
  I18n.load_path += locale_path unless I18n.load_path.include?(locale_path)
16
+ I18n.enforce_available_locales = false
13
17
 
14
18
  Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }
15
19
 
16
20
  RSpec.configure do |config|
21
+ config.include Helpers
22
+
23
+ # Suppress stdout in the console
24
+ config.before { allow($stdout).to receive(:write) }
17
25
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'forwardable'
4
+ require 'stringio'
5
+
6
+ class FakeIO
7
+ attr_reader :original_filename, :content_type
8
+
9
+ def initialize(content, filename: nil, content_type: nil)
10
+ @io = StringIO.new(content)
11
+ @original_filename = filename
12
+ @content_type = content_type
13
+ end
14
+
15
+ extend Forwardable
16
+ delegate %i[read rewind eof? close size] => :@io
17
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Helpers
4
+ def fakeio(content = 'file', **options)
5
+ FakeIO.new(content, **options)
6
+ end
7
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec::Matchers.define :allow_file_content_type do |content_type, validator, message|
2
4
  match do |model|
3
5
  value = double('file', path: content_type, original_filename: content_type)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec::Matchers.define :allow_file_size do |size, validator, message|
2
4
  match do |model|
3
5
  value = double('file', size: size)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: file_validators
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 3.0.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ahmad Musaffa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-08 00:00:00.000000000 Z
11
+ date: 2020-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '3.0'
19
+ version: '3.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '3.0'
26
+ version: '3.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mime-types
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -39,21 +39,21 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: cocaine
42
+ name: coveralls
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 0.5.4
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 0.5.4
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rake
56
+ name: fastimage
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -67,21 +67,49 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rspec
70
+ name: marcel
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 3.1.0
75
+ version: '0.3'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 3.1.0
82
+ version: '0.3'
83
83
  - !ruby/object:Gem::Dependency
84
- name: coveralls
84
+ name: mimemagic
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: 0.3.2
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: 0.3.2
97
+ - !ruby/object:Gem::Dependency
98
+ name: mini_mime
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rack-test
85
113
  requirement: !ruby/object:Gem::Requirement
86
114
  requirements:
87
115
  - - ">="
@@ -95,7 +123,7 @@ dependencies:
95
123
  - !ruby/object:Gem::Version
96
124
  version: '0'
97
125
  - !ruby/object:Gem::Dependency
98
- name: rack-test
126
+ name: rake
99
127
  requirement: !ruby/object:Gem::Requirement
100
128
  requirements:
101
129
  - - ">="
@@ -108,6 +136,34 @@ dependencies:
108
136
  - - ">="
109
137
  - !ruby/object:Gem::Version
110
138
  version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rspec
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 3.5.0
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 3.5.0
153
+ - !ruby/object:Gem::Dependency
154
+ name: rubocop
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 0.58.2
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: 0.58.2
111
167
  description: Adds file validators to ActiveModel
112
168
  email:
113
169
  - musaffa_csemm@yahoo.com
@@ -117,24 +173,27 @@ extra_rdoc_files: []
117
173
  files:
118
174
  - ".gitignore"
119
175
  - ".rspec"
176
+ - ".rubocop.yml"
177
+ - ".tool-versions"
120
178
  - ".travis.yml"
121
179
  - Appraisals
180
+ - CHANGELOG.md
122
181
  - Gemfile
123
182
  - MIT-LICENSE
124
183
  - README.md
125
184
  - README.rdoc
126
185
  - Rakefile
127
186
  - file_validators.gemspec
128
- - gemfiles/activemodel_3.0.gemfile
129
- - gemfiles/activemodel_3.1.gemfile
130
187
  - gemfiles/activemodel_3.2.gemfile
131
188
  - gemfiles/activemodel_4.0.gemfile
132
189
  - gemfiles/activemodel_4.1.gemfile
133
190
  - gemfiles/activemodel_4.2.gemfile
191
+ - gemfiles/activemodel_5.0.gemfile
192
+ - gemfiles/activemodel_5.2.gemfile
134
193
  - lib/file_validators.rb
194
+ - lib/file_validators/error.rb
135
195
  - lib/file_validators/locale/en.yml
136
- - lib/file_validators/utils/content_type_detector.rb
137
- - lib/file_validators/utils/media_type_spoof_detector.rb
196
+ - lib/file_validators/mime_type_analyzer.rb
138
197
  - lib/file_validators/validators/file_content_type_validator.rb
139
198
  - lib/file_validators/validators/file_size_validator.rb
140
199
  - lib/file_validators/version.rb
@@ -146,12 +205,13 @@ files:
146
205
  - spec/integration/combined_validators_integration_spec.rb
147
206
  - spec/integration/file_content_type_validation_integration_spec.rb
148
207
  - spec/integration/file_size_validator_integration_spec.rb
149
- - spec/lib/file_validators/utils/content_type_detector_spec.rb
150
- - spec/lib/file_validators/utils/media_type_spoof_detector_spec.rb
208
+ - spec/lib/file_validators/mime_type_analyzer_spec.rb
151
209
  - spec/lib/file_validators/validators/file_content_type_validator_spec.rb
152
210
  - spec/lib/file_validators/validators/file_size_validator_spec.rb
153
211
  - spec/locale/en.yml
154
212
  - spec/spec_helper.rb
213
+ - spec/support/fakeio.rb
214
+ - spec/support/helpers.rb
155
215
  - spec/support/matchers/allow_content_type.rb
156
216
  - spec/support/matchers/allow_file_size.rb
157
217
  homepage: https://github.com/musaffa/file_validators
@@ -169,12 +229,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
169
229
  version: '0'
170
230
  required_rubygems_version: !ruby/object:Gem::Requirement
171
231
  requirements:
172
- - - ">="
232
+ - - ">"
173
233
  - !ruby/object:Gem::Version
174
- version: '0'
234
+ version: 1.3.1
175
235
  requirements: []
176
- rubyforge_project:
177
- rubygems_version: 2.4.5.1
236
+ rubygems_version: 3.1.2
178
237
  signing_key:
179
238
  specification_version: 4
180
239
  summary: ActiveModel file validators
@@ -187,11 +246,12 @@ test_files:
187
246
  - spec/integration/combined_validators_integration_spec.rb
188
247
  - spec/integration/file_content_type_validation_integration_spec.rb
189
248
  - spec/integration/file_size_validator_integration_spec.rb
190
- - spec/lib/file_validators/utils/content_type_detector_spec.rb
191
- - spec/lib/file_validators/utils/media_type_spoof_detector_spec.rb
249
+ - spec/lib/file_validators/mime_type_analyzer_spec.rb
192
250
  - spec/lib/file_validators/validators/file_content_type_validator_spec.rb
193
251
  - spec/lib/file_validators/validators/file_size_validator_spec.rb
194
252
  - spec/locale/en.yml
195
253
  - spec/spec_helper.rb
254
+ - spec/support/fakeio.rb
255
+ - spec/support/helpers.rb
196
256
  - spec/support/matchers/allow_content_type.rb
197
257
  - spec/support/matchers/allow_file_size.rb