Merge pull request #1974 from tchak/fix-clone-procedure

Fix clone procedure
This commit is contained in:
Paul Chavard 2018-05-28 15:06:34 +02:00 committed by GitHub
commit 50326b6827
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View file

@ -193,6 +193,8 @@ class Procedure < ApplicationRecord
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
}) })
procedure.aasm_state = :brouillon
procedure.test_started_at = nil
procedure.archived_at = nil procedure.archived_at = nil
procedure.published_at = nil procedure.published_at = nil
procedure.logo_secure_token = nil procedure.logo_secure_token = nil

View file

@ -248,10 +248,8 @@ describe Procedure do
end end
describe 'clone' do describe 'clone' do
let(:archived_at) { nil }
let(:published_at) { nil }
let!(:service) { create(:service) } let!(:service) { create(:service) }
let(:procedure) { create(:procedure, archived_at: archived_at, published_at: published_at, received_mail: received_mail, service: service) } let(:procedure) { create(:procedure, 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) }
@ -340,11 +338,13 @@ describe Procedure do
end end
describe 'procedure status is reset' do describe 'procedure status is reset' do
let(:archived_at) { Time.now } let(:procedure) { create(:procedure, :archived, received_mail: received_mail, service: service) }
let(:published_at) { Time.now }
it 'Not published nor archived' do it 'Not published nor archived' do
expect(subject.archived_at).to be_nil expect(subject.archived_at).to be_nil
expect(subject.published_at).to be_nil expect(subject.published_at).to be_nil
expect(subject.test_started_at).to be_nil
expect(subject.aasm_state).to eq "brouillon"
expect(subject.path).to be_nil expect(subject.path).to be_nil
end end
end end