fix(dossier.has_many.france_connect_informations): wip
This commit is contained in:
parent
b6526cfad9
commit
015e606f50
4 changed files with 4 additions and 5 deletions
|
@ -129,7 +129,6 @@ class Dossier < ApplicationRecord
|
||||||
belongs_to :batch_operation, optional: true
|
belongs_to :batch_operation, optional: true
|
||||||
has_many :dossier_batch_operations, dependent: :destroy
|
has_many :dossier_batch_operations, dependent: :destroy
|
||||||
has_many :batch_operations, through: :dossier_batch_operations
|
has_many :batch_operations, through: :dossier_batch_operations
|
||||||
has_many :france_connect_informations, through: :user
|
|
||||||
|
|
||||||
has_one :procedure, through: :revision
|
has_one :procedure, through: :revision
|
||||||
has_one :attestation_template, through: :procedure
|
has_one :attestation_template, through: :procedure
|
||||||
|
@ -518,7 +517,7 @@ class Dossier < ApplicationRecord
|
||||||
def build_default_individual
|
def build_default_individual
|
||||||
if procedure.for_individual? && individual.blank?
|
if procedure.for_individual? && individual.blank?
|
||||||
self.individual = if france_connected_with_one_identity?
|
self.individual = if france_connected_with_one_identity?
|
||||||
Individual.from_france_connect(france_connect_informations.first)
|
Individual.from_france_connect(user.france_connect_informations.first)
|
||||||
else
|
else
|
||||||
Individual.new
|
Individual.new
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
- if dossier.france_connected_with_one_identity? && current_user.instructeur? && !current_user.owns_or_invite?(dossier)
|
- if dossier.france_connected_with_one_identity? && current_user.instructeur? && !current_user.owns_or_invite?(dossier)
|
||||||
- content_for(:notice_info) do
|
- content_for(:notice_info) do
|
||||||
= render partial: "shared/dossiers/france_connect_informations_notice", locals: { user_information: dossier.france_connect_informations.first }
|
= render partial: "shared/dossiers/france_connect_informations_notice", locals: { user_information: dossier.user.france_connect_informations.first }
|
||||||
|
|
||||||
.fr-container.counter-start-header-section.dossier-show{ class: class_names("dossier-show-instructeur" => profile =="instructeur") }
|
.fr-container.counter-start-header-section.dossier-show{ class: class_names("dossier-show-instructeur" => profile =="instructeur") }
|
||||||
.fr-grid-row.fr-grid-row--center
|
.fr-grid-row.fr-grid-row--center
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
- if dossier.france_connected_with_one_identity? && current_user.instructeur? && !current_user.owns_or_invite?(dossier)
|
- if dossier.france_connected_with_one_identity? && current_user.instructeur? && !current_user.owns_or_invite?(dossier)
|
||||||
- content_for(:notice_info) do
|
- content_for(:notice_info) do
|
||||||
= render partial: "shared/dossiers/france_connect_informations_notice", locals: { user_information: dossier.france_connect_informations.first }
|
= render partial: "shared/dossiers/france_connect_informations_notice", locals: { user_information: dossier.user.france_connect_informations.first }
|
||||||
|
|
||||||
|
|
||||||
.dossier-edit.container.counter-start-header-section
|
.dossier-edit.container.counter-start-header-section
|
||||||
|
|
|
@ -348,10 +348,10 @@ describe User, type: :model do
|
||||||
expect(dossier_termine.user).to be_nil
|
expect(dossier_termine.user).to be_nil
|
||||||
expect(dossier_termine.user_email_for(:display)).to eq(user.email)
|
expect(dossier_termine.user_email_for(:display)).to eq(user.email)
|
||||||
expect(dossier_termine.valid?).to be_truthy
|
expect(dossier_termine.valid?).to be_truthy
|
||||||
expect(dossier_termine.france_connect_informations).to be_empty
|
|
||||||
expect { dossier_termine.user_email_for(:notification) }.to raise_error(RuntimeError)
|
expect { dossier_termine.user_email_for(:notification) }.to raise_error(RuntimeError)
|
||||||
|
|
||||||
expect(User.find_by(id: user.id)).to be_nil
|
expect(User.find_by(id: user.id)).to be_nil
|
||||||
|
expect(FranceConnectInformation.where(user_id: user.id)).to be_empty
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue