From 87e73e772c35ba3aa2ffe7f88f1f3cdcba9a538f Mon Sep 17 00:00:00 2001 From: Bertocq Date: Fri, 16 Jun 2017 00:11:37 +0200 Subject: [PATCH 01/11] Remove all Lint/AmbiguousRegexpLiteral rubocop issues on code, and from rubocop_todo list --- .rubocop_todo.yml | 6 ------ app/helpers/verification_helper.rb | 6 +++--- spec/features/verification/residence_spec.rb | 2 +- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 1a8835018..255c65882 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -6,12 +6,6 @@ # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 3 -Lint/AmbiguousRegexpLiteral: - Exclude: - - 'app/helpers/verification_helper.rb' - - 'spec/features/verification/residence_spec.rb' - # Offense count: 3 # Configuration parameters: AllowSafeAssignment. Lint/AssignmentInCondition: diff --git a/app/helpers/verification_helper.rb b/app/helpers/verification_helper.rb index 7d300c5c9..62be1a5a8 100644 --- a/app/helpers/verification_helper.rb +++ b/app/helpers/verification_helper.rb @@ -7,12 +7,12 @@ module VerificationHelper end def mask_phone(number) - match = number.match /\d{3}$/ + match = number.match(/\d{3}$/) "******#{match}" end def mask_email(string) - match = string.match /^(\w{1,3})(.*)@(.*)/ + match = string.match(/^(\w{1,3})(.*)@(.*)/) data_to_display = match[1] data_to_mask = match[2] @@ -21,4 +21,4 @@ module VerificationHelper data_to_display + "*"*data_to_mask.size + "@" + email_provider end -end \ No newline at end of file +end diff --git a/spec/features/verification/residence_spec.rb b/spec/features/verification/residence_spec.rb index ed2ffd083..a94834523 100644 --- a/spec/features/verification/residence_spec.rb +++ b/spec/features/verification/residence_spec.rb @@ -56,7 +56,7 @@ feature 'Residence' do click_button 'Verify residence' - expect(page).to have_content /\d errors? prevented the verification of your residence/ + expect(page).to have_content(/\d errors? prevented the verification of your residence/) end scenario 'Error on postal code not in census' do From 21c6d1c4dd926b0459ebdfbbb3842e81d6fdc723 Mon Sep 17 00:00:00 2001 From: Bertocq Date: Fri, 16 Jun 2017 00:17:19 +0200 Subject: [PATCH 02/11] Cleanup Lint/AssignmentInCondition rubocop issues on code and remove it from ruboco_todo list --- .rubocop_todo.yml | 8 -------- .../legislation/annotations_controller.rb | 6 ++++-- .../legislation/processes_controller.rb | 16 ++++++++++++---- .../management/sessions_controller.rb | 7 +++---- app/controllers/pages_controller.rb | 4 +++- app/models/notification.rb | 6 ++++-- app/models/site_customization/image.rb | 5 ++--- 7 files changed, 28 insertions(+), 24 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 255c65882..7e3b28c66 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -6,14 +6,6 @@ # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 3 -# Configuration parameters: AllowSafeAssignment. -Lint/AssignmentInCondition: - Exclude: - - 'app/controllers/management/sessions_controller.rb' - - 'app/models/notification.rb' - - 'lib/capistrano/template.rb' - # Offense count: 2 # Cop supports --auto-correct. # Configuration parameters: AlignWith, SupportedStyles. diff --git a/app/controllers/legislation/annotations_controller.rb b/app/controllers/legislation/annotations_controller.rb index 56f851316..1605a2f67 100644 --- a/app/controllers/legislation/annotations_controller.rb +++ b/app/controllers/legislation/annotations_controller.rb @@ -37,8 +37,10 @@ class Legislation::AnnotationsController < ApplicationController range_start: annotation_params[:ranges].first[:start], range_start_offset: annotation_params[:ranges].first[:startOffset].to_i, range_end: annotation_params[:ranges].first[:end], range_end_offset: annotation_params[:ranges].first[:endOffset].to_i).first - if @annotation = existing_annotation - if comment = @annotation.comments.create(body: annotation_params[:text], user: current_user) + @annotation = existing_annotation + if @annotation.present? + comment = @annotation.comments.create(body: annotation_params[:text], user: current_user) + if comment.present? render json: @annotation.to_json else render json: comment.errors.full_messages, status: :unprocessable_entity diff --git a/app/controllers/legislation/processes_controller.rb b/app/controllers/legislation/processes_controller.rb index 21951fa6f..ee5c10830 100644 --- a/app/controllers/legislation/processes_controller.rb +++ b/app/controllers/legislation/processes_controller.rb @@ -8,7 +8,9 @@ class Legislation::ProcessesController < Legislation::BaseController end def show - if @process.allegations_phase.enabled? && @process.allegations_phase.started? && draft_version = @process.draft_versions.published.last + draft_version = @process.draft_versions.published.last + + if @process.allegations_phase.enabled? && @process.allegations_phase.started? && draft_version.present? redirect_to legislation_process_draft_version_path(@process, draft_version) elsif @process.debate_phase.enabled? redirect_to legislation_process_debate_path(@process) @@ -33,7 +35,9 @@ class Legislation::ProcessesController < Legislation::BaseController @phase = :draft_publication if @process.draft_publication.started? - if draft_version = @process.draft_versions.published.last + draft_version = @process.draft_versions.published.last + + if draft_version.present? redirect_to legislation_process_draft_version_path(@process, draft_version) else render :phase_empty @@ -48,7 +52,9 @@ class Legislation::ProcessesController < Legislation::BaseController @phase = :allegations_phase if @process.allegations_phase.started? - if draft_version = @process.draft_versions.published.last + draft_version = @process.draft_versions.published.last + + if draft_version.present? redirect_to legislation_process_draft_version_path(@process, draft_version) else render :phase_empty @@ -63,7 +69,9 @@ class Legislation::ProcessesController < Legislation::BaseController @phase = :result_publication if @process.result_publication.started? - if final_version = @process.final_draft_version + final_version = @process.final_draft_version + + if final_version.present? redirect_to legislation_process_draft_version_path(@process, final_version) else render :phase_empty diff --git a/app/controllers/management/sessions_controller.rb b/app/controllers/management/sessions_controller.rb index 5d0587ae5..85ed59eae 100644 --- a/app/controllers/management/sessions_controller.rb +++ b/app/controllers/management/sessions_controller.rb @@ -37,9 +37,8 @@ class Management::SessionsController < ActionController::Base end def authenticated_manager? - if manager = ManagerAuthenticator.new(params).auth - session[:manager] = manager - end + manager = ManagerAuthenticator.new(params).auth + session[:manager] = manager if manager.present? end -end \ No newline at end of file +end diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 81d6e8dbd..654fe2ff8 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -2,7 +2,9 @@ class PagesController < ApplicationController skip_authorization_check def show - if @custom_page = SiteCustomization::Page.published.find_by(slug: params[:id]) + @custom_page = SiteCustomization::Page.published.find_by(slug: params[:id]) + + if @custom_page.present? render action: :custom_page else render action: params[:id] diff --git a/app/models/notification.rb b/app/models/notification.rb index e993e55f8..bbbb18942 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -17,7 +17,9 @@ class Notification < ActiveRecord::Base end def self.add(user_id, notifiable) - if notification = Notification.find_by(user_id: user_id, notifiable: notifiable) + notification = Notification.find_by(user_id: user_id, notifiable: notifiable) + + if notification.present? Notification.increment_counter(:counter, notification.id) else Notification.create!(user_id: user_id, notifiable: notifiable) @@ -50,4 +52,4 @@ class Notification < ActiveRecord::Base notifiable.is_a?(ProposalNotification) ? notifiable.proposal : notifiable end -end \ No newline at end of file +end diff --git a/app/models/site_customization/image.rb b/app/models/site_customization/image.rb index 0886a3d03..5e7f38e4d 100644 --- a/app/models/site_customization/image.rb +++ b/app/models/site_customization/image.rb @@ -21,9 +21,8 @@ class SiteCustomization::Image < ActiveRecord::Base def self.image_path_for(filename) image_name = filename.split(".").first - if i = find_by(name: image_name) - i.image.exists? ? i.image.url : nil - end + imageable = find_by(name: image_name) + imageable.present? && imageable.image.exists? ? imageable.image.url : nil end def required_width From b104765ddc4fd41d91d9899b276cddfb7b52ad3c Mon Sep 17 00:00:00 2001 From: Bertocq Date: Fri, 16 Jun 2017 00:18:27 +0200 Subject: [PATCH 03/11] Rubocop autocorrect Lint/BlockAlignment and remove from rubocop_todo list --- .rubocop_todo.yml | 9 --------- spec/features/tracks_spec.rb | 2 +- spec/models/proposal_spec.rb | 2 +- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 7e3b28c66..d1844dde6 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -6,15 +6,6 @@ # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 2 -# Cop supports --auto-correct. -# Configuration parameters: AlignWith, SupportedStyles. -# SupportedStyles: either, start_of_block, start_of_line -Lint/BlockAlignment: - Exclude: - - 'spec/features/tracks_spec.rb' - - 'spec/models/proposal_spec.rb' - # Offense count: 1 # Cop supports --auto-correct. # Configuration parameters: AlignWith, SupportedStyles, AutoCorrect. diff --git a/spec/features/tracks_spec.rb b/spec/features/tracks_spec.rb index a4b8a7ce6..d93f0591c 100644 --- a/spec/features/tracks_spec.rb +++ b/spec/features/tracks_spec.rb @@ -8,7 +8,7 @@ feature 'Tracking' do visit proposals_path expect(page.html).to include "anonymous" - end + end scenario 'Usertype level_1_user' do create(:geozone) diff --git a/spec/models/proposal_spec.rb b/spec/models/proposal_spec.rb index 7a87e365f..f60bff18c 100644 --- a/spec/models/proposal_spec.rb +++ b/spec/models/proposal_spec.rb @@ -99,7 +99,7 @@ describe Proposal do expect(proposal).to be_valid proposal.responsible_name = "12345678Z" - end + end it "should not be updated when the author is deleted" do author = create(:user, :level_three, document_number: "12345678Z") From 6e1fa53e2cf28da1640e3d3ed430633decbdd17f Mon Sep 17 00:00:00 2001 From: Bertocq Date: Fri, 16 Jun 2017 00:19:38 +0200 Subject: [PATCH 04/11] Fix Lint/DefEndAlignment rubocop issues and remove from rubocop_todo list --- .rubocop_todo.yml | 8 -------- app/models/officing/residence.rb | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index d1844dde6..0a40bdf19 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -6,14 +6,6 @@ # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: AlignWith, SupportedStyles, AutoCorrect. -# SupportedStyles: start_of_line, def -Lint/DefEndAlignment: - Exclude: - - 'app/controllers/comments_controller.rb' - # Offense count: 1 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles. diff --git a/app/models/officing/residence.rb b/app/models/officing/residence.rb index 539b557a5..92333cc80 100644 --- a/app/models/officing/residence.rb +++ b/app/models/officing/residence.rb @@ -62,7 +62,7 @@ class Officing::Residence document_type: document_type).first end - def residence_in_madrid + def residence_in_madrid return if errors.any? unless residency_valid? From db97314f7b0d140cbdefc6e9e1f53366a05f2a23 Mon Sep 17 00:00:00 2001 From: Bertocq Date: Fri, 16 Jun 2017 00:24:07 +0200 Subject: [PATCH 05/11] Fix Lint/NestedMethodDefinition rubocop issue and remove it from rubocop_todo list --- .rubocop_todo.yml | 5 ---- lib/acts_as_paranoid_aliases.rb | 48 +++++++++++++++++---------------- 2 files changed, 25 insertions(+), 28 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 0a40bdf19..2a7113d18 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -14,11 +14,6 @@ Lint/InheritException: Exclude: - 'app/controllers/concerns/feature_flags.rb' -# Offense count: 7 -Lint/NestedMethodDefinition: - Exclude: - - 'lib/acts_as_paranoid_aliases.rb' - # Offense count: 13 Lint/ParenthesesAsGroupedExpression: Exclude: diff --git a/lib/acts_as_paranoid_aliases.rb b/lib/acts_as_paranoid_aliases.rb index 4f69ee65a..cf0c0bac8 100644 --- a/lib/acts_as_paranoid_aliases.rb +++ b/lib/acts_as_paranoid_aliases.rb @@ -2,36 +2,38 @@ module ActsAsParanoidAliases def self.included(base) base.extend(ClassMethods) + self.class_eval do - def hide - return false if hidden? - update_attribute(:hidden_at, Time.current) - after_hide - end + def hide + return false if hidden? + update_attribute(:hidden_at, Time.current) + after_hide + end - def hidden? - deleted? - end + def hidden? + deleted? + end - def after_hide - end + def after_hide + end - def confirmed_hide? - confirmed_hide_at.present? - end + def confirmed_hide? + confirmed_hide_at.present? + end - def confirm_hide - update_attribute(:confirmed_hide_at, Time.current) - end + def confirm_hide + update_attribute(:confirmed_hide_at, Time.current) + end - def restore(opts={}) - return false unless hidden? - super(opts) - update_attribute(:confirmed_hide_at, nil) - after_restore - end + def restore(opts={}) + return false unless hidden? + super(opts) + update_attribute(:confirmed_hide_at, nil) + after_restore + end - def after_restore + def after_restore + end end end From c88d82233003425bfe02542ddade6311ddb0626c Mon Sep 17 00:00:00 2001 From: Bertocq Date: Fri, 16 Jun 2017 00:28:50 +0200 Subject: [PATCH 06/11] Fix Lint/UnderscorePrefixedVariableName issue and remove it from rubocop_todo file --- .rubocop_todo.yml | 3 +++ lib/manager_authenticator.rb | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 2a7113d18..360baeee1 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -14,6 +14,7 @@ Lint/InheritException: Exclude: - 'app/controllers/concerns/feature_flags.rb' +<<<<<<< HEAD # Offense count: 13 Lint/ParenthesesAsGroupedExpression: Exclude: @@ -27,6 +28,8 @@ Lint/UnderscorePrefixedVariableName: Exclude: - 'lib/manager_authenticator.rb' +======= +>>>>>>> 0da0d145c... Fix Lint/UnderscorePrefixedVariableName issue and remove it from rubocop_todo file # Offense count: 4 # Cop supports --auto-correct. # Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments. diff --git a/lib/manager_authenticator.rb b/lib/manager_authenticator.rb index 2d8e6f1f9..bd61d97a5 100644 --- a/lib/manager_authenticator.rb +++ b/lib/manager_authenticator.rb @@ -5,7 +5,7 @@ class ManagerAuthenticator end def auth - return false unless [@manager[:login], @manager[:user_key], @manager[:date]].all? {|_| _.present?} + return false unless [@manager[:login], @manager[:user_key], @manager[:date]].all? {|manager| manager.present?} return @manager if manager_exists? && application_authorized? false end @@ -41,4 +41,4 @@ class ManagerAuthenticator def application_key Rails.application.secrets.managers_application_key.to_s end -end \ No newline at end of file +end From f6863f5ea0ae889936e566e8063580a16ea71fcc Mon Sep 17 00:00:00 2001 From: Bertocq Date: Fri, 16 Jun 2017 00:30:36 +0200 Subject: [PATCH 07/11] Rubocop autocorrect Performance/RedundantBlockCall issue and remove it from rubocop_todo list --- .rubocop_todo.yml | 6 ------ app/mailers/mailer.rb | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 360baeee1..1954c2548 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -87,12 +87,6 @@ Metrics/ModuleLength: Metrics/PerceivedComplexity: Max: 11 -# Offense count: 1 -# Cop supports --auto-correct. -Performance/RedundantBlockCall: - Exclude: - - 'app/mailers/mailer.rb' - # Offense count: 4 # Cop supports --auto-correct. Performance/RedundantMatch: diff --git a/app/mailers/mailer.rb b/app/mailers/mailer.rb index 7e8970c61..d663f9c63 100644 --- a/app/mailers/mailer.rb +++ b/app/mailers/mailer.rb @@ -113,7 +113,7 @@ class Mailer < ApplicationMailer def with_user(user, &block) I18n.with_locale(user.locale) do - block.call + yield end end end From 256eb682d061bd6433e06f32aa01f5191c5cf17b Mon Sep 17 00:00:00 2001 From: Bertocq Date: Fri, 16 Jun 2017 00:31:31 +0200 Subject: [PATCH 08/11] Fix Rails/RequestReferer rubocop issue and remove from rubocop_todo list --- .rubocop_todo.yml | 8 -------- app/controllers/users/sessions_controller.rb | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 1954c2548..ddcf8032c 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -155,14 +155,6 @@ Rails/PluralizationGrammar: - 'spec/features/proposals_spec.rb' - 'spec/models/residence_spec.rb' -# Offense count: 2 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, SupportedStyles. -# SupportedStyles: referer, referrer -Rails/RequestReferer: - Exclude: - - 'app/controllers/users/sessions_controller.rb' - # Offense count: 11 # Configuration parameters: EnforcedStyle, SupportedStyles. # SupportedStyles: strict, flexible diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb index 6a077ee54..5605e3a00 100644 --- a/app/controllers/users/sessions_controller.rb +++ b/app/controllers/users/sessions_controller.rb @@ -11,7 +11,7 @@ class Users::SessionsController < Devise::SessionsController end def after_sign_out_path_for(resource) - request.referrer.present? ? request.referrer : super + request.referer.present? ? request.referer : super end def verifying_via_email? From 25e501c6680e69c16e81cae10a056b4d3b096915 Mon Sep 17 00:00:00 2001 From: Bertocq Date: Fri, 16 Jun 2017 00:32:58 +0200 Subject: [PATCH 09/11] Fix Style/AndOr rubocop issue and remove from rubocop_todo list --- .rubocop_todo.yml | 8 -------- app/controllers/legislation/annotations_controller.rb | 2 +- app/helpers/embed_videos_helper.rb | 2 +- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index ddcf8032c..1ce515947 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -210,14 +210,6 @@ Layout/AlignParameters: - 'spec/models/user_spec.rb' - 'spec/rails_helper.rb' -# Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, SupportedStyles. -# SupportedStyles: always, conditionals -Style/AndOr: - Exclude: - - 'app/helpers/embed_videos_helper.rb' - # Offense count: 1 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods. diff --git a/app/controllers/legislation/annotations_controller.rb b/app/controllers/legislation/annotations_controller.rb index 1605a2f67..fa46e5348 100644 --- a/app/controllers/legislation/annotations_controller.rb +++ b/app/controllers/legislation/annotations_controller.rb @@ -30,7 +30,7 @@ class Legislation::AnnotationsController < ApplicationController def create if !@process.allegations_phase.open? || @draft_version.final_version? - render json: {}, status: :not_found and return + render(json: {}, status: :not_found) && (return) end existing_annotation = @draft_version.annotations.where( diff --git a/app/helpers/embed_videos_helper.rb b/app/helpers/embed_videos_helper.rb index 22b1d878f..cb077ef36 100644 --- a/app/helpers/embed_videos_helper.rb +++ b/app/helpers/embed_videos_helper.rb @@ -21,7 +21,7 @@ module EmbedVideosHelper match = link.match(reg_exp) end - if match and match[2] + if match && match[2] '' else '' From 15c92b27c804c79a39e7829c8a58488c30fc82b9 Mon Sep 17 00:00:00 2001 From: Bertocq Date: Fri, 16 Jun 2017 00:37:58 +0200 Subject: [PATCH 10/11] Fix Style/BlockDelimiters rubocop issues and remove it from rubocop_todo list --- .rubocop_todo.yml | 11 --------- spec/features/admin/poll/polls_spec.rb | 25 +++++++++++--------- spec/features/budgets/investments_spec.rb | 18 +++++++------- spec/features/officing/final_recount_spec.rb | 12 ++++++---- spec/features/users_auth_spec.rb | 14 ++++++++--- 5 files changed, 42 insertions(+), 38 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 1ce515947..2d239f006 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -210,17 +210,6 @@ Layout/AlignParameters: - 'spec/models/user_spec.rb' - 'spec/rails_helper.rb' -# Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods. -# SupportedStyles: line_count_based, semantic, braces_for_chaining -# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object -# FunctionalMethods: let, let!, subject, watch -# IgnoredMethods: lambda, proc, it -Style/BlockDelimiters: - Exclude: - - 'spec/features/users_auth_spec.rb' - # Offense count: 2 # Cop supports --auto-correct. Layout/BlockEndNewline: diff --git a/spec/features/admin/poll/polls_spec.rb b/spec/features/admin/poll/polls_spec.rb index cb5a34265..d2041a583 100644 --- a/spec/features/admin/poll/polls_spec.rb +++ b/spec/features/admin/poll/polls_spec.rb @@ -248,18 +248,21 @@ feature 'Admin polls' do booth_assignment_recounted = create(:poll_booth_assignment, poll: poll) booth_assignment_final_recounted = create(:poll_booth_assignment, poll: poll) - 3.times { |i| create(:poll_recount, - booth_assignment: booth_assignment, - date: poll.starts_at + i.days, - count: 33) } + 3.times do |i| + create(:poll_recount, + booth_assignment: booth_assignment, + date: poll.starts_at + i.days, + count: 33) + end - 3.times { |i| create(:poll_final_recount, - booth_assignment: booth_assignment, - date: poll.starts_at + i.days, - count: 21) } + 3.times do |i| + create(:poll_final_recount, + booth_assignment: booth_assignment, + date: poll.starts_at + i.days, + count: 21) + end - 2.times { create(:poll_voter, - booth_assignment: booth_assignment_final_recounted) } + 2.times { create(:poll_voter, booth_assignment: booth_assignment_final_recounted) } create(:poll_recount, booth_assignment: booth_assignment_recounted, @@ -363,4 +366,4 @@ feature 'Admin polls' do end end -end \ No newline at end of file +end diff --git a/spec/features/budgets/investments_spec.rb b/spec/features/budgets/investments_spec.rb index b49fa8ddc..e131973da 100644 --- a/spec/features/budgets/investments_spec.rb +++ b/spec/features/budgets/investments_spec.rb @@ -337,14 +337,16 @@ feature 'Budget Investments' do end context "Show (feasible budget investment)" do - let(:investment) { create(:budget_investment, - :feasible, - :finished, - budget: budget, - group: group, - heading: heading, - price: 16, - price_explanation: 'Every wheel is 4 euros, so total is 16')} + let(:investment) do + create(:budget_investment, + :feasible, + :finished, + budget: budget, + group: group, + heading: heading, + price: 16, + price_explanation: 'Every wheel is 4 euros, so total is 16') + end background do user = create(:user) diff --git a/spec/features/officing/final_recount_spec.rb b/spec/features/officing/final_recount_spec.rb index 1fcfa48a1..ab1c39dc0 100644 --- a/spec/features/officing/final_recount_spec.rb +++ b/spec/features/officing/final_recount_spec.rb @@ -110,10 +110,12 @@ feature 'Officing Final Recount' do booth_assignment: final_officer_assignment.booth_assignment, date: 7.days.ago, count: 100) - 33.times { create(:poll_voter, :valid_document, - poll: poll, - booth_assignment: final_officer_assignment.booth_assignment, - created_at: final_recount.date) } + 33.times do + create(:poll_voter, :valid_document, + poll: poll, + booth_assignment: final_officer_assignment.booth_assignment, + created_at: final_recount.date) + end visit new_officing_poll_final_recount_path(poll) within("#poll_final_recount_#{final_recount.id}") do @@ -144,4 +146,4 @@ feature 'Officing Final Recount' do expect(page).to have_select('date', selected: I18n.l(final_recount.date.to_date, format: :long)) end -end \ No newline at end of file +end diff --git a/spec/features/users_auth_spec.rb b/spec/features/users_auth_spec.rb index 0e3d7b5e5..617b1b1d4 100644 --- a/spec/features/users_auth_spec.rb +++ b/spec/features/users_auth_spec.rb @@ -107,9 +107,17 @@ feature 'Users' do let(:twitter_hash){ {provider: 'twitter', uid: '12345', info: {name: 'manuela'}} } let(:twitter_hash_with_email){ {provider: 'twitter', uid: '12345', info: {name: 'manuela', email: 'manuelacarmena@example.com'}} } - let(:twitter_hash_with_verified_email){ {provider: 'twitter', - uid: '12345', - info: {name: 'manuela', email: 'manuelacarmena@example.com', verified: '1'}} } + let(:twitter_hash_with_verified_email) do + { + provider: 'twitter', + uid: '12345', + info: { + name: 'manuela', + email: 'manuelacarmena@example.com', + verified: '1' + } + } + end scenario 'Sign up when Oauth provider has a verified email' do OmniAuth.config.add_mock(:twitter, twitter_hash_with_verified_email) From 1eebc33da96c41d7995ee7c7b07d046b71fc5008 Mon Sep 17 00:00:00 2001 From: Bertocq Date: Mon, 19 Jun 2017 10:46:39 +0200 Subject: [PATCH 11/11] Fix bad merge conflict on rubocop_todo --- .rubocop_todo.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 2d239f006..19e3a59a6 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -14,7 +14,6 @@ Lint/InheritException: Exclude: - 'app/controllers/concerns/feature_flags.rb' -<<<<<<< HEAD # Offense count: 13 Lint/ParenthesesAsGroupedExpression: Exclude: @@ -23,13 +22,6 @@ Lint/ParenthesesAsGroupedExpression: - 'spec/features/proposals_spec.rb' - 'spec/models/debate_spec.rb' -# Offense count: 1 -Lint/UnderscorePrefixedVariableName: - Exclude: - - 'lib/manager_authenticator.rb' - -======= ->>>>>>> 0da0d145c... Fix Lint/UnderscorePrefixedVariableName issue and remove it from rubocop_todo file # Offense count: 4 # Cop supports --auto-correct. # Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.