From a0d39e15bdff5caa71d7b85c4aa87e2f7cd9fc5f Mon Sep 17 00:00:00 2001 From: Arun Kumar Date: Fri, 11 Jan 2019 13:08:45 -0500 Subject: [PATCH] Fix braces around hash params Rubocop offense (#1453) --- .rubocop_todo.yml | 10 ---------- app/controllers/tag_adjustments_controller.rb | 12 +++++------- .../tag_adjustment_creation_service_spec.rb | 12 +++++------- .../services/tag_adjustment_update_service_spec.rb | 14 ++++++-------- 4 files changed, 16 insertions(+), 32 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 253c44cbd..546f17d3c 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -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. diff --git a/app/controllers/tag_adjustments_controller.rb b/app/controllers/tag_adjustments_controller.rb index 52fd42e4d..62fe551ed 100644 --- a/app/controllers/tag_adjustments_controller.rb +++ b/app/controllers/tag_adjustments_controller.rb @@ -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" diff --git a/spec/services/tag_adjustment_creation_service_spec.rb b/spec/services/tag_adjustment_creation_service_spec.rb index 026a5d169..d9270bd04 100644 --- a/spec/services/tag_adjustment_creation_service_spec.rb +++ b/spec/services/tag_adjustment_creation_service_spec.rb @@ -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 diff --git a/spec/services/tag_adjustment_update_service_spec.rb b/spec/services/tag_adjustment_update_service_spec.rb index 799353f2f..81e253595 100644 --- a/spec/services/tag_adjustment_update_service_spec.rb +++ b/spec/services/tag_adjustment_update_service_spec.rb @@ -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")