-
-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validations not locating file uploaded using fixture_file_upload using vips #323
Comments
Hi @douglasmorgen, Could you provide your model validations to help this out? |
@douglasmorgen I am not able to reproduce your issue :/ can you give me a bit more context? Like model validations? And maybe the complete caller trace? |
Stack trace is attached I think the relevant part is Validation is
|
Mmm this is quite weird, you are attaching a A few questions:
|
We encountered this as well. I noticed that eventually, Changing the test subject from |
Hi @evaniainbrooks, |
I guess it can be related to #328 |
Hi @douglasmorgen, For example, I set up the following model: class Camp::Lecture < ApplicationRecord
has_one_attached :video
validates :video,
size: { less_than: 20.megabytes },
content_type: { with:/\Avideo\/.*\z/, spoofing_protection: true }
end With the related build code using factory_bot: lecture = build(:lecture)
vid = Rack::Test::UploadedFile.new(File.join("spec/fixtures/files/example.mp4"), 'video/mp4')
lecture.video.attach(vid)
lecture.valid? And I have no issue whatsoever. The The issue you had will not reproduce in My only ideas for your issue are:
factory :active_storage_blob, class: 'ActiveStorage::Blob' do
key { Faker::Alphanumeric.alphanumeric(number: 24) }
filename { Faker::Alphanumeric.alpha(number: 15) }
metadata { { "identified" => true } }
byte_size { Faker::Number.number(digits: 5) }
checksum { Faker::Crypto.md5 }
trait :image do
content_type { "image/jpeg" }
transient do
image_width { 0 }
image_height { 0 }
end
after(:build) do |blob, evaluator|
blob.metadata.merge!(
width: evaluator.image_width,
height: evaluator.image_height
)
end
end
end This would indeed cause issue because the
I am a bit short of ideas, if you have any let me know and I'll do the best to help you |
It is fixed as of 1.4.0 thanks so much for your help. |
validations not locating file fixtures when using vips
Issue Summary:
Updating from 1.3.4 to 1.3.5 causes test failures when running validations using vips
Steps to Reproduce:
active_storage_validations
from 1.3.4 to 1.3.5.Observed Behavior:
Once you upgrade to 1.3.5:
Expected Behavior:
[2] pry(#<RSpec::ExampleGroups::Post::Validations>)> post.valid?
=> true
Environment:
-pry(#RSpec::ExampleGroups::Post::Validations)> ActiveStorage.analyzers
=> [ActiveStorage::Analyzer::ImageAnalyzer::Vips, ActiveStorage::Analyzer::ImageAnalyzer::ImageMagick, ActiveStorage::Analyzer::VideoAnalyzer, ActiveStorage::Analyzer::AudioAnalyzer]
Please let me know if additional information is needed. Thank you for your work on this gem!
The text was updated successfully, but these errors were encountered: