From e5cf23cf3a45cee0abe2e3ad4de1b8c03bcb6f73 Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Fri, 17 Feb 2023 21:59:57 -0500 Subject: [PATCH] Enable Rubocop RSpec/HooksBeforeExamples (#23668) --- .rubocop_todo.yml | 6 ------ spec/services/fetch_resource_service_spec.rb | 6 +----- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index c785dccd6..91d600497 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1028,12 +1028,6 @@ RSpec/HookArgument: - 'spec/services/import_service_spec.rb' - 'spec/spec_helper.rb' -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -RSpec/HooksBeforeExamples: - Exclude: - - 'spec/services/fetch_resource_service_spec.rb' - # Offense count: 159 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. diff --git a/spec/services/fetch_resource_service_spec.rb b/spec/services/fetch_resource_service_spec.rb index 0c0c306fe..8cd4a3bfb 100644 --- a/spec/services/fetch_resource_service_spec.rb +++ b/spec/services/fetch_resource_service_spec.rb @@ -62,6 +62,7 @@ RSpec.describe FetchResourceService, type: :service do before do stub_request(:get, url).to_return(status: 200, body: body, headers: headers) + stub_request(:get, 'http://example.com/foo').to_return(status: 200, body: json, headers: { 'Content-Type' => 'application/activity+json' }) end it 'signs request' do @@ -89,11 +90,6 @@ RSpec.describe FetchResourceService, type: :service do it { is_expected.to eq [1, { prefetched_body: body, id: true }] } end - before do - stub_request(:get, url).to_return(status: 200, body: body, headers: headers) - stub_request(:get, 'http://example.com/foo').to_return(status: 200, body: json, headers: { 'Content-Type' => 'application/activity+json' }) - end - context 'when link header is present' do let(:headers) { { 'Link' => '; rel="alternate"; type="application/activity+json"', } }