Handle "réactiver" feature with permanent procedure url

This commit is contained in:
Guillaume Lazzara 2016-06-24 16:57:35 +02:00
parent e5002dbb11
commit 92a5100a09
4 changed files with 23 additions and 17 deletions

View file

@ -355,26 +355,25 @@ describe Admin::ProceduresController, type: :controller do
context 'when admin is the owner of the procedure' do
before do
put :archive, procedure_id: procedure.id, archive: archive
put :archive, procedure_id: procedure.id
procedure.reload
end
context 'when owner want archive procedure' do
let(:archive) { true }
it { expect(procedure.archived).to be_truthy }
it { expect(response).to redirect_to :admin_procedures }
it { expect(flash[:notice]).to have_content 'Procédure archivée' }
end
context 'when owner want reactive procedure' do
let(:archive) { false }
before do
put :publish, procedure_id: procedure.id, procedure_path: 'fake_path'
procedure.reload
end
it { expect(procedure.archived).to be_falsey }
it { expect(response).to redirect_to :admin_procedures }
it { expect(flash[:notice]).to have_content 'Procédure éditée' }
it { expect(flash[:notice]).to have_content 'Procédure publiée' }
end
end