Procedure Clone: ensure the service is kept

This commit is contained in:
simon lehericey 2018-04-23 16:29:32 +02:00
parent 304c04275c
commit 30513bcb4f

View file

@ -262,7 +262,8 @@ describe Procedure do
describe 'clone' do describe 'clone' do
let(:archived_at) { nil } let(:archived_at) { nil }
let(:published_at) { nil } let(:published_at) { nil }
let(:procedure) { create(:procedure, archived_at: archived_at, published_at: published_at, received_mail: received_mail) } let!(:service) { create(:service) }
let(:procedure) { create(:procedure, archived_at: archived_at, published_at: published_at, received_mail: received_mail, service: service) }
let!(:type_de_champ_0) { create(:type_de_champ, procedure: procedure, order_place: 0) } let!(:type_de_champ_0) { create(:type_de_champ, procedure: procedure, order_place: 0) }
let!(:type_de_champ_1) { create(:type_de_champ, procedure: procedure, order_place: 1) } let!(:type_de_champ_1) { create(:type_de_champ, procedure: procedure, order_place: 1) }
let!(:type_de_champ_2) { create(:type_de_champ_drop_down_list, procedure: procedure, order_place: 2) } let!(:type_de_champ_2) { create(:type_de_champ_drop_down_list, procedure: procedure, order_place: 2) }
@ -328,6 +329,10 @@ describe Procedure do
it { expect(subject.cloned_from_library).to be(true) } it { expect(subject.cloned_from_library).to be(true) }
end end
it 'should keep service_id' do
expect(subject.service).to eq(service)
end
it 'should duplicate existing mail_templates' do it 'should duplicate existing mail_templates' do
expect(subject.received_mail.attributes.except("id", "procedure_id", "created_at", "updated_at")).to eq procedure.received_mail.attributes.except("id", "procedure_id", "created_at", "updated_at") expect(subject.received_mail.attributes.except("id", "procedure_id", "created_at", "updated_at")).to eq procedure.received_mail.attributes.except("id", "procedure_id", "created_at", "updated_at")
expect(subject.received_mail.id).not_to eq procedure.received_mail.id expect(subject.received_mail.id).not_to eq procedure.received_mail.id