Merge pull request #9439 from demarches-simplifiees/fix_missing_procedure_in_expert_merge
instructeurs: corrige un merge de compte dans le cas de procédure supprimée
This commit is contained in:
commit
b378b24794
2 changed files with 14 additions and 0 deletions
|
@ -34,6 +34,7 @@ class Expert < ApplicationRecord
|
||||||
|
|
||||||
procedure_with_new, procedure_without_new = old_expert
|
procedure_with_new, procedure_without_new = old_expert
|
||||||
.procedures
|
.procedures
|
||||||
|
.with_discarded
|
||||||
.partition { |p| p.experts.exists?(id) }
|
.partition { |p| p.experts.exists?(id) }
|
||||||
|
|
||||||
ExpertsProcedure
|
ExpertsProcedure
|
||||||
|
|
|
@ -38,6 +38,19 @@ RSpec.describe Expert, type: :model do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when an old expert access a hidden procedure' do
|
||||||
|
let(:procedure) { create(:procedure, hidden_at: 1.month.ago) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
procedure.experts << old_expert
|
||||||
|
subject
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'transfers the access to the new expert' do
|
||||||
|
expect(procedure.reload.experts).to match_array(new_expert)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'when both expert access a procedure' do
|
context 'when both expert access a procedure' do
|
||||||
let(:procedure) { create(:procedure) }
|
let(:procedure) { create(:procedure) }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue