procedure: clarify controller spec

This commit is contained in:
Pierre de La Morinerie 2019-01-23 15:11:16 +00:00
parent 3ae8cf3284
commit 3f0f22d849

View file

@ -97,24 +97,18 @@ describe Admin::ProceduresController, type: :controller do
subject { delete :destroy, params: { id: procedure.id } } subject { delete :destroy, params: { id: procedure.id } }
context 'when procedure is draft' do context 'when the procedure is a draft' do
let!(:procedure) { procedure_draft } let!(:procedure) { procedure_draft }
describe 'tech params' do it 'destroys the procedure' do
before do expect { subject }.to change { Procedure.count }.by(-1)
subject
end
it { expect(subject.status).to eq 302 }
it { expect(flash[:notice]).to be_present }
end end
it 'destroy procedure is call' do it 'redirects to the procedure drafts page' do
expect_any_instance_of(Procedure).to receive(:destroy)
subject subject
expect(response).to redirect_to admin_procedures_draft_path
expect(flash[:notice]).to be_present
end end
it { expect { subject }.to change { Procedure.count }.by(-1) }
end end
context 'when procedure is published' do context 'when procedure is published' do