I'm looking for a way to create factories for models which have active storage attachments
I attempted the method in this post
with my factory
factory :activity_fit_file, class: 'Activity' do
association :user, factory: :user
activity_type {:cycling}
original_activity_log_file { fixture_file_upload("#{Rails.root}/spec/files/example_fit_file.fit") }
end
but I got this error
NoMethodError:
undefined method `fixture_file_upload' for #<FactoryBot::SyntaxRunner:0x000000000208c5f8>
What is the correct way to attach files in ActiveStorage?
undefined method upload' for nil:NilClass
# /home/user/.rvm/gems/ruby-2.5.1/gems/activestorage-5.2.0/app/models/active_storage/blob.rb:155:in upload'
– Brogan