procedure: clarify controller spec
This commit is contained in:
parent
3ae8cf3284
commit
3f0f22d849
1 changed files with 6 additions and 12 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue