From 2c2d924942339ad7906422a18598cdd5d7ce9a84 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Fri, 12 May 2023 06:25:32 -0400 Subject: [PATCH] Fix RSpec/RepeatedExampleGroupDescription cop (#24850) Co-authored-by: Claire --- .rubocop_todo.yml | 5 ----- .../admin/reports/actions_controller_spec.rb | 4 ++-- spec/policies/report_note_policy_spec.rb | 20 +++++++++---------- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 69d34dac31d..918a8efbadf 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -643,11 +643,6 @@ RSpec/RepeatedExampleGroupBody: Exclude: - 'spec/controllers/statuses_controller_spec.rb' -RSpec/RepeatedExampleGroupDescription: - Exclude: - - 'spec/controllers/admin/reports/actions_controller_spec.rb' - - 'spec/policies/report_note_policy_spec.rb' - RSpec/StubbedMock: Exclude: - 'spec/controllers/api/base_controller_spec.rb' diff --git a/spec/controllers/admin/reports/actions_controller_spec.rb b/spec/controllers/admin/reports/actions_controller_spec.rb index a84f2324e13..701855f92ea 100644 --- a/spec/controllers/admin/reports/actions_controller_spec.rb +++ b/spec/controllers/admin/reports/actions_controller_spec.rb @@ -146,13 +146,13 @@ describe Admin::Reports::ActionsController do end end - context 'with Action as submit button' do + context 'with action as submit button' do subject { post :create, params: common_params.merge({ action => '' }) } it_behaves_like 'all action types' end - context 'with Action as submit button' do + context 'with moderation action as an extra field' do subject { post :create, params: common_params.merge({ moderation_action: action }) } it_behaves_like 'all action types' diff --git a/spec/policies/report_note_policy_spec.rb b/spec/policies/report_note_policy_spec.rb index ea2a62ada98..a657fce4bd8 100644 --- a/spec/policies/report_note_policy_spec.rb +++ b/spec/policies/report_note_policy_spec.rb @@ -30,19 +30,17 @@ RSpec.describe ReportNotePolicy do end end - context 'when admin?' do - context 'when owner?' do - it 'permit' do - report_note = Fabricate(:report_note, account: john) - expect(subject).to permit(john, report_note) - end + context 'when owner?' do + it 'permit' do + report_note = Fabricate(:report_note, account: john) + expect(subject).to permit(john, report_note) end + end - context 'with !owner?' do - it 'denies' do - report_note = Fabricate(:report_note) - expect(subject).to_not permit(john, report_note) - end + context 'with !owner?' do + it 'denies' do + report_note = Fabricate(:report_note) + expect(subject).to_not permit(john, report_note) end end end