models: require belong_to associations on champ
- Make `champ.dossier` a requirement; - Move the dossier_id assignation to `before_validation` (otherwise the record is invalid, and never gets saved); - Allow specs to only build the champ (instead of saving it to the database), which bypasses the requirement to have a dossier.
This commit is contained in:
parent
eb22dc9d8f
commit
6328011f60
13 changed files with 318 additions and 274 deletions
|
@ -2,7 +2,7 @@ RSpec.describe VirusScannerJob, type: :job do
|
|||
include ActiveJob::TestHelper
|
||||
|
||||
let(:champ) do
|
||||
champ = create(:champ, :piece_justificative)
|
||||
champ = create(:champ_piece_justificative)
|
||||
champ.piece_justificative_file.attach(io: StringIO.new("toto"), filename: "toto.txt", content_type: "text/plain")
|
||||
champ.save
|
||||
champ
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue