DEV: Fix various rubocop lints (#24749)

These (21 + 3 from previous PRs) are soon to be enabled in rubocop-discourse:

Capybara/VisibilityMatcher
Lint/DeprecatedOpenSSLConstant
Lint/DisjunctiveAssignmentInConstructor
Lint/EmptyConditionalBody
Lint/EmptyEnsure
Lint/LiteralInInterpolation
Lint/NonLocalExitFromIterator
Lint/ParenthesesAsGroupedExpression
Lint/RedundantCopDisableDirective
Lint/RedundantRequireStatement
Lint/RedundantSafeNavigation
Lint/RedundantStringCoercion
Lint/RedundantWithIndex
Lint/RedundantWithObject
Lint/SafeNavigationChain
Lint/SafeNavigationConsistency
Lint/SelfAssignment
Lint/UnreachableCode
Lint/UselessMethodDefinition
Lint/Void

Previous PRs:
Lint/ShadowedArgument
Lint/DuplicateMethods
Lint/BooleanSymbol
RSpec/SpecFilePathSuffix
This commit is contained in:
Jarek Radosz
2023-12-06 23:25:00 +01:00
committed by GitHub
parent 47f298b2f4
commit 694b5f108b
129 changed files with 196 additions and 274 deletions

View File

@@ -16,7 +16,7 @@ RSpec.describe DestroyTask do
destroy_task = DestroyTask.new(StringIO.new)
expect { destroy_task.destroy_topics(c.slug) }.to change {
Topic.where(category_id: c.id).count
}.by (-1)
}.by(-1)
end
it "destroys all topics in a sub category" do
@@ -55,7 +55,7 @@ RSpec.describe DestroyTask do
expect { destroy_task.destroy_category(c.id) }.to change {
Category.where(id: c.id).count
}.by (-1)
}.by(-1)
end
it "destroys sub-categories when destroying parent category" do
@@ -63,7 +63,7 @@ RSpec.describe DestroyTask do
expect { destroy_task.destroy_category(c2.id) }.to change {
Category.where(id: sc.id).count
}.by (-1)
}.by(-1)
end
end

View File

@@ -18,10 +18,10 @@ RSpec.describe InlineUploads, type: :multisite do
it "should correct image URLs in multisite" do
md = <<~MD
https:#{upload2.url} https:#{upload2.url}
#{URI.join(SiteSetting.s3_cdn_url, URI.parse(upload2.url).path).to_s}
#{URI.join(SiteSetting.s3_cdn_url, URI.parse(upload2.url).path)}
<img src="#{upload.url}" alt="some image">
<img src="#{URI.join(SiteSetting.s3_cdn_url, URI.parse(upload2.url).path).to_s}" alt="some image">
<img src="#{URI.join(SiteSetting.s3_cdn_url, URI.parse(upload2.url).path)}" alt="some image">
<img src="#{upload3.url}">
MD

View File

@@ -673,7 +673,7 @@ RSpec.describe InlineUploads do
#{upload.url}
<img src="#{upload.url}" alt="some image">
test<img src="#{upload2.url}" alt="some image">test
<img src="#{URI.join(SiteSetting.s3_cdn_url, URI.parse(upload2.url).path).to_s}" alt="some image">
<img src="#{URI.join(SiteSetting.s3_cdn_url, URI.parse(upload2.url).path)}" alt="some image">
MD
expect(InlineUploads.process(md)).to eq(<<~MD)

View File

@@ -133,8 +133,8 @@ RSpec.describe UserMerger do
end
it "merges drafts" do
key_topic_17 = "#{Draft::EXISTING_TOPIC}#{17}"
key_topic_19 = "#{Draft::EXISTING_TOPIC}#{19}"
key_topic_17 = "#{Draft::EXISTING_TOPIC}17"
key_topic_19 = "#{Draft::EXISTING_TOPIC}19"
create_draft(source_user, Draft::NEW_TOPIC, "new topic draft by alice1")
create_draft(source_user, key_topic_17, "draft by alice1")