diff options
author | HombreLaser <sebastian-440@live.com> | 2023-03-22 17:41:07 -0600 |
---|---|---|
committer | HombreLaser <sebastian-440@live.com> | 2023-03-22 17:41:07 -0600 |
commit | dbb97dbec33ee078f1ba4cc0595f40a951c49648 (patch) | |
tree | cd97cd9efd140ce83b642e3430c3dd51a6b47a60 /spec/support/shared_examples/requests/delete_request.rb | |
parent | 5868c1230bdfde7fa10d498a12e214df2722415c (diff) |
Añade specs de ProductsController
Diffstat (limited to 'spec/support/shared_examples/requests/delete_request.rb')
-rw-r--r-- | spec/support/shared_examples/requests/delete_request.rb | 14 |
1 files changed, 13 insertions, 1 deletions
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 |