Fix braces around hash params Rubocop offense (#1453)

This commit is contained in:
Arun Kumar 2019-01-11 13:08:45 -05:00 committed by Ben Halpern
parent a52af3da8b
commit a0d39e15bd
4 changed files with 16 additions and 32 deletions

View file

@ -27,16 +27,6 @@ RSpec/FilePath:
RSpec/MultipleExpectations:
Max: 6
# Offense count: 5
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: braces, no_braces, context_dependent
Style/BracesAroundHashParameters:
Exclude:
- 'app/controllers/tag_adjustments_controller.rb'
- 'spec/services/tag_adjustment_creation_service_spec.rb'
- 'spec/services/tag_adjustment_update_service_spec.rb'
# Offense count: 15
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, EnforcedStyle.

View file

@ -3,13 +3,11 @@ class TagAdjustmentsController < ApplicationController
authorize(User, :moderation_routes?)
TagAdjustmentCreationService.new(
current_user,
{
adjustment_type: "removal",
status: "committed",
tag_name: params[:tag_adjustment][:tag_name],
article_id: params[:tag_adjustment][:article_id],
reason_for_adjustment: params[:tag_adjustment][:reason_for_adjustment]
}
adjustment_type: "removal",
status: "committed",
tag_name: params[:tag_adjustment][:tag_name],
article_id: params[:tag_adjustment][:article_id],
reason_for_adjustment: params[:tag_adjustment][:reason_for_adjustment],
).create
@article = Article.find(params[:tag_adjustment][:article_id])
redirect_to "#{@article.path}/mod"

View file

@ -8,13 +8,11 @@ RSpec.describe TagAdjustmentCreationService do
def create_tag_adjustment
described_class.new(
user,
{
adjustment_type: "removal",
status: "committed",
tag_name: tag.name,
article_id: article.id,
reason_for_adjustment: "Test"
}
adjustment_type: "removal",
status: "committed",
tag_name: tag.name,
article_id: article.id,
reason_for_adjustment: "Test",
).create
end

View file

@ -8,12 +8,10 @@ RSpec.describe TagAdjustmentUpdateService do
def create_tag_adjustment
TagAdjustmentCreationService.new(
user,
{
adjustment_type: "removal",
status: "committed",
tag_name: tag.name,
article_id: article.id
}
adjustment_type: "removal",
status: "committed",
tag_name: tag.name,
article_id: article.id,
).create
end
@ -23,7 +21,7 @@ RSpec.describe TagAdjustmentUpdateService do
xit "creates tag adjustment" do
tag_adjustment = create_tag_adjustment
described_class.new(tag_adjustment, { status: "resolved" }).update
described_class.new(tag_adjustment, status: "resolved").update
expect(tag_adjustment).to be_valid
expect(tag_adjustment.tag_id).to eq(tag.id)
@ -32,7 +30,7 @@ RSpec.describe TagAdjustmentUpdateService do
xit "updates notification" do
tag_adjustment = create_tag_adjustment
described_class.new(tag_adjustment, { status: "resolved" }).update
described_class.new(tag_adjustment, status: "resolved").update
expect(Notification.last.user_id).to eq(article.user_id)
expect(Notification.last.json_data["status"]).to eq("resolved")