DEV: Update the rubocop-discourse gem

This enables cops related to RSpec `subject`.

See https://github.com/discourse/rubocop-discourse/pull/32
This commit is contained in:
Loïc Guitaut
2023-06-21 16:00:19 +02:00
committed by Loïc Guitaut
parent 8e1d049e6b
commit 0f4beab0fb
129 changed files with 1697 additions and 1506 deletions

View File

@ -1,6 +1,8 @@
# frozen_string_literal: true
RSpec.describe Plugin::Instance do
subject(:plugin_instance) { described_class.new }
after { DiscoursePluginRegistry.reset! }
describe "find_all" do
@ -601,7 +603,7 @@ RSpec.describe Plugin::Instance do
highest_flag_id = ReviewableScore.types.values.max
flag_name = :new_flag
subject.replace_flags(settings: original_flags) do |settings, next_flag_id|
plugin_instance.replace_flags(settings: original_flags) do |settings, next_flag_id|
settings.add(next_flag_id, flag_name)
end
@ -613,7 +615,7 @@ RSpec.describe Plugin::Instance do
highest_flag_id = ReviewableScore.types.values.max
new_score_type = :new_score_type
subject.replace_flags(
plugin_instance.replace_flags(
settings: original_flags,
score_type_names: [new_score_type],
) { |settings, next_flag_id| settings.add(next_flag_id, :new_flag) }
@ -629,7 +631,7 @@ RSpec.describe Plugin::Instance do
it "adds a custom api key scope" do
actions = %w[admin/groups#create]
subject.add_api_key_scope(:groups, create: { actions: actions })
plugin_instance.add_api_key_scope(:groups, create: { actions: actions })
expect(ApiKeyScope.scope_mappings.dig(:groups, :create, :actions)).to contain_exactly(
*actions,