Fix all Layout/SpaceBeforeComma rubocop issues and remove from rubocop_todo list

This commit is contained in:
Bertocq
2017-06-21 22:34:50 +02:00
parent 6562d8b9d8
commit 9763931f55
5 changed files with 7 additions and 15 deletions

View File

@@ -612,14 +612,6 @@ Layout/SpaceAroundEqualsInParameterDefault:
Layout/SpaceAroundOperators: Layout/SpaceAroundOperators:
Enabled: false Enabled: false
# Offense count: 6
# Cop supports --auto-correct.
Layout/SpaceBeforeComma:
Exclude:
- 'app/models/proposal.rb'
- 'spec/controllers/management/sessions_controller_spec.rb'
- 'spec/controllers/management/users_controller_spec.rb'
# Offense count: 9 # Offense count: 9
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles. # Configuration parameters: EnforcedStyle, SupportedStyles.

View File

@@ -19,7 +19,7 @@ class Legislation::AnswersController < Legislation::BaseController
end end
else else
respond_to do |format| respond_to do |format|
format.js { render json: {} , status: :not_found } format.js { render json: {}, status: :not_found }
format.html { redirect_to legislation_process_question_path(@process, @question), alert: t('legislation.questions.participation.phase_not_open') } format.html { redirect_to legislation_process_question_path(@process, @question), alert: t('legislation.questions.participation.phase_not_open') }
end end
end end

View File

@@ -39,7 +39,7 @@ class Proposal < ActiveRecord::Base
before_save :calculate_hot_score, :calculate_confidence_score before_save :calculate_hot_score, :calculate_confidence_score
scope :for_render, -> { includes(:tags) } scope :for_render, -> { includes(:tags) }
scope :sort_by_hot_score , -> { reorder(hot_score: :desc) } scope :sort_by_hot_score, -> { reorder(hot_score: :desc) }
scope :sort_by_confidence_score, -> { reorder(confidence_score: :desc) } scope :sort_by_confidence_score, -> { reorder(confidence_score: :desc) }
scope :sort_by_created_at, -> { reorder(created_at: :desc) } scope :sort_by_created_at, -> { reorder(created_at: :desc) }
scope :sort_by_most_commented, -> { reorder(comments_count: :desc) } scope :sort_by_most_commented, -> { reorder(comments_count: :desc) }

View File

@@ -5,15 +5,15 @@ describe Management::SessionsController do
describe 'Sign in' do describe 'Sign in' do
it "should deny access if wrong manager credentials" do it "should deny access if wrong manager credentials" do
allow_any_instance_of(ManagerAuthenticator).to receive(:auth).and_return(false) allow_any_instance_of(ManagerAuthenticator).to receive(:auth).and_return(false)
expect { get :create, login: "nonexistent" , clave_usuario: "wrong"}.to raise_error CanCan::AccessDenied expect { get :create, login: "nonexistent", clave_usuario: "wrong"}.to raise_error CanCan::AccessDenied
expect(session[:manager]).to be_nil expect(session[:manager]).to be_nil
end end
it "should redirect to management root path if authorized manager with right credentials" do it "should redirect to management root path if authorized manager with right credentials" do
manager = {login: "JJB033", user_key: "31415926" , date: "20151031135905"} manager = {login: "JJB033", user_key: "31415926", date: "20151031135905"}
allow_any_instance_of(ManagerAuthenticator).to receive(:auth).and_return(manager) allow_any_instance_of(ManagerAuthenticator).to receive(:auth).and_return(manager)
get :create, login: "JJB033" , clave_usuario: "31415926", fecha_conexion: "20151031135905" get :create, login: "JJB033", clave_usuario: "31415926", fecha_conexion: "20151031135905"
expect(response).to be_redirect expect(response).to be_redirect
expect(session[:manager][:login]).to eq "JJB033" expect(session[:manager][:login]).to eq "JJB033"
end end

View File

@@ -4,13 +4,13 @@ describe Management::UsersController do
describe 'logout' do describe 'logout' do
it "should remove user data from the session" do it "should remove user data from the session" do
session[:manager] = {user_key: "31415926" , date: "20151031135905", login: "JJB033"} session[:manager] = {user_key: "31415926", date: "20151031135905", login: "JJB033"}
session[:document_type] = "1" session[:document_type] = "1"
session[:document_number] = "12345678Z" session[:document_number] = "12345678Z"
get :logout get :logout
expect(session[:manager]).to eq({user_key: "31415926" , date: "20151031135905", login: "JJB033"}) expect(session[:manager]).to eq({user_key: "31415926", date: "20151031135905", login: "JJB033"})
expect(session[:document_type]).to be_nil expect(session[:document_type]).to be_nil
expect(session[:document_number]).to be_nil expect(session[:document_number]).to be_nil
expect(response).to be_redirect expect(response).to be_redirect