From 8c847a682109e8305ff1ac14cd493255884d8675 Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Tue, 14 Mar 2023 20:19:13 -0600 Subject: AƱade specs faltantes de CompaniesController MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/support/shared_examples/requests/get_request.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'spec/support/shared_examples/requests/get_request.rb') diff --git a/spec/support/shared_examples/requests/get_request.rb b/spec/support/shared_examples/requests/get_request.rb index c402196..d58da67 100644 --- a/spec/support/shared_examples/requests/get_request.rb +++ b/spec/support/shared_examples/requests/get_request.rb @@ -1,11 +1,20 @@ # frozen_string_literal: true -RSpec.shared_examples 'a GET request' do +RSpec.shared_examples 'a GET resource request' do |sole_route: false| context 'for an existing resource' do - it 'returns a 200 status and the requested resource(s)'do + it 'returns a 200 status and the requested resource(s)' do get(route, headers:) expect(response).to have_http_status(200) expect(response.body).to include_strings(expected_text) end end + + unless sole_route + context 'for a nonexistent resource' do + it 'returns a 404 http status' do + get(invalid_route, headers:) + expect(response).to have_http_status(404) + end + end + end end -- cgit v1.2.3