Skip to content

Commit

Permalink
Merge pull request #9493 from demarches-simplifiees/rebase-cloned-dos…
Browse files Browse the repository at this point in the history
…siers

Correction : lorsqu'un dossier est cloné, il est toujours rebasé
  • Loading branch information
E-L-T authored Sep 22, 2023
2 parents 6abd0f8 + 5e4d966 commit d2e6056
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 1 addition & 3 deletions app/models/concerns/dossier_clone_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ def clone(user: nil, fork: false)
transaction do
cloned_dossier.save!(validate: !fork)

if fork
cloned_dossier.rebase!
end
cloned_dossier.rebase!
end

if fork
Expand Down
2 changes: 2 additions & 0 deletions spec/models/concern/dossier_clone_concern_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@
context 'with new revision' do
let(:added_champ) { forked_dossier.champs.find { _1.libelle == "Un nouveau champ text" } }
let(:removed_champ) { dossier.champs.find { _1.stable_id == 99 } }
let(:new_dossier) { dossier.clone }

before do
procedure.draft_revision.add_type_de_champ({
Expand All @@ -284,6 +285,7 @@

it {
expect(dossier.revision_id).to eq(procedure.revisions.first.id)
expect(new_dossier.revision_id).to eq(procedure.published_revision.id)
expect(forked_dossier.revision_id).to eq(procedure.published_revision_id)
is_expected.to eq(added: [added_champ], updated: [], removed: [removed_champ])
}
Expand Down

0 comments on commit d2e6056

Please sign in to comment.