musaffa / file_validators Goto Github PK
View Code? Open in Web Editor NEWAdds file validators to ActiveModel.
License: MIT License
Adds file validators to ActiveModel.
License: MIT License
I am trying to use file_validators
to validate the content type of avatars in my rails api. The client selects a file, submits the form, gets the content type validated with
validates :avatar, file_content_type: { allow: /^image\/.*/ }
However, the client currently has a bug where it sends a text string instead of an uploaded file. I would expect this to NOT be of an image content type and therefore fail the validation. But it seems file_validators
in
JSON::ParserError: expected false at line 1, column 2 [parse.c:152]
Maybe the correct behaviour would be for the gem to rescue a json parser error? Nevertheless Thanks for a great gem! :)
I'm using Rspec and the gem file_validators for testing and I need to put properly the output of the Quote Mark's("txt") like theses:
expect(page).to have_content expect(page).to have_content "You are not allowed to upload \"txt\" files, allowed types: jpg, jpeg, gif, png"
or
double_quotes = ""txt"".html_safe
expect(page).to have_content expect(page).to have_content "You are not allowed to upload '#{double_quotes}' files, allowed types: jpg, jpeg, gif, png"
But I'm having a failure error for show this:
Failure/Error: expect(page).to have_content expect(page).to have_content "You are not allowed to upload '#{double_quotes}' files, allowed types: jpg, jpeg, gif, png" expected to find text "You are not allowed to upload '"txt"' files, allowed types: jpg, jpeg, gif, png" in "News CityToggle navigationHomeAdminSigned in as [email protected] out×Post has not been created.New Post* TitleSubtitleFileYou are not allowed to upload \"txt\" files, allowed types: jpg, jpeg, gif, png* Content It will serve for show images about the posts."
Let's consider following example:
# .../pitches_controller.rb
def upload_avatar
pitch = Pitch.find(params[:id])
form = PitchAvatarForm.new(pitch)
if form.validate(pitch_avatar_params)
form.save
on_pitch_avatar_upload_succeeded(form)
else
on_pitch_avatar_upload_fialed(form)
end
end
# .../forms/pitch_avatar_form.rb
class PitchAvatarForm < Reform::Form
model :pitch
property :image
property :image_file_name
property :image_content_type
property :image_file_size
validates :image,
file_content_type: { allow: ['image/jpeg', 'image/jpg', 'image/png'] },
file_size: { less_than: 2.megabytes }
end
On each form#save
execution it couses following error:
form.save
NoMethodError: undefined method `sub' for nil:NilClass
from /Users/rapide/.rvm/gems/ruby-2.3.0@bttf/gems/paperclip-4.2.2/lib/paperclip/storage/s3.rb:255:in `s3_object'
I fixed this issue by assigning attributes to the pitch before creating the form but it looks like an ugly hack. Any idea how to solve this in better way?
having validation:
validates :cv,
file_content_type: {
allow: %w(
application/msword
application/vnd.openxmlformats-officedocument.wordprocessingml.document
application/x-pdf
application/pdf
),
it works fine for .pdf and .doc but not for .docx
Even when manually setting type:
ActionDispatch::Http::UploadedFile.new({
filename: @data[:filename],
type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
tempfile: tmp_file_data
})
looks like application/vnd.openxmlformats-officedocument.wordprocessingml.document
is not supported.
Carrierwave has the ability to upload multiple files. I just tried if file_validators still work with that, but it doesn't seem to, using the following code:
mount_uploaders :documents, DocumentUploader
validates :documents, file_size: { less_than_or_equal_to: 100.kilobytes }
and I was able to upload an image over 1MB. Is there support being planned for this?
Using Active Storage failed using file size validators
DEPRECATION: The cocaine gem is deprecated. Please upgrade to terrapin. See https://github.com/thoughtbot/terrapin/ for further instructions.
Hello, there is note in mimemagic gem README.
MimeMagic is a library to detect the mime type of a file by extension or by content
.
MimeMagic.by_magic(File.open('test.html'))
So in what cases should I use cocaine
? When mimemagic
is not enough?
Hello,
I'm currently using postgres array column + carrierwave for uploading files. Is it possible to add file validation for array column?
Thanks
Using File Validators file_content_type
and file_size
with Active Storage throw a Module::DelegationError
error (content_type delegated to attachment, but attachment is nil
and size delegated to attachment, but attachment is nil
), when a form for a Model thats being validated gets submitted without attaching a file.
The following workaround works for now:
validates :image, file_content_type: { allow: ['image/jpeg', 'image/png', 'image/gif'] }, if: -> { image.attached? }
This might fit into the README, should I open a PR?
Hello!
I'm currently migrating an application from PaperClip to ActiveStorage. As part of thoughtbots migration guide, they suggested using your gem. Our model, lets call it 'Organization' like they do in the example, has a 'logo' attached to it. Using their migration guide, I added the following to the Organization model:
validates :logo, file_content_type: {
allow: ['image/jpg', 'image/jpeg', 'image/png', 'image/gif'],
if: -> { logo.attached? },
}
I expected this to work out of the box, which it does when I'm uploading a file. If I remove say jpeg from the list and try to upload a jpeg, I get an error. The problem is that when I try to run basically anything else in console, like Organization.find(ID) or try to delete a record for example, I get the error mentioned in the title:
ArgumentError: Unknown validator: 'FileContentTypeValidator'
/gems/activemodel-5.2.1/lib/active_model/validations/validates.rb:121:in `rescue in block in validates'
Our app is running on Rails 5.2
Please let me know if you can help or if we should take an alternative approach, thanks!
Although a merge request has been merged and the readme already mentions terrapin
gem as a dependency when using mode: :strict
I still get a warning pointing at dependency on cocaine
gem which is deprecated:
file_validators requires 'cocaine' gem as you are using file content type validations in strict mode
from here
I checked the latest version on rubygems.org and it seems to be at version 3.0.1 beta.
bundle update file_validators
returns Bundler attempted to update file_validators but its version stayed the same
Gemfile.lock
file_validators (2.3.0)
Is it possible to upgrade it?
Greetings, and thank you so much for all the work you guys put into the gem!
Now to the business... I have the following kind of model:
class VaultDoc < BaseModel
mount_uploader :document, VaultDocUploader
validates :document,
file_size: { less_than_or_equal_to: 25.megabytes },
file_content_type: { allow: ->(record) { record.allow_content_types }, mode: :strict },
on: :create
end
With the following kind of VaultDocUploader
:
class VaultDocUploader < CarrierWave::Uploader::Base
include CarrierWave::RMagick
storage :file
version :thumb, if: :thumbable? do
process resize_to_fit: [315, 445], if: :image?
process pdf_preview: [315, 445], if: :pdf?
end
def thumbable?(file)
image?(file) || pdf?(file)
end
def image?(file)
file.content_type.include? 'image'
end
def pdf?(file)
file.content_type == 'application/pdf'
end
end
(There's a lot more to it, but seems to be irrelevant)
Validation raises an exception when I'm trying to create an instance of VaultDoc
during tests:
NoMethodError: undefined method `eof?' for #<VaultDocUploader:0x00007feaa4a46168 @model=#<VaultDoc id: nil ...>, @mounted_as=:document, @staged=true, @file=#<CarrierWave::SanitizedFile:0x000000000d962d20 @file="/app/tmp/vault-cache/1691776062-272660352770104-0001-2145/logo.png", @original_filename="logo.png", @content_type="image/png", @content=nil>, @filename="logo.png", @cache_id="1691776062-272660352770104-0001-2145", @identifier=nil, @versions={:thumb=>#<VaultDocUploader::Uploader22380:0x000000000d960750 @model=#<VaultDoc id: nil, document: nil, state: "uploaded", title: "My Document", original_filename: nil, thumb_present: true, created_at: nil, deleted_at: nil, vault_keeper_id: "93419cd4-87ca-42ec-8ae4-ecfda99b7620">, @mounted_as=:document, @staged=true, @file=#<CarrierWave::SanitizedFile:0x000000000d96a8e0 @file="/app/tmp/vault-cache/1691776062-272660352770104-0001-2145/thumb_logo.png", @original_filename="logo.png", @content_type="image/png", @content=nil>, @filename="logo.png", @cache_id="1691776062-272660352770104-0001-2145", @identifier=nil, @versions={}, @format=nil, @parent_version=#<VaultDocUploader:0x00007feaa4a46168 ...>, @parent_cache_id="1691776062-272660352770104-0001-2145", @original_filename="logo.png", @geometry={:width=>315, :height=>315}, @cache_storage=#<CarrierWave::Storage::File:0x000000000a47d088 @uploader=#<VaultDocUploader::Uploader22380:0x000000000d960750 ...>, @cache_called=nil>>}, @format=nil, @original_filename="logo.png", @cache_storage=#<CarrierWave::Storage::File:0x000000000d961628 @uploader=#<VaultDocUploader:0x00007feaa4a46168 ...>, @cache_called=nil>> # /gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:27:in `extract_with_file' # /gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:16:in `call' # /gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:60:in `get_content_type'
This used to work on v2.3.0 and worked up to v3.0.0.beta1 (inclusive), whereas v3.0.0.beta2 and v3.0.0 (release) don't work.
Here are my thoughts on what's happened: https://github.com/musaffa/file_validators/pull/32/files#r1291636492
Hello,
I think that media type spoofing is a bit problematic. For example I have a my_file.torrent which has a content type application/x-bittorrent and the file, even though is valid, it is being detected as spoofed.
I believe that the validation shouldn't make such an automatic detection but it should be up to the caller, via a new validator called 'file_extension_validation' to make such decisions.
Thank you for your time
Given that I have the following model:
class Profile
include ActiveModel::Validations
attr_accessor :avatar
validates :avatar, file_content_type: { allow: ['application/json'] }
end
I will get the following error message when the file is not valid:
With the allowed content type interpolated as specified in the validate statement, i.e. application/json
as defined here:
I suggest that we would convert the Mime type into human readable format, e.g. in this case JSON
.
This could be done e.g. as follows:
"application/json".match(%r{/([a-z]+)})[1].upcase
Hi,
we use in our application carrierwave-aws gem for storing files to S3. And we also use the file_validators gem for validating content_type of uploaded file.
What happen is that when we assign file (for example pdf file and we check that content_type is 'application/pdf'). The record is valid and we can store it. But when we load the record from database and it load file from S3, then record is invalid. The file behave like 'application/octstream' instead of 'application/pdf' . But if I ask for record.content_type => 'application/pdf'
So I think the problem is on this line https://github.com/musaffa/file_validators/blob/master/lib/file_validators/validators/file_content_type_validator.rb#L59
If there happen any error with content_type detection it as default return 'application/octstream' .
If you can give me an idea, how to fix it, I will do it.
Thanks a lot.
I see you haven't added your name yet to LICENSE.md. Please consider adding it
I cannot seem to use the file_validators gem with carrierwave-aws. It systematically cause model crashes when saving without uploaded file. Apparently the file validations always trigger, even when there is no file, and that cause Aws::S3::Errors::NotFound:
. I had to remove the gem from the Gemfile.
Here is a backtrace :
my_model_with_uploader.save
Aws::S3::Errors::NotFound:
from /var/www/mysite-prod/shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.3.11/lib/seahorse/client/plugins/raise_response_errors.rb:15:in `call'
from /var/www/mysite-prod/shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.3.11/lib/aws-sdk-core/plugins/s3_sse_cpk.rb:18:in `call'
from /var/www/mysite-prod/shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.3.11/lib/aws-sdk-core/plugins/s3_accelerate.rb:33:in `call'
from /var/www/mysite-prod/shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.3.11/lib/aws-sdk-core/plugins/param_converter.rb:20:in `call'
from /var/www/mysite-prod/shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.3.11/lib/seahorse/client/plugins/response_target.rb:21:in `call'
from /var/www/mysite-prod/shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.3.11/lib/seahorse/client/request.rb:70:in `send_request'
from /var/www/mysite-prod/shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.3.11/lib/seahorse/client/base.rb:207:in `block (2 levels) in define_operation_methods'
from /var/www/mysite-prod/shared/bundle/ruby/2.3.0/gems/aws-sdk-resources-2.3.11/lib/aws-sdk-resources/request.rb:24:in `call'
from /var/www/mysite-prod/shared/bundle/ruby/2.3.0/gems/aws-sdk-resources-2.3.11/lib/aws-sdk-resources/operations.rb:41:in `call'
from /var/www/mysite-prod/shared/bundle/ruby/2.3.0/gems/aws-sdk-resources-2.3.11/lib/aws-sdk-resources/operations.rb:61:in `call'
from /var/www/mysite-prod/shared/bundle/ruby/2.3.0/gems/aws-sdk-resources-2.3.11/lib/aws-sdk-resources/resource.rb:147:in `load'
from /var/www/mysite-prod/shared/bundle/ruby/2.3.0/gems/aws-sdk-resources-2.3.11/lib/aws-sdk-resources/resource.rb:120:in `data'
from /var/www/mysite-prod/shared/bundle/ruby/2.3.0/gems/aws-sdk-resources-2.3.11/lib/aws-sdk-resources/resource.rb:223:in `block in add_data_attribute'
from /var/www/mysite-prod/shared/bundle/ruby/2.3.0/gems/carrierwave-aws-1.0.1/lib/carrierwave/storage/aws_file.rb:7:in `content_type'
from /var/www/mysite-prod/shared/bundle/ruby/2.3.0/gems/carrierwave-0.10.0/lib/carrierwave/uploader/proxy.rb:83:in `content_type'
from /var/www/mysite-prod/shared/bundle/ruby/2.3.0/gems/file_validators-2.1.0/lib/file_validators/validators/file_content_type_validator.rb:65:in `get_content_type'
... 76 levels...
from /var/www/mysite-prod/shared/bundle/ruby/2.3.0/gems/activesupport-5.0.0.rc1/lib/active_support/callbacks.rb:750:in `_run_validation_callbacks'
from /var/www/mysite-prod/shared/bundle/ruby/2.3.0/gems/activemodel-5.0.0.rc1/lib/active_model/validations/callbacks.rb:113:in `run_validations!'
from /var/www/mysite-prod/shared/bundle/ruby/2.3.0/gems/activemodel-5.0.0.rc1/lib/active_model/validations.rb:338:in `valid?'
from /var/www/mysite-prod/shared/bundle/ruby/2.3.0/bundler/gems/mongoid-7c2ff52a0c52/lib/mongoid/validatable.rb:97:in `valid?'
from /var/www/mysite-prod/shared/bundle/ruby/2.3.0/gems/activemodel-5.0.0.rc1/lib/active_model/validations.rb:375:in `invalid?'
from /var/www/mysite-prod/shared/bundle/ruby/2.3.0/bundler/gems/mongoid-7c2ff52a0c52/lib/mongoid/persistable/updatable.rb:113:in `prepare_update'
from /var/www/mysite-prod/shared/bundle/ruby/2.3.0/bundler/gems/mongoid-7c2ff52a0c52/lib/mongoid/persistable/updatable.rb:137:in `update_document'
from /var/www/mysite-prod/shared/bundle/ruby/2.3.0/bundler/gems/mongoid-7c2ff52a0c52/lib/mongoid/persistable/savable.rb:25:in `save'
from (irb):2
from /var/www/mysite-prod/shared/bundle/ruby/2.3.0/gems/railties-5.0.0.rc1/lib/rails/commands/console.rb:65:in `start'
from /var/www/mysite-prod/shared/bundle/ruby/2.3.0/gems/railties-5.0.0.rc1/lib/rails/commands/console_helper.rb:9:in `start'
from /var/www/mysite-prod/shared/bundle/ruby/2.3.0/gems/railties-5.0.0.rc1/lib/rails/commands/commands_tasks.rb:78:in `console'
from /var/www/mysite-prod/shared/bundle/ruby/2.3.0/gems/railties-5.0.0.rc1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /var/www/mysite-prod/shared/bundle/ruby/2.3.0/gems/railties-5.0.0.rc1/lib/rails/commands.rb:18:in `<top (required)>'
from bin/rails:4:in `require'
Original issue there : carrierwaveuploader/carrierwave-aws#86
Hi!
I'm trying to validate a paperclip :image in a Form object but it throws the following error on create:
Paperclip::Errors::MissingRequiredValidatorError.
I've already include ActiveModel::Validations in my Form Object as well as Paperclip validators but. Is your gem working with Paperclip?
Thanks in advance!
Hi @musaffa,
What's missing for a 3.0.0 stable release? I can see a few outdated issues in here, just waiting to be closed, and some staled PR but what did you expect to put into the stable 3.0.0 before you release it?
Maybe I can help you to reach that goal.
Is it possible to interpolate the detected mime-type into the error message?
rails server (app works as expected) however in rails console i got
"ArgumentError (Unknown validator: 'FileSizeValidator')"
Many docker images have a minimal set of tools, in the case of the jruby docker image file
is not available by default. In this case there is a very quiet note from file_validators and the content_type
check returns an octet-stream
. If you're using :strict and the command fails because the command cannot be found, that failure should occur very obviously. Currently a "file: not found" log line occurs, I suggest that it should be an exception.
Code in question:
Hi,
Great work on the gem!
I'm trying to use the gem's validators in my own rspec suite, so that I'm able to say something like:
it { is_expected.to allow_file_size(1.5.megabyes, :image) }
...or similar.
Is there any way to include the validators in the rspec?
Hey , I'm trying to package file_validators
for debian . Currently I'm getting an error when running the tests. Can you help me here as to why this is happening and what should be done to fix this?
Here's my log
/usr/bin/ruby2.7 -I/usr/share/rubygems-integration/all/gems/rspec-support-3.9.3/lib:/usr/share/rubygems-integration/all/gems/rspec-core-3.9.2/lib /usr/share/rubygems-integration/all/gems/rspec-core-3.9.2/exe/rspec --pattern ./spec/\*\*/\*_spec.rb --format documentation
[Coveralls] Set up the SimpleCov formatter.
[Coveralls] Using SimpleCov's default settings.
Combined File Validators integration with ActiveModel
without helpers
with an allowed type
is expected to be valid
with a disallowed type
invalidates jpeg image file having size bigger than the allowed size
invalidates png image file
invalidates text file
with helpers
with an allowed type
is expected to be valid
with a disallowed type
invalidates jpeg image file having size bigger than the allowed size
invalidates png image file
invalidates text file
File Content Type integration with ActiveModel
:allow option
a string
with an allowed type
is expected to be valid
with a disallowed type
is expected not to be valid
as a regex
with an allowed types
validates jpeg image file (FAILED - 1)
validates png image file (FAILED - 2)
with a disallowed type
is expected not to be valid (FAILED - 3)
as a list
with allowed types
validates jpeg (FAILED - 4)
validates text file (FAILED - 5)
with a disallowed type
is expected not to be valid (FAILED - 6)
as a proc
with allowed types
validates jpeg (FAILED - 7)
validates text file (FAILED - 8)
with a disallowed type
is expected not to be valid (FAILED - 9)
:exclude option
a string
with an allowed type
is expected to be valid (FAILED - 10)
with a disallowed type
is expected not to be valid (FAILED - 11)
as a regex
with an allowed type
is expected to be valid (FAILED - 12)
with a disallowed types
invalidates jpeg image file (FAILED - 13)
invalidates png image file (FAILED - 14)
as a list
with an allowed type
is expected to be valid (FAILED - 15)
with a disallowed types
invalidates jpeg (FAILED - 16)
invalidates text file (FAILED - 17)
as a proc
with an allowed type
is expected to be valid (FAILED - 18)
with a disallowed types
invalidates jpeg image file (FAILED - 19)
:allow and :exclude combined
with an allowed type
is expected to be valid (FAILED - 20)
with a disallowed type
is expected not to be valid (FAILED - 21)
:tool option
with valid file
validates the file
with spoofed file
invalidates the file
:mode option
strict mode
with valid file
validates the file (FAILED - 22)
with spoofed file
invalidates the file (FAILED - 23)
relaxed mode
with valid file
validates the file
with spoofed file
validates the file
default mode
with valid file
validates the file
with spoofed file
invalidates the file
image data as json string
for invalid content type
is expected not to be valid
for valid content type
is expected to be valid
empty json string
is expected to be valid
empty string
is expected to be valid
invalid json string
is expected not to be valid
image data as hash
for invalid content type
is expected not to be valid
for valid content type
is expected to be valid
empty hash
is expected to be valid
image data as array
for one invalid content type
is expected not to be valid
for two invalid content types
is invalid and adds just one error
for valid content type
is expected to be valid
empty array
is expected to be valid
File Size Validator integration with ActiveModel
:in option
as a range
when file size is out of range
is expected not to be valid
when file size is out of range
is expected not to be valid
when file size within range
is expected to be valid
as a proc
when file size is out of range
is expected not to be valid
when file size is out of range
is expected not to be valid
when file size within range
is expected to be valid
:greater_than and :less_than option
as numbers
when file size is out of range
is expected not to be valid
when file size is out of range
is expected not to be valid
when file size within range
is expected to be valid
as procs
when file size is out of range
is expected not to be valid
when file size is out of range
is expected not to be valid
when file size within range
is expected to be valid
:less_than_or_equal_to option
when file size is greater than the specified size
is expected not to be valid
when file size within the specified size
is expected to be valid
:greater_than_or_equal_to option
when file size is less than the specified size
is expected not to be valid
when file size within the specified size
is expected to be valid
:less_than option
when file size is greater than the specified size
is expected not to be valid
when file size within the specified size
is expected to be valid
:greater_than option
when file size is less than the specified size
is expected not to be valid
when file size within the specified size
is expected to be valid
image data as json string
when file size is less than the specified size
is expected not to be valid
when file size within the specified size
is expected to be valid
empty json string
is expected to be valid
empty string
is expected to be valid
invalid json string
is expected not to be valid
image data as hash
when file size is less than the specified size
is expected not to be valid
when file size within the specified size
is expected to be valid
empty hash
is expected to be valid
image data as array
when size of one file is less than the specified size
is expected not to be valid
when size of all files is within the specified size
is invalid and adds just one error
when size of all files is less than the specified size
is expected to be valid
one file
when file size is out of range
is expected not to be valid
when file size within range
is expected to be valid
empty array
is expected to be valid
FileValidators::MimeTypeAnalyzer
rises error when tool is invalid
:file analyzer
determines MIME type from file contents (FAILED - 24)
returns text/plain for unidentified MIME types (FAILED - 25)
is able to determine MIME type for spoofed files (FAILED - 26)
is able to determine MIME type for non-files (FAILED - 27)
returns nil for empty IOs
raises error if file command is not found
:fastimage analyzer
extracts MIME type of any IO
returns nil for unidentified MIME types
returns nil for empty IOs
:mimemagic analyzer
extracts MIME type of any IO
returns nil for unidentified MIME types
returns nil for empty IOs
:marcel analyzer
extracts MIME type of any IO
returns application/octet-stream for unidentified MIME types
returns nil for empty IOs
:mime_types analyzer
extract MIME type from the file extension
extracts MIME type from file extension when IO is empty
returns nil on unknown extension
returns nil when input is not a file
:mini_mime analyzer
extract MIME type from the file extension
extracts MIME type from file extension when IO is empty
returns nil on unkown extension
returns nil when input is not a file
ActiveModel::Validations::FileContentTypeValidator
whitelist format
with an allowed type
as a string
is expected to allow file content type "image/jpg" and #<ActiveModel::Validations::FileContentTypeValidator:0x0000557b87dcdd88 @attributes=[:avatar], @options={:allow=>"image/jpg"}>
as an regexp
is expected to allow file content type "image/png" and #<ActiveModel::Validations::FileContentTypeValidator:0x0000557b87ddfc68 @attributes=[:avatar], @options={:allow=>/^image\/.*/}>
as a list
is expected to allow file content type "image/png" and #<ActiveModel::Validations::FileContentTypeValidator:0x0000557b87de40d8 @attributes=[:avatar], @options={:allow=>["image/png", "image/jpg", "image/jpeg"]}>
as a proc
is expected to allow file content type "image/png" and #<ActiveModel::Validations::FileContentTypeValidator:0x0000557b87df5ec8 @attributes=[:avatar], @optio...build.So6/src/spec/lib/file_validators/validators/file_content_type_validator_spec.rb:34 (lambda)>}>
with a disallowed type
as a string
is expected not to allow file content type "image/jpeg" and #<ActiveModel::Validations::FileContentTypeValidator:0x0000557b87d676a0 @attributes=[:avatar], @options={:allow=>"image/png"}>
as a regexp
is expected not to allow file content type "image/png" and #<ActiveModel::Validations::FileContentTypeValidator:0x0000557b87d6cc40 @attributes=[:avatar], @options={:allow=>/^text\/.*/}>
as a proc
is expected not to allow file content type "image/png" and #<ActiveModel::Validations::FileContentTypeValidator:0x0000557b87aa96c0 @attributes=[:avatar], @optio...build.So6/src/spec/lib/file_validators/validators/file_content_type_validator_spec.rb:51 (lambda)>}>
with :message option
without interpolation
is expected not to allow file content type "image/jpeg", #<ActiveModel::Validations::FileContentTypeValidator:0x0000557b87d82270 @attributes=[:avatar], @options={:allow=>"image/png", :message=>"should be a PNG image"}>, and {:message=>"Avatar should be a PNG image"}
with interpolation
is expected not to allow file content type "image/jpeg", #<ActiveModel::Validations::FileContentTypeValidator:0x0000557b87d88238 @attributes=[:avatar], @options={:allow=>"image/png", :message=>"should have content type %{types}"}>, and {:message=>"Avatar should have content type image/png"}
is expected to allow file content type "image/png", #<ActiveModel::Validations::FileContentTypeValidator:0x0000557b87a39cd0 @attributes=[:avatar], @options={:allow=>"image/png", :message=>"should have content type %{types}"}>, and {:message=>"Avatar should have content type image/png"}
default message
is expected not to allow file content type "image/jpeg", #<ActiveModel::Validations::FileContentTypeValidator:0x0000557b87e6d7c0 @attributes=[:avatar], @options={:allow=>"image/png"}>, and {:message=>"Avatar file should be one of image/png"}
blacklist format
with an allowed type
as a string
is expected to allow file content type "image/png" and #<ActiveModel::Validations::FileContentTypeValidator:0x0000557b87a0c8e8 @attributes=[:avatar], @options={:exclude=>"image/gif"}>
as an regexp
is expected to allow file content type "image/png" and #<ActiveModel::Validations::FileContentTypeValidator:0x0000557b87e7d968 @attributes=[:avatar], @options={:exclude=>/^text\/.*/}>
as a list
is expected to allow file content type "image/gif" and #<ActiveModel::Validations::FileContentTypeValidator:0x0000557b879ec7c8 @attributes=[:avatar], @options={:exclude=>["image/png", "image/jpg", "image/jpeg"]}>
as a proc
is expected to allow file content type "image/gif" and #<ActiveModel::Validations::FileContentTypeValidator:0x0000557b87e88cc8 @attributes=[:avatar], @optio...uild.So6/src/spec/lib/file_validators/validators/file_content_type_validator_spec.rb:123 (lambda)>}>
with a disallowed type
as a string
is expected not to allow file content type "image/gif" and #<ActiveModel::Validations::FileContentTypeValidator:0x0000557b87e93100 @attributes=[:avatar], @options={:exclude=>"image/gif"}>
as an regexp
is expected not to allow file content type "text/plain" and #<ActiveModel::Validations::FileContentTypeValidator:0x0000557b87e9a5b8 @attributes=[:avatar], @options={:exclude=>/^text\/.*/}>
as an proc
is expected not to allow file content type "text/plain" and #<ActiveModel::Validations::FileContentTypeValidator:0x0000557b87ea1e30 @attributes=[:avatar], @optio...uild.So6/src/spec/lib/file_validators/validators/file_content_type_validator_spec.rb:140 (lambda)>}>
with :message option
without interpolation
is expected not to allow file content type "image/png", #<ActiveModel::Validations::FileContentTypeValidator:0x0000557b87ea93b0 @attributes=[:avatar], @options={:exclude=>"image/png", :message=>"should not be a PNG image"}>, and {:message=>"Avatar should not be a PNG image"}
with interpolation
is expected not to allow file content type "image/png", #<ActiveModel::Validations::FileContentTypeValidator:0x0000557b87eb0868 @attributes=[:avatar], @options={:exclude=>"image/png", :message=>"should not have content type %{types}"}>, and {:message=>"Avatar should not have content type image/png"}
is expected to allow file content type "image/jpeg", #<ActiveModel::Validations::FileContentTypeValidator:0x0000557b87ec7a68 @attributes=[:avatar], @options={:exclude=>"image/png", :message=>"should not have content type %{types}"}>, and {:message=>"Avatar should not have content type image/jpeg"}
default message
is expected not to allow file content type "image/png", #<ActiveModel::Validations::FileContentTypeValidator:0x0000557b87ed7d00 @attributes=[:avatar], @options={:exclude=>"image/png"}>, and {:message=>"Avatar file cannot be image/png"}
using the helper
adds the validator to the class
given options
raises argument error if no required argument was given
does not raise error if :allow is string, array, regexp or a proc
raises argument error if :allow is neither a string, array, regexp nor proc
does not raise error if :exclude is string, array, regexp or a proc
raises argument error if :exclude is neither a string, array, regexp nor proc
ActiveModel::Validations::FileSizeValidator
with :in option
as a range
is expected to allow file size 7168 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b876e5200 @attributes=[:avatar], @options={:in=>5120..10240}>
is expected not to allow file size 4096 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b87fa9c60 @attributes=[:avatar], @options={:in=>5120..10240}>
is expected not to allow file size 11264 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b87fbe070 @attributes=[:avatar], @options={:in=>5120..10240}>
as a proc
is expected to allow file size 7168 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b87fd2750 @attributes=[:avatar], @options={:in...downtmp/build.So6/src/spec/lib/file_validators/validators/file_size_validator_spec.rb:38 (lambda)>}>
is expected not to allow file size 4096 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b87fd85d8 @attributes=[:avatar], @options={:in...downtmp/build.So6/src/spec/lib/file_validators/validators/file_size_validator_spec.rb:38 (lambda)>}>
is expected not to allow file size 11264 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b87fec858 @attributes=[:avatar], @options={:in...downtmp/build.So6/src/spec/lib/file_validators/validators/file_size_validator_spec.rb:38 (lambda)>}>
with :greater_than_or_equal_to option
as a number
is expected to allow file size 11264 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b88000588 @attributes=[:avatar], @options={:greater_than_or_equal_to=>10240}>
is expected to allow file size 10240 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b8800fd08 @attributes=[:avatar], @options={:greater_than_or_equal_to=>10240}>
is expected not to allow file size 9216 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b880161f8 @attributes=[:avatar], @options={:greater_than_or_equal_to=>10240}>
as a proc
is expected to allow file size 11264 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b8802bdc8 @attributes=[:avatar], @options={:gr...downtmp/build.So6/src/spec/lib/file_validators/validators/file_size_validator_spec.rb:56 (lambda)>}>
is expected to allow file size 10240 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b875b7400 @attributes=[:avatar], @options={:gr...downtmp/build.So6/src/spec/lib/file_validators/validators/file_size_validator_spec.rb:56 (lambda)>}>
is expected not to allow file size 9216 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b8753a4c8 @attributes=[:avatar], @options={:gr...downtmp/build.So6/src/spec/lib/file_validators/validators/file_size_validator_spec.rb:56 (lambda)>}>
with :less_than_or_equal_to option
as a number
is expected to allow file size 9216 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b874450e0 @attributes=[:avatar], @options={:less_than_or_equal_to=>10240}>
is expected to allow file size 10240 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b873e2bc0 @attributes=[:avatar], @options={:less_than_or_equal_to=>10240}>
is expected not to allow file size 11264 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b87080130 @attributes=[:avatar], @options={:less_than_or_equal_to=>10240}>
as a proc
is expected to allow file size 9216 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b86be0300 @attributes=[:avatar], @options={:le...downtmp/build.So6/src/spec/lib/file_validators/validators/file_size_validator_spec.rb:74 (lambda)>}>
is expected to allow file size 10240 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b86ac9ea8 @attributes=[:avatar], @options={:le...downtmp/build.So6/src/spec/lib/file_validators/validators/file_size_validator_spec.rb:74 (lambda)>}>
is expected not to allow file size 11264 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b8802bcd8 @attributes=[:avatar], @options={:le...downtmp/build.So6/src/spec/lib/file_validators/validators/file_size_validator_spec.rb:74 (lambda)>}>
with :greater_than option
as a number
is expected to allow file size 11264 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b880163d8 @attributes=[:avatar], @options={:greater_than=>10240}>
is expected not to allow file size 10240 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b8800b550 @attributes=[:avatar], @options={:greater_than=>10240}>
as a proc
is expected to allow file size 11264 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b87ff63f8 @attributes=[:avatar], @options={:gr...downtmp/build.So6/src/spec/lib/file_validators/validators/file_size_validator_spec.rb:91 (lambda)>}>
is expected not to allow file size 10240 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b87fe71a0 @attributes=[:avatar], @options={:gr...downtmp/build.So6/src/spec/lib/file_validators/validators/file_size_validator_spec.rb:91 (lambda)>}>
with :less_than option
as a number
is expected to allow file size 9216 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b87fd1aa8 @attributes=[:avatar], @options={:less_than=>10240}>
is expected not to allow file size 10240 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b87fc6bf8 @attributes=[:avatar], @options={:less_than=>10240}>
as a proc
is expected to allow file size 9216 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b87fb1aa0 @attributes=[:avatar], @options={:le...owntmp/build.So6/src/spec/lib/file_validators/validators/file_size_validator_spec.rb:107 (lambda)>}>
is expected not to allow file size 10240 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b87fa6830 @attributes=[:avatar], @options={:le...owntmp/build.So6/src/spec/lib/file_validators/validators/file_size_validator_spec.rb:107 (lambda)>}>
with :greater_than and :less_than option
as a number
is expected to allow file size 7168 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b87f949c8 @attributes=[:avatar], @options={:greater_than=>5120, :less_than=>10240}>
is expected not to allow file size 5120 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b87f78958 @attributes=[:avatar], @options={:greater_than=>5120, :less_than=>10240}>
is expected not to allow file size 10240 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b87ecc068 @attributes=[:avatar], @options={:greater_than=>5120, :less_than=>10240}>
as a proc
is expected to allow file size 7168 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b87eb2f50 @attributes=[:avatar], @options={:gr...owntmp/build.So6/src/spec/lib/file_validators/validators/file_size_validator_spec.rb:126 (lambda)>}>
is expected not to allow file size 5120 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b87eab6d8 @attributes=[:avatar], @options={:gr...owntmp/build.So6/src/spec/lib/file_validators/validators/file_size_validator_spec.rb:126 (lambda)>}>
is expected not to allow file size 10240 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b87e9eaa0 @attributes=[:avatar], @options={:gr...owntmp/build.So6/src/spec/lib/file_validators/validators/file_size_validator_spec.rb:126 (lambda)>}>
with :message option
is expected not to allow file size 11264, #<ActiveModel::Validations::FileSizeValidator:0x0000557b87e912b0 @attributes=[:avatar], @options={:in=>5120..10240, :message=>"is invalid. (Between %{min} and %{max} please.)"}>, and {:message=>"Avatar is invalid. (Between 5 KB and 10 KB please.)"}
is expected to allow file size 7168, #<ActiveModel::Validations::FileSizeValidator:0x0000557b87e82878 @attributes=[:avatar], @options={:in=>5120..10240, :message=>"is invalid. (Between %{min} and %{max} please.)"}>, and {:message=>"Avatar is invalid. (Between 5 KB and 10 KB please.)"}
default error message
given :in options
is expected not to allow file size 11264, #<ActiveModel::Validations::FileSizeValidator:0x0000557b87e7a448 @attributes=[:avatar], @options={:in=>5120..10240}>, and {:message=>"Avatar file size must be between 5 KB and 10 KB"}
is expected not to allow file size 4096, #<ActiveModel::Validations::FileSizeValidator:0x0000557b87d969a0 @attributes=[:avatar], @options={:in=>5120..10240}>, and {:message=>"Avatar file size must be between 5 KB and 10 KB"}
given :greater_than and :less_than options
is expected not to allow file size 11264, #<ActiveModel::Validations::FileSizeValidator:0x0000557b87d865f0 @attributes=[:avatar], @options={:greater_than=>5120, :less_than=>10240}>, and {:message=>"Avatar file size must be less than 10 KB"}
is expected not to allow file size 4096, #<ActiveModel::Validations::FileSizeValidator:0x0000557b87d785b8 @attributes=[:avatar], @options={:greater_than=>5120, :less_than=>10240}>, and {:message=>"Avatar file size must be greater than 5 KB"}
given :greater_than_or_equal_to and :less_than_or_equal_to options
is expected not to allow file size 11264, #<ActiveModel::Validations::FileSizeValidator:0x0000557b87d69bf8 @attributes=[:avatar], @options={:greater_than_or_equal_to=>5120, :less_than_or_equal_to=>10240}>, and {:message=>"Avatar file size must be less than or equal to 10 KB"}
is expected not to allow file size 4096, #<ActiveModel::Validations::FileSizeValidator:0x0000557b87def820 @attributes=[:avatar], @options={:greater_than_or_equal_to=>5120, :less_than_or_equal_to=>10240}>, and {:message=>"Avatar file size must be greater than or equal to 5 KB"}
exceptional file size
is expected to allow file size 0 and #<ActiveModel::Validations::FileSizeValidator:0x0000557b87dd4b88 @attributes=[:avatar], @options={:less_than=>3072}>
is expected not to allow file size nil and #<ActiveModel::Validations::FileSizeValidator:0x0000557b87dc5930 @attributes=[:avatar], @options={:less_than=>3072}>
using the helper
adds the validator to the class
given options
raises argument error if no required argument was given
does not raise argument error if :less_than is numeric or a proc
raises error if :less_than is neither a number nor a proc
does not raise argument error if :less_than_or_equal_to is numeric or a proc
raises error if :less_than_or_equal_to is neither a number nor a proc
does not raise argument error if :greater_than is numeric or a proc
raises error if :greater_than is neither a number nor a proc
does not raise argument error if :greater_than_or_equal_to is numeric or a proc
raises error if :greater_than_or_equal_to is neither a number nor a proc
does not raise argument error if :in is a range or a proc
raises error if :in is neither a range nor a proc
Failures:
1) File Content Type integration with ActiveModel :allow option as a regex with an allowed types validates jpeg image file
Failure/Error: expect(subject).to be_valid
FileValidators::Error:
file command-line tool is not installed
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:45:in `rescue in extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:24:in `extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:16:in `call'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:60:in `get_content_type'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:30:in `block in validate_each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `validate_each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:152:in `block in validate'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `validate'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:428:in `block in make_lambda'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:200:in `block (2 levels) in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:605:in `block (2 levels) in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `catch'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `block in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:201:in `block in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `block in invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `each'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:134:in `run_callbacks'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:825:in `_run_validate_callbacks'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:406:in `run_validations!'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:337:in `valid?'
# ./spec/integration/file_content_type_validation_integration_spec.rb:55:in `block (5 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::ENOENT:
# No such file or directory - file
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:29:in `extract_with_file'
2) File Content Type integration with ActiveModel :allow option as a regex with an allowed types validates png image file
Failure/Error: expect(subject).to be_valid
FileValidators::Error:
file command-line tool is not installed
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:45:in `rescue in extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:24:in `extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:16:in `call'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:60:in `get_content_type'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:30:in `block in validate_each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `validate_each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:152:in `block in validate'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `validate'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:428:in `block in make_lambda'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:200:in `block (2 levels) in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:605:in `block (2 levels) in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `catch'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `block in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:201:in `block in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `block in invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `each'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:134:in `run_callbacks'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:825:in `_run_validate_callbacks'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:406:in `run_validations!'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:337:in `valid?'
# ./spec/integration/file_content_type_validation_integration_spec.rb:60:in `block (5 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::ENOENT:
# No such file or directory - file
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:29:in `extract_with_file'
3) File Content Type integration with ActiveModel :allow option as a regex with a disallowed type is expected not to be valid
Failure/Error: it { is_expected.not_to be_valid }
FileValidators::Error:
file command-line tool is not installed
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:45:in `rescue in extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:24:in `extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:16:in `call'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:60:in `get_content_type'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:30:in `block in validate_each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `validate_each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:152:in `block in validate'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `validate'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:428:in `block in make_lambda'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:200:in `block (2 levels) in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:605:in `block (2 levels) in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `catch'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `block in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:201:in `block in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `block in invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `each'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:134:in `run_callbacks'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:825:in `_run_validate_callbacks'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:406:in `run_validations!'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:337:in `valid?'
# ./spec/integration/file_content_type_validation_integration_spec.rb:66:in `block (5 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::ENOENT:
# No such file or directory - file
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:29:in `extract_with_file'
4) File Content Type integration with ActiveModel :allow option as a list with allowed types validates jpeg
Failure/Error: expect(subject).to be_valid
FileValidators::Error:
file command-line tool is not installed
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:45:in `rescue in extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:24:in `extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:16:in `call'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:60:in `get_content_type'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:30:in `block in validate_each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `validate_each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:152:in `block in validate'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `validate'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:428:in `block in make_lambda'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:200:in `block (2 levels) in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:605:in `block (2 levels) in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `catch'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `block in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:201:in `block in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `block in invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `each'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:134:in `run_callbacks'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:825:in `_run_validate_callbacks'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:406:in `run_validations!'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:337:in `valid?'
# ./spec/integration/file_content_type_validation_integration_spec.rb:84:in `block (5 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::ENOENT:
# No such file or directory - file
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:29:in `extract_with_file'
5) File Content Type integration with ActiveModel :allow option as a list with allowed types validates text file
Failure/Error: expect(subject).to be_valid
FileValidators::Error:
file command-line tool is not installed
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:45:in `rescue in extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:24:in `extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:16:in `call'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:60:in `get_content_type'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:30:in `block in validate_each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `validate_each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:152:in `block in validate'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `validate'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:428:in `block in make_lambda'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:200:in `block (2 levels) in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:605:in `block (2 levels) in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `catch'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `block in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:201:in `block in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `block in invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `each'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:134:in `run_callbacks'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:825:in `_run_validate_callbacks'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:406:in `run_validations!'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:337:in `valid?'
# ./spec/integration/file_content_type_validation_integration_spec.rb:89:in `block (5 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::ENOENT:
# No such file or directory - file
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:29:in `extract_with_file'
6) File Content Type integration with ActiveModel :allow option as a list with a disallowed type is expected not to be valid
Failure/Error: it { is_expected.not_to be_valid }
FileValidators::Error:
file command-line tool is not installed
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:45:in `rescue in extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:24:in `extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:16:in `call'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:60:in `get_content_type'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:30:in `block in validate_each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `validate_each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:152:in `block in validate'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `validate'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:428:in `block in make_lambda'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:200:in `block (2 levels) in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:605:in `block (2 levels) in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `catch'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `block in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:201:in `block in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `block in invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `each'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:134:in `run_callbacks'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:825:in `_run_validate_callbacks'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:406:in `run_validations!'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:337:in `valid?'
# ./spec/integration/file_content_type_validation_integration_spec.rb:95:in `block (5 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::ENOENT:
# No such file or directory - file
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:29:in `extract_with_file'
7) File Content Type integration with ActiveModel :allow option as a proc with allowed types validates jpeg
Failure/Error: expect(subject).to be_valid
FileValidators::Error:
file command-line tool is not installed
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:45:in `rescue in extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:24:in `extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:16:in `call'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:60:in `get_content_type'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:30:in `block in validate_each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `validate_each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:152:in `block in validate'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `validate'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:428:in `block in make_lambda'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:200:in `block (2 levels) in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:605:in `block (2 levels) in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `catch'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `block in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:201:in `block in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `block in invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `each'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:134:in `run_callbacks'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:825:in `_run_validate_callbacks'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:406:in `run_validations!'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:337:in `valid?'
# ./spec/integration/file_content_type_validation_integration_spec.rb:113:in `block (5 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::ENOENT:
# No such file or directory - file
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:29:in `extract_with_file'
8) File Content Type integration with ActiveModel :allow option as a proc with allowed types validates text file
Failure/Error: expect(subject).to be_valid
FileValidators::Error:
file command-line tool is not installed
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:45:in `rescue in extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:24:in `extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:16:in `call'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:60:in `get_content_type'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:30:in `block in validate_each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `validate_each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:152:in `block in validate'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `validate'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:428:in `block in make_lambda'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:200:in `block (2 levels) in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:605:in `block (2 levels) in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `catch'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `block in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:201:in `block in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `block in invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `each'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:134:in `run_callbacks'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:825:in `_run_validate_callbacks'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:406:in `run_validations!'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:337:in `valid?'
# ./spec/integration/file_content_type_validation_integration_spec.rb:118:in `block (5 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::ENOENT:
# No such file or directory - file
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:29:in `extract_with_file'
9) File Content Type integration with ActiveModel :allow option as a proc with a disallowed type is expected not to be valid
Failure/Error: it { is_expected.not_to be_valid }
FileValidators::Error:
file command-line tool is not installed
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:45:in `rescue in extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:24:in `extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:16:in `call'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:60:in `get_content_type'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:30:in `block in validate_each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `validate_each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:152:in `block in validate'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `validate'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:428:in `block in make_lambda'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:200:in `block (2 levels) in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:605:in `block (2 levels) in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `catch'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `block in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:201:in `block in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `block in invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `each'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:134:in `run_callbacks'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:825:in `_run_validate_callbacks'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:406:in `run_validations!'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:337:in `valid?'
# ./spec/integration/file_content_type_validation_integration_spec.rb:124:in `block (5 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::ENOENT:
# No such file or directory - file
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:29:in `extract_with_file'
10) File Content Type integration with ActiveModel :exclude option a string with an allowed type is expected to be valid
Failure/Error: it { is_expected.to be_valid }
FileValidators::Error:
file command-line tool is not installed
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:45:in `rescue in extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:24:in `extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:16:in `call'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:60:in `get_content_type'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:30:in `block in validate_each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `validate_each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:152:in `block in validate'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `validate'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:428:in `block in make_lambda'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:200:in `block (2 levels) in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:605:in `block (2 levels) in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `catch'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `block in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:201:in `block in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `block in invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `each'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:134:in `run_callbacks'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:825:in `_run_validate_callbacks'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:406:in `run_validations!'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:337:in `valid?'
# ./spec/integration/file_content_type_validation_integration_spec.rb:142:in `block (5 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::ENOENT:
# No such file or directory - file
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:29:in `extract_with_file'
11) File Content Type integration with ActiveModel :exclude option a string with a disallowed type is expected not to be valid
Failure/Error: it { is_expected.not_to be_valid }
FileValidators::Error:
file command-line tool is not installed
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:45:in `rescue in extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:24:in `extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:16:in `call'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:60:in `get_content_type'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:30:in `block in validate_each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `validate_each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:152:in `block in validate'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `validate'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:428:in `block in make_lambda'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:200:in `block (2 levels) in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:605:in `block (2 levels) in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `catch'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `block in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:201:in `block in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `block in invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `each'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:134:in `run_callbacks'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:825:in `_run_validate_callbacks'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:406:in `run_validations!'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:337:in `valid?'
# ./spec/integration/file_content_type_validation_integration_spec.rb:147:in `block (5 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::ENOENT:
# No such file or directory - file
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:29:in `extract_with_file'
12) File Content Type integration with ActiveModel :exclude option as a regex with an allowed type is expected to be valid
Failure/Error: it { is_expected.to be_valid }
FileValidators::Error:
file command-line tool is not installed
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:45:in `rescue in extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:24:in `extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:16:in `call'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:60:in `get_content_type'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:30:in `block in validate_each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `validate_each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:152:in `block in validate'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `validate'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:428:in `block in make_lambda'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:200:in `block (2 levels) in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:605:in `block (2 levels) in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `catch'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `block in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:201:in `block in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `block in invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `each'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:134:in `run_callbacks'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:825:in `_run_validate_callbacks'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:406:in `run_validations!'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:337:in `valid?'
# ./spec/integration/file_content_type_validation_integration_spec.rb:163:in `block (5 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::ENOENT:
# No such file or directory - file
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:29:in `extract_with_file'
13) File Content Type integration with ActiveModel :exclude option as a regex with a disallowed types invalidates jpeg image file
Failure/Error: expect(subject).not_to be_valid
FileValidators::Error:
file command-line tool is not installed
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:45:in `rescue in extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:24:in `extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:16:in `call'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:60:in `get_content_type'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:30:in `block in validate_each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `validate_each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:152:in `block in validate'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `validate'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:428:in `block in make_lambda'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:200:in `block (2 levels) in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:605:in `block (2 levels) in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `catch'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `block in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:201:in `block in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `block in invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `each'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:134:in `run_callbacks'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:825:in `_run_validate_callbacks'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:406:in `run_validations!'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:337:in `valid?'
# ./spec/integration/file_content_type_validation_integration_spec.rb:169:in `block (5 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::ENOENT:
# No such file or directory - file
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:29:in `extract_with_file'
14) File Content Type integration with ActiveModel :exclude option as a regex with a disallowed types invalidates png image file
Failure/Error: expect(subject).not_to be_valid
FileValidators::Error:
file command-line tool is not installed
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:45:in `rescue in extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:24:in `extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:16:in `call'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:60:in `get_content_type'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:30:in `block in validate_each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `validate_each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:152:in `block in validate'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `validate'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:428:in `block in make_lambda'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:200:in `block (2 levels) in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:605:in `block (2 levels) in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `catch'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `block in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:201:in `block in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `block in invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `each'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:134:in `run_callbacks'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:825:in `_run_validate_callbacks'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:406:in `run_validations!'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:337:in `valid?'
# ./spec/integration/file_content_type_validation_integration_spec.rb:174:in `block (5 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::ENOENT:
# No such file or directory - file
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:29:in `extract_with_file'
15) File Content Type integration with ActiveModel :exclude option as a list with an allowed type is expected to be valid
Failure/Error: it { is_expected.to be_valid }
FileValidators::Error:
file command-line tool is not installed
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:45:in `rescue in extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:24:in `extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:16:in `call'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:60:in `get_content_type'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:30:in `block in validate_each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `validate_each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:152:in `block in validate'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `validate'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:428:in `block in make_lambda'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:200:in `block (2 levels) in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:605:in `block (2 levels) in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `catch'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `block in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:201:in `block in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `block in invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `each'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:134:in `run_callbacks'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:825:in `_run_validate_callbacks'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:406:in `run_validations!'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:337:in `valid?'
# ./spec/integration/file_content_type_validation_integration_spec.rb:192:in `block (5 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::ENOENT:
# No such file or directory - file
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:29:in `extract_with_file'
16) File Content Type integration with ActiveModel :exclude option as a list with a disallowed types invalidates jpeg
Failure/Error: expect(subject).not_to be_valid
FileValidators::Error:
file command-line tool is not installed
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:45:in `rescue in extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:24:in `extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:16:in `call'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:60:in `get_content_type'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:30:in `block in validate_each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `validate_each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:152:in `block in validate'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `validate'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:428:in `block in make_lambda'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:200:in `block (2 levels) in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:605:in `block (2 levels) in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `catch'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `block in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:201:in `block in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `block in invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `each'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:134:in `run_callbacks'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:825:in `_run_validate_callbacks'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:406:in `run_validations!'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:337:in `valid?'
# ./spec/integration/file_content_type_validation_integration_spec.rb:198:in `block (5 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::ENOENT:
# No such file or directory - file
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:29:in `extract_with_file'
17) File Content Type integration with ActiveModel :exclude option as a list with a disallowed types invalidates text file
Failure/Error: expect(subject).not_to be_valid
FileValidators::Error:
file command-line tool is not installed
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:45:in `rescue in extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:24:in `extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:16:in `call'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:60:in `get_content_type'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:30:in `block in validate_each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `validate_each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:152:in `block in validate'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `validate'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:428:in `block in make_lambda'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:200:in `block (2 levels) in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:605:in `block (2 levels) in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `catch'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `block in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:201:in `block in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `block in invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `each'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:134:in `run_callbacks'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:825:in `_run_validate_callbacks'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:406:in `run_validations!'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:337:in `valid?'
# ./spec/integration/file_content_type_validation_integration_spec.rb:203:in `block (5 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::ENOENT:
# No such file or directory - file
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:29:in `extract_with_file'
18) File Content Type integration with ActiveModel :exclude option as a proc with an allowed type is expected to be valid
Failure/Error: it { is_expected.to be_valid }
FileValidators::Error:
file command-line tool is not installed
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:45:in `rescue in extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:24:in `extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:16:in `call'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:60:in `get_content_type'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:30:in `block in validate_each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `validate_each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:152:in `block in validate'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `validate'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:428:in `block in make_lambda'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:200:in `block (2 levels) in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:605:in `block (2 levels) in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `catch'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `block in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:201:in `block in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `block in invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `each'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:134:in `run_callbacks'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:825:in `_run_validate_callbacks'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:406:in `run_validations!'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:337:in `valid?'
# ./spec/integration/file_content_type_validation_integration_spec.rb:221:in `block (5 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::ENOENT:
# No such file or directory - file
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:29:in `extract_with_file'
19) File Content Type integration with ActiveModel :exclude option as a proc with a disallowed types invalidates jpeg image file
Failure/Error: expect(subject).not_to be_valid
FileValidators::Error:
file command-line tool is not installed
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:45:in `rescue in extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:24:in `extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:16:in `call'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:60:in `get_content_type'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:30:in `block in validate_each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `validate_each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:152:in `block in validate'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `validate'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:428:in `block in make_lambda'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:200:in `block (2 levels) in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:605:in `block (2 levels) in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `catch'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `block in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:201:in `block in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `block in invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `each'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:134:in `run_callbacks'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:825:in `_run_validate_callbacks'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:406:in `run_validations!'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:337:in `valid?'
# ./spec/integration/file_content_type_validation_integration_spec.rb:227:in `block (5 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::ENOENT:
# No such file or directory - file
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:29:in `extract_with_file'
20) File Content Type integration with ActiveModel :allow and :exclude combined with an allowed type is expected to be valid
Failure/Error: it { is_expected.to be_valid }
FileValidators::Error:
file command-line tool is not installed
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:45:in `rescue in extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:24:in `extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:16:in `call'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:60:in `get_content_type'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:30:in `block in validate_each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `validate_each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:152:in `block in validate'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `validate'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:428:in `block in make_lambda'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:200:in `block (2 levels) in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:605:in `block (2 levels) in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `catch'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `block in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:201:in `block in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `block in invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `each'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:134:in `run_callbacks'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:825:in `_run_validate_callbacks'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:406:in `run_validations!'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:337:in `valid?'
# ./spec/integration/file_content_type_validation_integration_spec.rb:246:in `block (4 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::ENOENT:
# No such file or directory - file
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:29:in `extract_with_file'
21) File Content Type integration with ActiveModel :allow and :exclude combined with a disallowed type is expected not to be valid
Failure/Error: it { is_expected.not_to be_valid }
FileValidators::Error:
file command-line tool is not installed
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:45:in `rescue in extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:24:in `extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:16:in `call'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:60:in `get_content_type'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:30:in `block in validate_each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `validate_each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:152:in `block in validate'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `validate'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:428:in `block in make_lambda'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:200:in `block (2 levels) in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:605:in `block (2 levels) in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `catch'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `block in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:201:in `block in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `block in invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `each'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:134:in `run_callbacks'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:825:in `_run_validate_callbacks'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:406:in `run_validations!'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:337:in `valid?'
# ./spec/integration/file_content_type_validation_integration_spec.rb:251:in `block (4 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::ENOENT:
# No such file or directory - file
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:29:in `extract_with_file'
22) File Content Type integration with ActiveModel :mode option strict mode with valid file validates the file
Failure/Error: expect(subject).to be_valid
FileValidators::Error:
file command-line tool is not installed
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:45:in `rescue in extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:24:in `extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:16:in `call'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:60:in `get_content_type'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:30:in `block in validate_each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `validate_each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:152:in `block in validate'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `validate'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:428:in `block in make_lambda'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:200:in `block (2 levels) in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:605:in `block (2 levels) in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `catch'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `block in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:201:in `block in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `block in invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `each'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:134:in `run_callbacks'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:825:in `_run_validate_callbacks'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:406:in `run_validations!'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:337:in `valid?'
# ./spec/integration/file_content_type_validation_integration_spec.rb:294:in `block (5 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::ENOENT:
# No such file or directory - file
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:29:in `extract_with_file'
23) File Content Type integration with ActiveModel :mode option strict mode with spoofed file invalidates the file
Failure/Error: expect(subject).not_to be_valid
FileValidators::Error:
file command-line tool is not installed
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:45:in `rescue in extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:24:in `extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:16:in `call'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:60:in `get_content_type'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:30:in `block in validate_each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `each'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/validators/file_content_type_validator.rb:29:in `validate_each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:152:in `block in validate'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `each'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `validate'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:428:in `block in make_lambda'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:200:in `block (2 levels) in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:605:in `block (2 levels) in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `catch'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `block in default_terminator'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:201:in `block in halting'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `block in invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `each'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `invoke_before'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:134:in `run_callbacks'
# /usr/share/rubygems-integration/all/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:825:in `_run_validate_callbacks'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:406:in `run_validations!'
# /usr/share/rubygems-integration/all/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:337:in `valid?'
# ./spec/integration/file_content_type_validation_integration_spec.rb:301:in `block (5 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::ENOENT:
# No such file or directory - file
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:29:in `extract_with_file'
24) FileValidators::MimeTypeAnalyzer :file analyzer determines MIME type from file contents
Failure/Error: expect(analyzer.call(cute_image)).to eq('image/jpeg')
FileValidators::Error:
file command-line tool is not installed
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:45:in `rescue in extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:24:in `extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:16:in `call'
# ./spec/lib/file_validators/mime_type_analyzer_spec.rb:23:in `block (3 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::ENOENT:
# No such file or directory - file
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:29:in `extract_with_file'
25) FileValidators::MimeTypeAnalyzer :file analyzer returns text/plain for unidentified MIME types
Failure/Error: expect(analyzer.call(fakeio('a' * 5 * 1024 * 1024))).to eq('text/plain')
FileValidators::Error:
file command-line tool is not installed
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:45:in `rescue in extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:24:in `extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:16:in `call'
# ./spec/lib/file_validators/mime_type_analyzer_spec.rb:27:in `block (3 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::ENOENT:
# No such file or directory - file
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:29:in `extract_with_file'
26) FileValidators::MimeTypeAnalyzer :file analyzer is able to determine MIME type for spoofed files
Failure/Error: expect(analyzer.call(spoofed_file)).to eq('text/plain')
FileValidators::Error:
file command-line tool is not installed
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:45:in `rescue in extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:24:in `extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:16:in `call'
# ./spec/lib/file_validators/mime_type_analyzer_spec.rb:31:in `block (3 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::ENOENT:
# No such file or directory - file
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:29:in `extract_with_file'
27) FileValidators::MimeTypeAnalyzer :file analyzer is able to determine MIME type for non-files
Failure/Error: expect(analyzer.call(fakeio(cute_image.read))).to eq('image/jpeg')
FileValidators::Error:
file command-line tool is not installed
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:45:in `rescue in extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:24:in `extract_with_file'
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:16:in `call'
# ./spec/lib/file_validators/mime_type_analyzer_spec.rb:35:in `block (3 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Errno::ENOENT:
# No such file or directory - file
# /usr/share/rubygems-integration/all/gems/file_validators-3.0.0/lib/file_validators/mime_type_analyzer.rb:29:in `extract_with_file'
Finished in 0.51659 seconds (files took 0.52379 seconds to load)
191 examples, 27 failures
Failed examples:
rspec ./spec/integration/file_content_type_validation_integration_spec.rb:53 # File Content Type integration with ActiveModel :allow option as a regex with an allowed types validates jpeg image file
rspec ./spec/integration/file_content_type_validation_integration_spec.rb:58 # File Content Type integration with ActiveModel :allow option as a regex with an allowed types validates png image file
rspec ./spec/integration/file_content_type_validation_integration_spec.rb:66 # File Content Type integration with ActiveModel :allow option as a regex with a disallowed type is expected not to be valid
rspec ./spec/integration/file_content_type_validation_integration_spec.rb:82 # File Content Type integration with ActiveModel :allow option as a list with allowed types validates jpeg
rspec ./spec/integration/file_content_type_validation_integration_spec.rb:87 # File Content Type integration with ActiveModel :allow option as a list with allowed types validates text file
rspec ./spec/integration/file_content_type_validation_integration_spec.rb:95 # File Content Type integration with ActiveModel :allow option as a list with a disallowed type is expected not to be valid
rspec ./spec/integration/file_content_type_validation_integration_spec.rb:111 # File Content Type integration with ActiveModel :allow option as a proc with allowed types validates jpeg
rspec ./spec/integration/file_content_type_validation_integration_spec.rb:116 # File Content Type integration with ActiveModel :allow option as a proc with allowed types validates text file
rspec ./spec/integration/file_content_type_validation_integration_spec.rb:124 # File Content Type integration with ActiveModel :allow option as a proc with a disallowed type is expected not to be valid
rspec ./spec/integration/file_content_type_validation_integration_spec.rb:142 # File Content Type integration with ActiveModel :exclude option a string with an allowed type is expected to be valid
rspec ./spec/integration/file_content_type_validation_integration_spec.rb:147 # File Content Type integration with ActiveModel :exclude option a string with a disallowed type is expected not to be valid
rspec ./spec/integration/file_content_type_validation_integration_spec.rb:163 # File Content Type integration with ActiveModel :exclude option as a regex with an allowed type is expected to be valid
rspec ./spec/integration/file_content_type_validation_integration_spec.rb:167 # File Content Type integration with ActiveModel :exclude option as a regex with a disallowed types invalidates jpeg image file
rspec ./spec/integration/file_content_type_validation_integration_spec.rb:172 # File Content Type integration with ActiveModel :exclude option as a regex with a disallowed types invalidates png image file
rspec ./spec/integration/file_content_type_validation_integration_spec.rb:192 # File Content Type integration with ActiveModel :exclude option as a list with an allowed type is expected to be valid
rspec ./spec/integration/file_content_type_validation_integration_spec.rb:196 # File Content Type integration with ActiveModel :exclude option as a list with a disallowed types invalidates jpeg
rspec ./spec/integration/file_content_type_validation_integration_spec.rb:201 # File Content Type integration with ActiveModel :exclude option as a list with a disallowed types invalidates text file
rspec ./spec/integration/file_content_type_validation_integration_spec.rb:221 # File Content Type integration with ActiveModel :exclude option as a proc with an allowed type is expected to be valid
rspec ./spec/integration/file_content_type_validation_integration_spec.rb:225 # File Content Type integration with ActiveModel :exclude option as a proc with a disallowed types invalidates jpeg image file
rspec ./spec/integration/file_content_type_validation_integration_spec.rb:246 # File Content Type integration with ActiveModel :allow and :exclude combined with an allowed type is expected to be valid
rspec ./spec/integration/file_content_type_validation_integration_spec.rb:251 # File Content Type integration with ActiveModel :allow and :exclude combined with a disallowed type is expected not to be valid
rspec ./spec/integration/file_content_type_validation_integration_spec.rb:292 # File Content Type integration with ActiveModel :mode option strict mode with valid file validates the file
rspec ./spec/integration/file_content_type_validation_integration_spec.rb:299 # File Content Type integration with ActiveModel :mode option strict mode with spoofed file invalidates the file
rspec ./spec/lib/file_validators/mime_type_analyzer_spec.rb:22 # FileValidators::MimeTypeAnalyzer :file analyzer determines MIME type from file contents
rspec ./spec/lib/file_validators/mime_type_analyzer_spec.rb:26 # FileValidators::MimeTypeAnalyzer :file analyzer returns text/plain for unidentified MIME types
rspec ./spec/lib/file_validators/mime_type_analyzer_spec.rb:30 # FileValidators::MimeTypeAnalyzer :file analyzer is able to determine MIME type for spoofed files
rspec ./spec/lib/file_validators/mime_type_analyzer_spec.rb:34 # FileValidators::MimeTypeAnalyzer :file analyzer is able to determine MIME type for non-files
[Coveralls] Outside the CI environment, not sending data.
Stopped processing SimpleCov as a previous error not related to SimpleCov has been detected
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.