From dbb97dbec33ee078f1ba4cc0595f40a951c49648 Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Wed, 22 Mar 2023 17:41:07 -0600 Subject: AƱade specs de ProductsController MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/support/shared_examples/requests/delete_request.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'spec/support') diff --git a/spec/support/shared_examples/requests/delete_request.rb b/spec/support/shared_examples/requests/delete_request.rb index ea921ea..caeaae0 100644 --- a/spec/support/shared_examples/requests/delete_request.rb +++ b/spec/support/shared_examples/requests/delete_request.rb @@ -1,5 +1,17 @@ # frozen_string_literal: true RSpec.shared_examples 'a DELETE request' do - let(:headers) { { 'CONTENT_TYPE' => 'application/json' } } + context 'for an existing resource' do + it 'deletes the resource' do + delete(resource, headers:) + expect(response).to have_http_status(303) + end + end + + context 'for a non-existent resource' do + it 'returns a 404 http status' do + delete(nonexistent_resource, headers:) + expect(response).to have_http_status(404) + end + end end -- cgit v1.2.3