Enable Rubocop RSpec/HooksBeforeExamples (#23668)

pull/23688/head
Nick Schonning 2023-02-17 21:59:57 -05:00 committed by GitHub
parent efd424506a
commit e5cf23cf3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 11 deletions

View File

@ -1028,12 +1028,6 @@ RSpec/HookArgument:
- 'spec/services/import_service_spec.rb' - 'spec/services/import_service_spec.rb'
- 'spec/spec_helper.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 # Offense count: 159
# This cop supports safe autocorrection (--autocorrect). # This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle. # Configuration parameters: EnforcedStyle.

View File

@ -62,6 +62,7 @@ RSpec.describe FetchResourceService, type: :service do
before do before do
stub_request(:get, url).to_return(status: 200, body: body, headers: headers) 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 end
it 'signs request' do 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 }] } it { is_expected.to eq [1, { prefetched_body: body, id: true }] }
end 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 context 'when link header is present' do
let(:headers) { { 'Link' => '<http://example.com/foo>; rel="alternate"; type="application/activity+json"', } } let(:headers) { { 'Link' => '<http://example.com/foo>; rel="alternate"; type="application/activity+json"', } }