Merge pull request #3379 from tchak/fix-clone-repetition
Clone nested types_de_champ
This commit is contained in:
commit
d1e7bc1906
2 changed files with 7 additions and 2 deletions
|
@ -190,8 +190,8 @@ class Procedure < ApplicationRecord
|
||||||
procedure = self.deep_clone(include:
|
procedure = self.deep_clone(include:
|
||||||
{
|
{
|
||||||
attestation_template: nil,
|
attestation_template: nil,
|
||||||
types_de_champ: :drop_down_list,
|
types_de_champ: [:drop_down_list, types_de_champ: :drop_down_list],
|
||||||
types_de_champ_private: :drop_down_list
|
types_de_champ_private: [:drop_down_list, types_de_champ: :drop_down_list]
|
||||||
})
|
})
|
||||||
procedure.path = nil
|
procedure.path = nil
|
||||||
procedure.aasm_state = :brouillon
|
procedure.aasm_state = :brouillon
|
||||||
|
|
|
@ -141,6 +141,11 @@ shared_examples 'type_de_champ_spec' do
|
||||||
type_de_champ.types_de_champ << type_de_champ_text
|
type_de_champ.types_de_champ << type_de_champ_text
|
||||||
expect(type_de_champ.types_de_champ.size).to eq(2)
|
expect(type_de_champ.types_de_champ.size).to eq(2)
|
||||||
expect(type_de_champ_text.parent).to eq(type_de_champ)
|
expect(type_de_champ_text.parent).to eq(type_de_champ)
|
||||||
|
|
||||||
|
admin = create(:administrateur)
|
||||||
|
cloned_procedure = procedure.clone(admin, false)
|
||||||
|
|
||||||
|
expect(cloned_procedure.types_de_champ.first.types_de_champ).not_to be_empty
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue