Created
June 23, 2020 23:03
-
-
Save craigmcnamara/3cacc519d0c26179a919b658617c3f77 to your computer and use it in GitHub Desktop.
An example of setting up an ActiveStorage attachment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FactoryBot.define do | |
factory :thing do | |
after(:build) do |thing, evaluator| | |
file_path = Rails.root.join('spec/fixtures/files/image-needs-auto-orient.jpg') | |
thing.photos.attach(io: File.open(file_path), filename: 'photo.jpg') | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment