models: require belong_to associations on dossier
This commit is contained in:
parent
01248022bf
commit
51d392a1dc
4 changed files with 5 additions and 7 deletions
|
@ -75,10 +75,10 @@ class Dossier < ApplicationRecord
|
||||||
|
|
||||||
has_many :dossier_operation_logs, -> { order(:created_at) }, dependent: :nullify, inverse_of: :dossier
|
has_many :dossier_operation_logs, -> { order(:created_at) }, dependent: :nullify, inverse_of: :dossier
|
||||||
|
|
||||||
belongs_to :groupe_instructeur
|
belongs_to :groupe_instructeur, optional: false
|
||||||
has_one :procedure, through: :groupe_instructeur
|
has_one :procedure, through: :groupe_instructeur
|
||||||
belongs_to :revision, class_name: 'ProcedureRevision', optional: true
|
belongs_to :revision, class_name: 'ProcedureRevision', optional: true
|
||||||
belongs_to :user
|
belongs_to :user, optional: false
|
||||||
|
|
||||||
accepts_nested_attributes_for :champs
|
accepts_nested_attributes_for :champs
|
||||||
accepts_nested_attributes_for :champs_private
|
accepts_nested_attributes_for :champs_private
|
||||||
|
|
|
@ -2,7 +2,7 @@ FactoryBot.define do
|
||||||
factory :dossier do
|
factory :dossier do
|
||||||
autorisation_donnees { true }
|
autorisation_donnees { true }
|
||||||
state { Dossier.states.fetch(:brouillon) }
|
state { Dossier.states.fetch(:brouillon) }
|
||||||
association :user, factory: [:user]
|
association :user
|
||||||
|
|
||||||
transient do
|
transient do
|
||||||
procedure { nil }
|
procedure { nil }
|
||||||
|
|
|
@ -25,9 +25,7 @@ FactoryBot.define do
|
||||||
entreprise_date_creation { "1990-04-24" }
|
entreprise_date_creation { "1990-04-24" }
|
||||||
|
|
||||||
trait :with_exercices do
|
trait :with_exercices do
|
||||||
after(:create) do |etablissement, _evaluator|
|
exercices { [association(:exercice)] }
|
||||||
create(:exercice, etablissement: etablissement)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :with_effectif_mensuel do
|
trait :with_effectif_mensuel do
|
||||||
|
|
|
@ -3,6 +3,6 @@ FactoryBot.define do
|
||||||
ca { '12345678' }
|
ca { '12345678' }
|
||||||
date_fin_exercice { "2014-12-30 23:00:00" }
|
date_fin_exercice { "2014-12-30 23:00:00" }
|
||||||
date_fin_exercice_timestamp { 1419980400 }
|
date_fin_exercice_timestamp { 1419980400 }
|
||||||
association :etablissement, factory: [:etablissement]
|
association :etablissement
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue