demarches-normaliennes/spec/factories/commentaire.rb
Pierre de La Morinerie 43569f687e specs: use fixture_file_upload rather than Rack::Test::UploadedFile
This is mostly for consistency (both styles were used before).

Note: we still have to use `Rack::Test::UploadedFile.new` in factories,
because of https://github.com/thoughtbot/factory_bot/issues/385.
2020-07-01 11:13:45 +02:00

15 lines
384 B
Ruby

FactoryBot.define do
factory :commentaire do
body { 'plop' }
before(:create) do |commentaire, _evaluator|
if !commentaire.dossier
commentaire.dossier = create :dossier, :en_construction
end
end
trait :with_file do
piece_jointe { Rack::Test::UploadedFile.new('spec/fixtures/files/logo_test_procedure.png', 'image/png') }
end
end
end