Browse Source

Test Case Log deletion failures

pull/109/head
baarkerlounger 4 years ago
parent
commit
85c35259ae
  1. 13
      spec/requests/case_log_controller_spec.rb

13
spec/requests/case_log_controller_spec.rb

@ -231,6 +231,7 @@ RSpec.describe CaseLogsController, type: :request do
end end
let(:id) { case_log.id } let(:id) { case_log.id }
context "expected deletion" do
before do before do
delete "/case_logs/#{id}", headers: headers delete "/case_logs/#{id}", headers: headers
end end
@ -262,4 +263,16 @@ RSpec.describe CaseLogsController, type: :request do
end end
end end
end end
context "deletion fails" do
before do
allow_any_instance_of(CaseLog).to receive(:discard).and_return(false)
delete "/case_logs/#{id}", headers: headers
end
it "returns an unprocessable entity 422" do
expect(response).to have_http_status(:unprocessable_entity)
end
end
end
end end

Loading…
Cancel
Save