diff --git a/.rubocop.yml b/.rubocop.yml
index 1652ce3e3..894ed16da 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -120,7 +120,14 @@ Layout/LineEndStringConcatenationIndentation:
Layout/LineLength:
Max: 110
- Severity: refactor
+ Exclude:
+ - "Gemfile"
+ - "config/environments/production.rb"
+ - "config/environments/staging.rb"
+ - "config/initializers/devise.rb"
+ - "config/initializers/backtrace_silencers.rb"
+ - "db/migrate/*create_delayed_jobs.rb"
+ - "app/models/budget/stats.rb"
Layout/MultilineArrayBraceLayout:
Enabled: true
diff --git a/app/components/admin/menu_component.rb b/app/components/admin/menu_component.rb
index 21ffbc74d..4c91e926b 100644
--- a/app/components/admin/menu_component.rb
+++ b/app/components/admin/menu_component.rb
@@ -183,7 +183,8 @@ class Admin::MenuComponent < ApplicationComponent
[
t("admin.menu.poll_booth_assignments"),
booth_assignments_admin_polls_path,
- controller_name == "polls" && action_name == "booth_assignments" || controller_name == "booth_assignments" && action_name == "manage"
+ controller_name == "polls" && action_name == "booth_assignments" ||
+ controller_name == "booth_assignments" && action_name == "manage"
]
end
@@ -255,7 +256,8 @@ class Admin::MenuComponent < ApplicationComponent
banners_link,
information_texts_link,
documents_link,
- class: ("is-active" if customization? && controller.class.module_parent != Admin::Poll::Questions::Answers)
+ class: ("is-active" if customization? &&
+ controller.class.module_parent != Admin::Poll::Questions::Answers)
)
end
diff --git a/app/components/budgets/investments/votes_component.rb b/app/components/budgets/investments/votes_component.rb
index 2a8877db2..df885ae1a 100644
--- a/app/components/budgets/investments/votes_component.rb
+++ b/app/components/budgets/investments/votes_component.rb
@@ -64,7 +64,10 @@ class Budgets::Investments::VotesComponent < ApplicationComponent
t("votes.budget_investments.#{reason}",
count: investment.group.max_votable_headings,
verify_account: link_to_verify_account,
- supported_headings: (current_user && current_user.headings_voted_within_group(investment.group).map(&:name).sort.to_sentence))
+ supported_headings: (current_user && current_user.headings_voted_within_group(investment.group)
+ .map(&:name)
+ .sort
+ .to_sentence))
end
end
end
diff --git a/app/components/relationable/related_list_component.rb b/app/components/relationable/related_list_component.rb
index f9622ccf4..e84bcd04e 100644
--- a/app/components/relationable/related_list_component.rb
+++ b/app/components/relationable/related_list_component.rb
@@ -13,6 +13,8 @@ class Relationable::RelatedListComponent < ApplicationComponent
private
def related_contents
- @related_contents ||= Kaminari.paginate_array(relationable.relationed_contents).page(params[:page]).per(5)
+ @related_contents ||= Kaminari.paginate_array(relationable.relationed_contents)
+ .page(params[:page])
+ .per(5)
end
end
diff --git a/app/components/sdg/filter_links_component.rb b/app/components/sdg/filter_links_component.rb
index 56aaa88f0..0af424fdc 100644
--- a/app/components/sdg/filter_links_component.rb
+++ b/app/components/sdg/filter_links_component.rb
@@ -33,7 +33,8 @@ class SDG::FilterLinksComponent < ApplicationComponent
def index_by(advanced_search)
if related_model.name == "Legislation::Proposal"
- legislation_process_proposals_path(params[:id], advanced_search: advanced_search, filter: params[:filter])
+ legislation_process_proposals_path(params[:id], advanced_search: advanced_search,
+ filter: params[:filter])
else
polymorphic_path(related_model, advanced_search: advanced_search)
end
diff --git a/app/controllers/admin/api/stats_controller.rb b/app/controllers/admin/api/stats_controller.rb
index e13fe7ebf..c882e0e01 100644
--- a/app/controllers/admin/api/stats_controller.rb
+++ b/app/controllers/admin/api/stats_controller.rb
@@ -22,7 +22,8 @@ class Admin::Api::StatsController < Admin::Api::BaseController
end
if params[:user_supported_budgets].present?
- ds.add "User supported budgets", Vote.where(votable_type: "Budget::Investment").group_by_day(:updated_at).count
+ ds.add "User supported budgets",
+ Vote.where(votable_type: "Budget::Investment").group_by_day(:updated_at).count
end
render json: ds.build
end
diff --git a/app/controllers/budgets/ballot/lines_controller.rb b/app/controllers/budgets/ballot/lines_controller.rb
index dc7e8cfe3..3b4d1a45f 100644
--- a/app/controllers/budgets/ballot/lines_controller.rb
+++ b/app/controllers/budgets/ballot/lines_controller.rb
@@ -10,7 +10,9 @@ module Budgets
authorize_resource :budget
authorize_resource :ballot
- load_and_authorize_resource :line, through: :ballot, find_by: :investment_id, class: "Budget::Ballot::Line"
+ load_and_authorize_resource :line, through: :ballot,
+ find_by: :investment_id,
+ class: "Budget::Ballot::Line"
def create
load_investment
diff --git a/app/controllers/budgets/investments_controller.rb b/app/controllers/budgets/investments_controller.rb
index c192827c4..81bff7ff9 100644
--- a/app/controllers/budgets/investments_controller.rb
+++ b/app/controllers/budgets/investments_controller.rb
@@ -28,7 +28,8 @@ module Budgets
has_orders %w[most_voted newest oldest], only: :show
has_orders ->(c) { c.instance_variable_get(:@budget).investments_orders }, only: :index
- has_filters ->(c) { c.instance_variable_get(:@budget).investments_filters }, only: [:index, :show, :suggest]
+ has_filters ->(c) { c.instance_variable_get(:@budget).investments_filters },
+ only: [:index, :show, :suggest]
invisible_captcha only: [:create, :update], honeypot: :subtitle, scope: :budget_investment
@@ -79,12 +80,14 @@ module Budgets
def destroy
@investment.destroy!
- redirect_to user_path(current_user, filter: "budget_investments"), notice: t("flash.actions.destroy.budget_investment")
+ redirect_to user_path(current_user, filter: "budget_investments"),
+ notice: t("flash.actions.destroy.budget_investment")
end
def suggest
@resource_path_method = :namespaced_budget_investment_path
- @resource_relation = resource_model.where(budget: @budget).apply_filters_and_search(@budget, params, @current_filter)
+ @resource_relation = resource_model.where(budget: @budget)
+ .apply_filters_and_search(@budget, params, @current_filter)
super
end
diff --git a/app/controllers/concerns/admin/budget_headings_actions.rb b/app/controllers/concerns/admin/budget_headings_actions.rb
index 1a1db8314..6e611e891 100644
--- a/app/controllers/concerns/admin/budget_headings_actions.rb
+++ b/app/controllers/concerns/admin/budget_headings_actions.rb
@@ -59,7 +59,8 @@ module Admin::BudgetHeadingsActions
end
def allowed_params
- valid_attributes = [:price, :population, :allow_custom_content, :latitude, :longitude, :max_ballot_lines, :geozone_id]
+ valid_attributes = [:price, :population, :allow_custom_content, :latitude, :longitude,
+ :max_ballot_lines, :geozone_id]
[*valid_attributes, translation_params(Budget::Heading)]
end
diff --git a/app/controllers/concerns/commentable_actions.rb b/app/controllers/concerns/commentable_actions.rb
index 1acb07778..86ea1dde8 100644
--- a/app/controllers/concerns/commentable_actions.rb
+++ b/app/controllers/concerns/commentable_actions.rb
@@ -7,7 +7,11 @@ module CommentableActions
def index
@resources = resource_model.all
- @resources = @current_order == "recommendations" && current_user.present? ? @resources.recommendations(current_user) : @resources.for_render
+ @resources = if @current_order == "recommendations" && current_user.present?
+ @resources.recommendations(current_user)
+ else
+ @resources.for_render
+ end
@resources = @resources.search(@search_terms) if @search_terms.present?
@resources = @resources.filter_by(@advanced_search_terms)
diff --git a/app/controllers/direct_uploads_controller.rb b/app/controllers/direct_uploads_controller.rb
index c6856291f..c6b2a034c 100644
--- a/app/controllers/direct_uploads_controller.rb
+++ b/app/controllers/direct_uploads_controller.rb
@@ -8,7 +8,9 @@ class DirectUploadsController < ApplicationController
helper_method :render_destroy_upload_link
def create
- @direct_upload = DirectUpload.new(direct_upload_params.merge(user: current_user, attachment: params[:attachment]))
+ @direct_upload = DirectUpload.new(
+ direct_upload_params.merge(user: current_user, attachment: params[:attachment])
+ )
if @direct_upload.valid?
@direct_upload.save_attachment
diff --git a/app/controllers/legislation/proposals_controller.rb b/app/controllers/legislation/proposals_controller.rb
index 4d68ac201..86b34bce0 100644
--- a/app/controllers/legislation/proposals_controller.rb
+++ b/app/controllers/legislation/proposals_controller.rb
@@ -30,7 +30,8 @@ class Legislation::ProposalsController < Legislation::BaseController
@proposal = Legislation::Proposal.new(proposal_params.merge(author: current_user))
if @proposal.save
- redirect_to legislation_process_proposal_path(params[:process_id], @proposal), notice: I18n.t("flash.actions.create.proposal")
+ redirect_to legislation_process_proposal_path(params[:process_id], @proposal),
+ notice: I18n.t("flash.actions.create.proposal")
else
render :new
end
diff --git a/app/controllers/management/budgets/investments_controller.rb b/app/controllers/management/budgets/investments_controller.rb
index 867d6fc6a..c03ced8bb 100644
--- a/app/controllers/management/budgets/investments_controller.rb
+++ b/app/controllers/management/budgets/investments_controller.rb
@@ -37,7 +37,10 @@ class Management::Budgets::InvestmentsController < Management::BaseController
end
def print
- @investments = @investments.apply_filters_and_search(@budget, params).order(cached_votes_up: :desc).for_render.limit(15)
+ @investments = @investments.apply_filters_and_search(@budget, params)
+ .order(cached_votes_up: :desc)
+ .for_render
+ .limit(15)
end
private
diff --git a/app/controllers/management/document_verifications_controller.rb b/app/controllers/management/document_verifications_controller.rb
index 16d878c8e..0f5eabeae 100644
--- a/app/controllers/management/document_verifications_controller.rb
+++ b/app/controllers/management/document_verifications_controller.rb
@@ -15,7 +15,9 @@ class Management::DocumentVerificationsController < Management::BaseController
elsif @document_verification.user?
render :new
elsif @document_verification.in_census?
- redirect_to new_management_email_verification_path(email_verification: document_verification_params.to_h)
+ redirect_to new_management_email_verification_path(
+ email_verification: document_verification_params.to_h
+ )
else
render :invalid_document
end
@@ -49,6 +51,8 @@ class Management::DocumentVerificationsController < Management::BaseController
def clean_document_number
return if params[:document_verification][:document_number].blank?
- params[:document_verification][:document_number] = params[:document_verification][:document_number].gsub(/[^a-z0-9]+/i, "").upcase
+ params[:document_verification][:document_number] = params[:document_verification][:document_number]
+ .gsub(/[^a-z0-9]+/i, "")
+ .upcase
end
end
diff --git a/app/controllers/management/proposals_controller.rb b/app/controllers/management/proposals_controller.rb
index 371cbf4fd..83bfadb5c 100644
--- a/app/controllers/management/proposals_controller.rb
+++ b/app/controllers/management/proposals_controller.rb
@@ -31,7 +31,9 @@ class Management::ProposalsController < Management::BaseController
super
@notifications = @proposal.notifications
- redirect_to management_proposal_path(@proposal), status: :moved_permanently if request.path != management_proposal_path(@proposal)
+ if request.path != management_proposal_path(@proposal)
+ redirect_to management_proposal_path(@proposal), status: :moved_permanently
+ end
end
def vote
diff --git a/app/controllers/management/users_controller.rb b/app/controllers/management/users_controller.rb
index 786f7b890..44c393143 100644
--- a/app/controllers/management/users_controller.rb
+++ b/app/controllers/management/users_controller.rb
@@ -24,7 +24,10 @@ class Management::UsersController < Management::BaseController
end
def erase
- managed_user.erase(t("management.users.erased_by_manager", manager: current_manager["login"])) if current_manager.present?
+ if current_manager.present?
+ managed_user.erase(t("management.users.erased_by_manager", manager: current_manager["login"]))
+ end
+
destroy_session
redirect_to management_document_verifications_path, notice: t("management.users.erased_notice")
end
diff --git a/app/controllers/officing/residence_controller.rb b/app/controllers/officing/residence_controller.rb
index 85e9813d2..e1fb05202 100644
--- a/app/controllers/officing/residence_controller.rb
+++ b/app/controllers/officing/residence_controller.rb
@@ -10,7 +10,8 @@ class Officing::ResidenceController < Officing::BaseController
def create
@residence = Officing::Residence.new(residence_params.merge(officer: current_user.poll_officer))
if @residence.save
- redirect_to new_officing_voter_path(id: @residence.user.id), notice: t("officing.residence.flash.create")
+ redirect_to new_officing_voter_path(id: @residence.user.id),
+ notice: t("officing.residence.flash.create")
else
render :new
end
diff --git a/app/controllers/officing/results_controller.rb b/app/controllers/officing/results_controller.rb
index 543607b0c..33b952d46 100644
--- a/app/controllers/officing/results_controller.rb
+++ b/app/controllers/officing/results_controller.rb
@@ -46,10 +46,12 @@ class Officing::ResultsController < Officing::BaseController
answer = question.question_answers.find_by(given_order: answer_index.to_i + 1).title
go_back_to_new if question.blank?
- partial_result = ::Poll::PartialResult.find_or_initialize_by(booth_assignment_id: @officer_assignment.booth_assignment_id,
- date: Date.current,
- question_id: question_id,
- answer: answer)
+ partial_result = ::Poll::PartialResult.find_or_initialize_by(
+ booth_assignment_id: @officer_assignment.booth_assignment_id,
+ date: Date.current,
+ question_id: question_id,
+ answer: answer
+ )
partial_result.officer_assignment_id = @officer_assignment.id
partial_result.amount = count.to_i
partial_result.author = current_user
@@ -62,8 +64,10 @@ class Officing::ResultsController < Officing::BaseController
end
def build_recounts
- recount = ::Poll::Recount.find_or_initialize_by(booth_assignment_id: @officer_assignment.booth_assignment_id,
- date: Date.current)
+ recount = ::Poll::Recount.find_or_initialize_by(
+ booth_assignment_id: @officer_assignment.booth_assignment_id,
+ date: Date.current
+ )
recount.officer_assignment_id = @officer_assignment.id
recount.author = current_user
recount.origin = "booth"
@@ -90,7 +94,9 @@ class Officing::ResultsController < Officing::BaseController
def load_officer_assignment
@officer_assignment = current_user.poll_officer
- .officer_assignments.final.find_by(id: results_params[:officer_assignment_id])
+ .officer_assignments
+ .final
+ .find_by(id: results_params[:officer_assignment_id])
end
def load_officer_assignments
diff --git a/app/controllers/proposals_controller.rb b/app/controllers/proposals_controller.rb
index 656df3e5e..5fb131053 100644
--- a/app/controllers/proposals_controller.rb
+++ b/app/controllers/proposals_controller.rb
@@ -137,7 +137,10 @@ class ProposalsController < ApplicationController
def load_retired
if params[:retired].present?
@resources = @resources.retired
- @resources = @resources.where(retired_reason: params[:retired]) if Proposal::RETIRE_OPTIONS.include?(params[:retired])
+
+ if Proposal::RETIRE_OPTIONS.include?(params[:retired])
+ @resources = @resources.where(retired_reason: params[:retired])
+ end
else
@resources = @resources.not_retired
end
@@ -152,7 +155,8 @@ class ProposalsController < ApplicationController
end
def load_featured
- return unless !@advanced_search_terms && @search_terms.blank? && params[:retired].blank? && @current_order != "recommendations"
+ return unless !@advanced_search_terms && @search_terms.blank? &&
+ params[:retired].blank? && @current_order != "recommendations"
if Setting["feature.featured_proposals"]
@featured_proposals = Proposal.not_archived
diff --git a/app/controllers/users/confirmations_controller.rb b/app/controllers/users/confirmations_controller.rb
index 589de5e94..80b0c49ff 100644
--- a/app/controllers/users/confirmations_controller.rb
+++ b/app/controllers/users/confirmations_controller.rb
@@ -43,7 +43,8 @@ class Users::ConfirmationsController < Devise::ConfirmationsController
yield resource if block_given?
- # New condition added to if: when no password was given, display the "show" view (which uses "update" above)
+ # New condition added to if: when no password was given, display the "show" view
+ # (which uses "update" above)
if resource.encrypted_password.blank?
respond_with_navigational(resource) { render :show }
elsif resource.errors.empty?
@@ -51,9 +52,14 @@ class Users::ConfirmationsController < Devise::ConfirmationsController
if resource.confirm
set_flash_message(:notice, :confirmed) if is_flashing_format?
- respond_with_navigational(resource) { redirect_to after_confirmation_path_for(resource_name, resource) }
+
+ respond_with_navigational(resource) do
+ redirect_to after_confirmation_path_for(resource_name, resource)
+ end
else
- respond_with_navigational(resource.errors, status: :unprocessable_entity) { render :new, status: :unprocessable_entity }
+ respond_with_navigational(resource.errors, status: :unprocessable_entity) do
+ render :new, status: :unprocessable_entity
+ end
end
else
respond_with_navigational(resource.errors, status: :unprocessable_entity) { render :new }
diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb
index a5f2e9cac..b170b32a2 100644
--- a/app/controllers/users/registrations_controller.rb
+++ b/app/controllers/users/registrations_controller.rb
@@ -1,5 +1,6 @@
class Users::RegistrationsController < Devise::RegistrationsController
- prepend_before_action :authenticate_scope!, only: [:edit, :update, :destroy, :finish_signup, :do_finish_signup]
+ prepend_before_action :authenticate_scope!,
+ only: [:edit, :update, :destroy, :finish_signup, :do_finish_signup]
before_action :configure_permitted_parameters
invisible_captcha only: [:create], honeypot: :address, scope: :user
@@ -52,16 +53,21 @@ class Users::RegistrationsController < Devise::RegistrationsController
def check_username
if User.find_by username: params[:username]
- render json: { available: false, message: t("devise_views.users.registrations.new.username_is_not_available") }
+ render json: { available: false,
+ message: t("devise_views.users.registrations.new.username_is_not_available") }
else
- render json: { available: true, message: t("devise_views.users.registrations.new.username_is_available") }
+ render json: { available: true,
+ message: t("devise_views.users.registrations.new.username_is_available") }
end
end
private
def sign_up_params
- params[:user].delete(:redeemable_code) if params[:user].present? && params[:user][:redeemable_code].blank?
+ if params[:user].present? && params[:user][:redeemable_code].blank?
+ params[:user].delete(:redeemable_code)
+ end
+
params.require(:user).permit(allowed_params)
end
diff --git a/app/controllers/verification/email_controller.rb b/app/controllers/verification/email_controller.rb
index 7a6d37c15..13abb1add 100644
--- a/app/controllers/verification/email_controller.rb
+++ b/app/controllers/verification/email_controller.rb
@@ -22,7 +22,8 @@ class Verification::EmailController < ApplicationController
@email.encrypted_token,
@verified_user.document_type,
@verified_user.document_number).deliver_later
- redirect_to account_path, notice: t("verification.email.create.flash.success", email: @verified_user.email)
+ redirect_to account_path,
+ notice: t("verification.email.create.flash.success", email: @verified_user.email)
else
redirect_to verified_user_path, alert: t("verification.email.create.alert.failure")
end
diff --git a/app/graphql/types/query_type.rb b/app/graphql/types/query_type.rb
index 06d855355..9f854ed55 100644
--- a/app/graphql/types/query_type.rb
+++ b/app/graphql/types/query_type.rb
@@ -20,8 +20,15 @@ module Types
argument :id, ID, required: true, default_value: false
end
- field :proposal_notifications, Types::ProposalNotificationType.connection_type, "Returns all proposal notifications", null: false
- field :proposal_notification, Types::ProposalNotificationType, "Returns proposal notification for ID", null: false do
+ field :proposal_notifications,
+ Types::ProposalNotificationType.connection_type,
+ "Returns all proposal notifications",
+ null: false
+
+ field :proposal_notification,
+ Types::ProposalNotificationType,
+ "Returns proposal notification for ID",
+ null: false do
argument :id, ID, required: true, default_value: false
end
diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb
index b89b4533a..37aab7594 100644
--- a/app/helpers/admin_helper.rb
+++ b/app/helpers/admin_helper.rb
@@ -6,7 +6,10 @@ module AdminHelper
def official_level_options
options = [["", 0]]
(1..5).each do |i|
- options << [[t("admin.officials.level_#{i}"), setting["official_level_#{i}_name"]].compact.join(": "), i]
+ options << [
+ [t("admin.officials.level_#{i}"), setting["official_level_#{i}_name"]].compact.join(": "),
+ i
+ ]
end
options
end
diff --git a/app/helpers/comments_helper.rb b/app/helpers/comments_helper.rb
index bb9015ea1..1bf679bb4 100644
--- a/app/helpers/comments_helper.rb
+++ b/app/helpers/comments_helper.rb
@@ -21,9 +21,17 @@ module CommentsHelper
def comment_button_text(parent_id, commentable)
if commentable.class == Legislation::Question
- parent_id.present? ? t("comments_helper.reply_button") : t("legislation.questions.comments.comment_button")
+ if parent_id.present?
+ t("comments_helper.reply_button")
+ else
+ t("legislation.questions.comments.comment_button")
+ end
else
- parent_id.present? ? t("comments_helper.reply_button") : t("comments_helper.comment_button")
+ if parent_id.present?
+ t("comments_helper.reply_button")
+ else
+ t("comments_helper.comment_button")
+ end
end
end
diff --git a/app/helpers/communities_helper.rb b/app/helpers/communities_helper.rb
index 9d0cd61e4..e68eb8d72 100644
--- a/app/helpers/communities_helper.rb
+++ b/app/helpers/communities_helper.rb
@@ -8,7 +8,11 @@ module CommunitiesHelper
end
def community_description(community)
- community.from_proposal? ? t("community.show.description.proposal") : t("community.show.description.investment")
+ if community.from_proposal?
+ t("community.show.description.proposal")
+ else
+ t("community.show.description.investment")
+ end
end
def author?(community, participant)
@@ -28,7 +32,11 @@ module CommunitiesHelper
end
def community_access_text(community)
- community.from_proposal? ? t("community.sidebar.description.proposal") : t("community.sidebar.description.investment")
+ if community.from_proposal?
+ t("community.sidebar.description.proposal")
+ else
+ t("community.sidebar.description.investment")
+ end
end
def create_topic_link(community)
diff --git a/app/helpers/mailer_helper.rb b/app/helpers/mailer_helper.rb
index 3ec9bfdc7..56e3b2dd0 100644
--- a/app/helpers/mailer_helper.rb
+++ b/app/helpers/mailer_helper.rb
@@ -49,7 +49,10 @@ module MailerHelper
end
def css_for_mailer_button
- mailer_font_family + "background: #004a83;border-radius: 6px;color: #fff!important;display: inline-block;font-weight: bold;margin: 0;min-width: 200px;padding: 10px 15px;text-align: center;text-decoration: none;"
+ mailer_font_family + "background: #004a83;border-radius: 6px;color: #fff!important;" \
+ "display: inline-block;font-weight: bold;margin: 0;" \
+ "min-width: 200px;padding: 10px 15px;text-align: center;" \
+ "text-decoration: none;"
end
def css_for_mailer_link
diff --git a/app/helpers/proposals_helper.rb b/app/helpers/proposals_helper.rb
index e5dccab2e..f2b82e8dc 100644
--- a/app/helpers/proposals_helper.rb
+++ b/app/helpers/proposals_helper.rb
@@ -2,7 +2,8 @@ module ProposalsHelper
def progress_bar_percentage(proposal)
case proposal.cached_votes_up
when 0 then 0
- when 1..Proposal.votes_needed_for_success then (proposal.total_votes.to_f * 100 / Proposal.votes_needed_for_success).floor
+ when 1..Proposal.votes_needed_for_success
+ (proposal.total_votes.to_f * 100 / Proposal.votes_needed_for_success).floor
else 100
end
end
diff --git a/app/mailers/mailer.rb b/app/mailers/mailer.rb
index 324252a2a..2ac040969 100644
--- a/app/mailers/mailer.rb
+++ b/app/mailers/mailer.rb
@@ -11,7 +11,10 @@ class Mailer < ApplicationMailer
manage_subscriptions_token(@commentable.author)
with_user(@commentable.author) do
- subject = t("mailers.comment.subject", commentable: t("activerecord.models.#{@commentable.class.name.underscore}", count: 1).downcase)
+ subject = t(
+ "mailers.comment.subject",
+ commentable: t("activerecord.models.#{@commentable.class.name.underscore}", count: 1).downcase
+ )
mail(to: @email_to, subject: subject) if @commentable.present? && @commentable.author.present?
end
end
@@ -65,7 +68,8 @@ class Mailer < ApplicationMailer
manage_subscriptions_token(user)
with_user(user) do
- mail(to: @email_to, subject: t("mailers.proposal_notification_digest.title", org_name: Setting["org_name"]))
+ mail(to: @email_to,
+ subject: t("mailers.proposal_notification_digest.title", org_name: Setting["org_name"]))
end
end
diff --git a/app/models/abilities/administrator.rb b/app/models/abilities/administrator.rb
index 234d3c88b..cd5e4d3f0 100644
--- a/app/models/abilities/administrator.rb
+++ b/app/models/abilities/administrator.rb
@@ -49,8 +49,9 @@ module Abilities
can :mark_featured, Debate
can :unmark_featured, Debate
- can :comment_as_administrator, [Debate, Comment, Proposal, Poll, Poll::Question, Budget::Investment,
- Legislation::Question, Legislation::Proposal, Legislation::Annotation, Topic]
+ can :comment_as_administrator, [Debate, Comment, Proposal, Poll, Poll::Question,
+ Budget::Investment, Legislation::Question,
+ Legislation::Proposal, Legislation::Annotation, Topic]
can [:search, :create, :index, :destroy, :update], ::Administrator
can [:search, :create, :index, :destroy], ::Moderator
@@ -121,7 +122,8 @@ module Abilities
can [:manage], ::Legislation::DraftVersion
can [:manage], ::Legislation::Question
can [:manage], ::Legislation::Proposal
- cannot :comment_as_moderator, [::Legislation::Question, Legislation::Annotation, ::Legislation::Proposal]
+ cannot :comment_as_moderator,
+ [::Legislation::Question, Legislation::Annotation, ::Legislation::Proposal]
can [:create], Document
can [:destroy], Document do |document|
diff --git a/app/models/abilities/common.rb b/app/models/abilities/common.rb
index 2a1432354..fe96be60b 100644
--- a/app/models/abilities/common.rb
+++ b/app/models/abilities/common.rb
@@ -91,10 +91,10 @@ module Abilities
can :vote, Legislation::Proposal
can :create, Legislation::Answer
- can :create, Budget::Investment, budget: { phase: "accepting" }
- can :update, Budget::Investment, budget: { phase: "accepting" }, author_id: user.id
- can :suggest, Budget::Investment, budget: { phase: "accepting" }
- can :destroy, Budget::Investment, budget: { phase: ["accepting", "reviewing"] }, author_id: user.id
+ can :create, Budget::Investment, budget: { phase: "accepting" }
+ can :update, Budget::Investment, budget: { phase: "accepting" }, author_id: user.id
+ can :suggest, Budget::Investment, budget: { phase: "accepting" }
+ can :destroy, Budget::Investment, budget: { phase: ["accepting", "reviewing"] }, author_id: user.id
can [:create, :destroy], ActsAsVotable::Vote,
voter_id: user.id,
votable_type: "Budget::Investment",
diff --git a/app/models/abilities/moderator.rb b/app/models/abilities/moderator.rb
index 9058c70a0..a8ef282a7 100644
--- a/app/models/abilities/moderator.rb
+++ b/app/models/abilities/moderator.rb
@@ -5,8 +5,9 @@ module Abilities
def initialize(user)
merge Abilities::Moderation.new(user)
- can :comment_as_moderator, [Debate, Comment, Proposal, Budget::Investment, Poll, Poll::Question,
- Legislation::Question, Legislation::Annotation, Legislation::Proposal, Topic]
+ can :comment_as_moderator, [Debate, Comment, Proposal, Budget::Investment, Poll,
+ Poll::Question, Legislation::Question,
+ Legislation::Annotation, Legislation::Proposal, Topic]
end
end
end
diff --git a/app/models/banner.rb b/app/models/banner.rb
index 45f2ca916..9a8a1ebe4 100644
--- a/app/models/banner.rb
+++ b/app/models/banner.rb
@@ -21,5 +21,7 @@ class Banner < ApplicationRecord
scope :with_active, -> { where("post_started_at <= :date and post_ended_at >= :date", date: Date.current) }
scope :with_inactive, -> { where.not(id: with_active) }
- scope :in_section, ->(section_name) { joins(:web_sections, :sections).where("web_sections.name ilike ?", section_name) }
+ scope :in_section, ->(section_name) do
+ joins(:web_sections, :sections).where("web_sections.name ilike ?", section_name)
+ end
end
diff --git a/app/models/budget/ballot/line.rb b/app/models/budget/ballot/line.rb
index 635f33499..8b0849a19 100644
--- a/app/models/budget/ballot/line.rb
+++ b/app/models/budget/ballot/line.rb
@@ -28,7 +28,8 @@ class Budget
def check_valid_heading
return if ballot.valid_heading?(heading)
- errors.add(:heading, "This heading's budget is invalid, or a heading on the same group was already selected")
+ errors.add(:heading,
+ "This heading's budget is invalid, or a heading on the same group was already selected")
end
def check_selected
diff --git a/app/models/budget/investment.rb b/app/models/budget/investment.rb
index d0fd4e1d1..197fbccd7 100644
--- a/app/models/budget/investment.rb
+++ b/app/models/budget/investment.rb
@@ -56,7 +56,8 @@ class Budget
class_name: "Comment"
validates_translation :title, presence: true, length: { in: 4..Budget::Investment.title_max_length }
- validates_translation :description, presence: true, length: { maximum: Budget::Investment.description_max_length }
+ validates_translation :description, presence: true,
+ length: { maximum: Budget::Investment.description_max_length }
validates :author, presence: true
validates :heading_id, presence: true
@@ -104,7 +105,9 @@ class Budget
scope :by_heading, ->(heading_id) { where(heading_id: heading_id) }
scope :by_admin, ->(admin_id) { where(administrator_id: admin_id) }
scope :by_tag, ->(tag_name) { tagged_with(tag_name).distinct }
- scope :visible_to_valuator, ->(valuator) { visible_to_valuators.where(id: valuator&.assigned_investment_ids) }
+ scope :visible_to_valuator, ->(valuator) do
+ visible_to_valuators.where(id: valuator&.assigned_investment_ids)
+ end
scope :for_render, -> { includes(:heading) }
diff --git a/app/models/concerns/filterable.rb b/app/models/concerns/filterable.rb
index db676744c..92f419ef3 100644
--- a/app/models/concerns/filterable.rb
+++ b/app/models/concerns/filterable.rb
@@ -2,8 +2,10 @@ module Filterable
extend ActiveSupport::Concern
included do
- scope :by_official_level, ->(official_level) { where(users: { official_level: official_level }).joins(:author) }
- scope :by_date_range, ->(date_range) { where(created_at: date_range) }
+ scope :by_date_range, ->(date_range) { where(created_at: date_range) }
+ scope :by_official_level, ->(official_level) do
+ where(users: { official_level: official_level }).joins(:author)
+ end
end
class_methods do
diff --git a/app/models/concerns/globalizable.rb b/app/models/concerns/globalizable.rb
index 8961620e8..8b9ea9527 100644
--- a/app/models/concerns/globalizable.rb
+++ b/app/models/concerns/globalizable.rb
@@ -83,9 +83,10 @@ module Globalizable
def validates_translation(method, options = {})
validates(method, options.merge(if: lambda { |resource| resource.translations.blank? }))
if options.include?(:length)
- lenght_validate = { length: options[:length] }
translation_class.instance_eval do
- validates method, lenght_validate.merge(if: lambda { |translation| translation.locale == I18n.default_locale })
+ validates method,
+ length: options[:length],
+ if: lambda { |translation| translation.locale == I18n.default_locale }
end
if options.count > 1
translation_class.instance_eval do
@@ -112,7 +113,9 @@ module Globalizable
translations_ids = translation_class
.select("DISTINCT ON (#{translations_foreign_key}) id")
.where(locale: fallbacks)
- .joins("LEFT JOIN (VALUES #{fallbacks_with_order}) AS locales(name, ordering) ON locale = locales.name")
+ .joins("LEFT JOIN (VALUES #{fallbacks_with_order}) " \
+ "AS locales(name, ordering) " \
+ "ON locale = locales.name")
.order(translations_foreign_key, "locales.ordering")
with_translations(fallbacks).where("#{translations_table_name}.id": translations_ids)
diff --git a/app/models/concerns/verification.rb b/app/models/concerns/verification.rb
index d775d5e96..563f2b6bb 100644
--- a/app/models/concerns/verification.rb
+++ b/app/models/concerns/verification.rb
@@ -9,10 +9,17 @@ module Verification
scope :phone_not_fully_confirmed, -> { where(unconfirmed_phone: nil).or(where(confirmed_phone: nil)) }
scope :level_three_verified, -> { where.not(verified_at: nil) }
- scope :level_two_verified, -> { where.not(level_two_verified_at: nil).or(residence_and_phone_verified.where(verified_at: nil)) }
+ scope :level_two_verified, -> do
+ where.not(level_two_verified_at: nil).or(residence_and_phone_verified.where(verified_at: nil))
+ end
scope :level_two_or_three_verified, -> { level_two_verified.or(level_three_verified) }
- scope :unverified, -> { residence_or_phone_unverified.where(verified_at: nil, level_two_verified_at: nil) }
- scope :incomplete_verification, -> { residence_unverified.where("failed_census_calls_count > ?", 0).or(residence_verified.phone_not_fully_confirmed) }
+ scope :unverified, -> do
+ residence_or_phone_unverified.where(verified_at: nil, level_two_verified_at: nil)
+ end
+ scope :incomplete_verification, -> do
+ residence_unverified.where("failed_census_calls_count > ?", 0)
+ .or(residence_verified.phone_not_fully_confirmed)
+ end
end
def skip_verification?
diff --git a/app/models/debate.rb b/app/models/debate.rb
index 0606d6630..4316b4777 100644
--- a/app/models/debate.rb
+++ b/app/models/debate.rb
@@ -160,7 +160,11 @@ class Debate < ApplicationRecord
def self.debates_orders(user)
orders = %w[hot_score confidence_score created_at relevance]
- orders << "recommendations" if Setting["feature.user.recommendations_on_debates"] && user&.recommended_debates
+
+ if Setting["feature.user.recommendations_on_debates"] && user&.recommended_debates
+ orders << "recommendations"
+ end
+
orders
end
diff --git a/app/models/direct_upload.rb b/app/models/direct_upload.rb
index e56138087..aeff35fcb 100644
--- a/app/models/direct_upload.rb
+++ b/app/models/direct_upload.rb
@@ -16,12 +16,15 @@ class DirectUpload
send("#{name}=", value)
end
- if @resource_type.present? && @resource_relation.present? && (@attachment.present? || @cached_attachment.present?)
+ if @resource_type.present? &&
+ @resource_relation.present? &&
+ (@attachment.present? || @cached_attachment.present?)
@resource = @resource_type.constantize.find_or_initialize_by(id: @resource_id)
# Refactor
@relation = if @resource.respond_to?(:images) &&
- ((@attachment.present? && !@attachment.content_type.match(/pdf/)) || @cached_attachment.present?)
+ (@attachment.present? && !@attachment.content_type.match(/pdf/) ||
+ @cached_attachment.present?)
@resource.images.send(:build, relation_attributtes)
elsif @resource.class.reflections[@resource_relation].macro == :has_one
@resource.send("build_#{resource_relation}", relation_attributtes)
diff --git a/app/models/legislation/question.rb b/app/models/legislation/question.rb
index c0ea91527..569544b6d 100644
--- a/app/models/legislation/question.rb
+++ b/app/models/legislation/question.rb
@@ -10,12 +10,19 @@ class Legislation::Question < ApplicationRecord
belongs_to :author, -> { with_hidden }, class_name: "User", inverse_of: :legislation_questions
belongs_to :process, foreign_key: "legislation_process_id", inverse_of: :questions
- has_many :question_options, -> { order(:id) }, class_name: "Legislation::QuestionOption", foreign_key: "legislation_question_id",
- dependent: :destroy, inverse_of: :question
- has_many :answers, class_name: "Legislation::Answer", foreign_key: "legislation_question_id", dependent: :destroy, inverse_of: :question
+ has_many :question_options, -> { order(:id) }, class_name: "Legislation::QuestionOption",
+ foreign_key: "legislation_question_id",
+ dependent: :destroy,
+ inverse_of: :question
+ has_many :answers, class_name: "Legislation::Answer",
+ foreign_key: "legislation_question_id",
+ dependent: :destroy,
+ inverse_of: :question
has_many :comments, as: :commentable, inverse_of: :commentable, dependent: :destroy
- accepts_nested_attributes_for :question_options, reject_if: proc { |attributes| attributes.all? { |k, v| v.blank? } }, allow_destroy: true
+ accepts_nested_attributes_for :question_options,
+ reject_if: proc { |attributes| attributes.all? { |k, v| v.blank? } },
+ allow_destroy: true
validates :process, presence: true
validates_translation :title, presence: true
diff --git a/app/models/machine_learning.rb b/app/models/machine_learning.rb
index 35182cc95..bfe8bb33d 100644
--- a/app/models/machine_learning.rb
+++ b/app/models/machine_learning.rb
@@ -22,13 +22,15 @@ class MachineLearning
return unless run_machine_learning_scripts
- if updated_file?(MachineLearning.proposals_taggings_filename) && updated_file?(MachineLearning.proposals_tags_filename)
+ if updated_file?(MachineLearning.proposals_taggings_filename) &&
+ updated_file?(MachineLearning.proposals_tags_filename)
cleanup_proposals_tags!
import_ml_proposals_tags
update_machine_learning_info_for("tags")
end
- if updated_file?(MachineLearning.investments_taggings_filename) && updated_file?(MachineLearning.investments_tags_filename)
+ if updated_file?(MachineLearning.investments_taggings_filename) &&
+ updated_file?(MachineLearning.investments_tags_filename)
cleanup_investments_tags!
import_ml_investments_tags
update_machine_learning_info_for("tags")
@@ -95,14 +97,32 @@ class MachineLearning
def data_output_files
files = { tags: [], related_content: [], comments_summary: [] }
- files[:tags] << proposals_tags_filename if File.exist?(data_folder.join(proposals_tags_filename))
- files[:tags] << proposals_taggings_filename if File.exist?(data_folder.join(proposals_taggings_filename))
- files[:tags] << investments_tags_filename if File.exist?(data_folder.join(investments_tags_filename))
- files[:tags] << investments_taggings_filename if File.exist?(data_folder.join(investments_taggings_filename))
- files[:related_content] << proposals_related_filename if File.exist?(data_folder.join(proposals_related_filename))
- files[:related_content] << investments_related_filename if File.exist?(data_folder.join(investments_related_filename))
- files[:comments_summary] << proposals_comments_summary_filename if File.exist?(data_folder.join(proposals_comments_summary_filename))
- files[:comments_summary] << investments_comments_summary_filename if File.exist?(data_folder.join(investments_comments_summary_filename))
+ if File.exist?(data_folder.join(proposals_tags_filename))
+ files[:tags] << proposals_tags_filename
+ end
+ if File.exist?(data_folder.join(proposals_taggings_filename))
+ files[:tags] << proposals_taggings_filename
+ end
+ if File.exist?(data_folder.join(investments_tags_filename))
+ files[:tags] << investments_tags_filename
+ end
+ if File.exist?(data_folder.join(investments_taggings_filename))
+ files[:tags] << investments_taggings_filename
+ end
+
+ if File.exist?(data_folder.join(proposals_related_filename))
+ files[:related_content] << proposals_related_filename
+ end
+ if File.exist?(data_folder.join(investments_related_filename))
+ files[:related_content] << investments_related_filename
+ end
+
+ if File.exist?(data_folder.join(proposals_comments_summary_filename))
+ files[:comments_summary] << proposals_comments_summary_filename
+ end
+ if File.exist?(data_folder.join(investments_comments_summary_filename))
+ files[:comments_summary] << investments_comments_summary_filename
+ end
files
end
diff --git a/app/models/organization.rb b/app/models/organization.rb
index 436521fd4..e311e1622 100644
--- a/app/models/organization.rb
+++ b/app/models/organization.rb
@@ -12,8 +12,13 @@ class Organization < ApplicationRecord
delegate :email, :phone_number, to: :user
scope :pending, -> { where(verified_at: nil, rejected_at: nil) }
- scope :verified, -> { where.not(verified_at: nil).where("(rejected_at IS NULL or rejected_at < organizations.verified_at)") }
- scope :rejected, -> { where.not(rejected_at: nil).where("(organizations.verified_at IS NULL or organizations.verified_at < rejected_at)") }
+ scope :verified, -> do
+ where.not(verified_at: nil).where("(rejected_at IS NULL or rejected_at < organizations.verified_at)")
+ end
+ scope :rejected, -> do
+ where.not(rejected_at: nil)
+ .where("(organizations.verified_at IS NULL or organizations.verified_at < rejected_at)")
+ end
def verify
update(verified_at: Time.current)
@@ -33,7 +38,8 @@ class Organization < ApplicationRecord
def self.search(text)
if text.present?
- joins(:user).where("users.email = ? OR users.phone_number = ? OR organizations.name ILIKE ?", text, text, "%#{text}%")
+ joins(:user).where("users.email = ? OR users.phone_number = ? OR organizations.name ILIKE ?",
+ text, text, "%#{text}%")
else
none
end
diff --git a/app/models/poll.rb b/app/models/poll.rb
index 866605117..1ceff3b7b 100644
--- a/app/models/poll.rb
+++ b/app/models/poll.rb
@@ -57,7 +57,8 @@ class Poll < ApplicationRecord
def self.sort_for_list(user = nil)
all.sort do |poll, another_poll|
- [poll.weight(user), poll.starts_at, poll.name] <=> [another_poll.weight(user), another_poll.starts_at, another_poll.name]
+ [poll.weight(user), poll.starts_at, poll.name] <=>
+ [another_poll.weight(user), another_poll.starts_at, another_poll.name]
end
end
diff --git a/app/models/poll/booth_assignment.rb b/app/models/poll/booth_assignment.rb
index 3af585e77..37132be73 100644
--- a/app/models/poll/booth_assignment.rb
+++ b/app/models/poll/booth_assignment.rb
@@ -24,7 +24,9 @@ class Poll
private
def shifts
- Poll::Shift.where(booth_id: booth_id, officer_id: officer_assignments.pluck(:officer_id), date: officer_assignments.pluck(:date))
+ Poll::Shift.where(booth_id: booth_id,
+ officer_id: officer_assignments.pluck(:officer_id),
+ date: officer_assignments.pluck(:date))
end
def destroy_poll_shifts
diff --git a/app/models/poll/recount.rb b/app/models/poll/recount.rb
index 578956692..5e1692792 100644
--- a/app/models/poll/recount.rb
+++ b/app/models/poll/recount.rb
@@ -20,7 +20,9 @@ class Poll::Recount < ApplicationRecord
amounts_changed = false
[:white, :null, :total].each do |amount|
- next unless send("will_save_change_to_#{amount}_amount?") && send("#{amount}_amount_in_database").present?
+ unless send("will_save_change_to_#{amount}_amount?") && send("#{amount}_amount_in_database").present?
+ next
+ end
self["#{amount}_amount_log"] += ":#{send("#{amount}_amount_in_database")}"
amounts_changed = true
diff --git a/app/models/progress_bar.rb b/app/models/progress_bar.rb
index 59d051da1..c966f6c9f 100644
--- a/app/models/progress_bar.rb
+++ b/app/models/progress_bar.rb
@@ -16,7 +16,10 @@ class ProgressBar < ApplicationRecord
scope: [:progressable_type, :progressable_id],
conditions: -> { primary }
}
- validates :percentage, presence: true, inclusion: { in: ->(*) { RANGE }}, numericality: { only_integer: true }
+ validates :percentage,
+ presence: true,
+ inclusion: { in: ->(*) { RANGE }},
+ numericality: { only_integer: true }
validates_translation :title, presence: true, unless: :primary?
end
diff --git a/app/models/proposal.rb b/app/models/proposal.rb
index 3ec643b4f..c680cdc0b 100644
--- a/app/models/proposal.rb
+++ b/app/models/proposal.rb
@@ -50,8 +50,12 @@ class Proposal < ApplicationRecord
validates :author, presence: true
validates :responsible_name, presence: true, unless: :skip_user_verification?
- validates :responsible_name, length: { in: 6..Proposal.responsible_name_max_length }, unless: :skip_user_verification?
- validates :retired_reason, presence: true, inclusion: { in: ->(*) { RETIRE_OPTIONS }}, unless: -> { retired_at.blank? }
+ validates :responsible_name,
+ length: { in: 6..Proposal.responsible_name_max_length },
+ unless: :skip_user_verification?
+ validates :retired_reason,
+ presence: true,
+ inclusion: { in: ->(*) { RETIRE_OPTIONS }}, unless: -> { retired_at.blank? }
validates :terms_of_service, acceptance: { allow_nil: false }, on: :create
@@ -236,7 +240,11 @@ class Proposal < ApplicationRecord
def self.proposals_orders(user)
orders = %w[hot_score confidence_score created_at relevance archival_date]
- orders << "recommendations" if Setting["feature.user.recommendations_on_proposals"] && user&.recommended_proposals
+
+ if Setting["feature.user.recommendations_on_proposals"] && user&.recommended_proposals
+ orders << "recommendations"
+ end
+
orders
end
diff --git a/app/models/proposal_notification.rb b/app/models/proposal_notification.rb
index 77ebde6f9..5579fd728 100644
--- a/app/models/proposal_notification.rb
+++ b/app/models/proposal_notification.rb
@@ -31,7 +31,11 @@ class ProposalNotification < ApplicationRecord
interval = Setting[:proposal_notification_minimum_interval_in_days]
minimum_interval = (Time.current - interval.to_i.days).to_datetime
if proposal.notifications.last.created_at > minimum_interval
- errors.add(:title, I18n.t("activerecord.errors.models.proposal_notification.attributes.minimum_interval.invalid", interval: interval))
+ errors.add(
+ :title,
+ I18n.t("activerecord.errors.models.proposal_notification.attributes.minimum_interval.invalid",
+ interval: interval)
+ )
end
end
diff --git a/app/models/related_content.rb b/app/models/related_content.rb
index abd45fe51..7a88f960f 100644
--- a/app/models/related_content.rb
+++ b/app/models/related_content.rb
@@ -11,7 +11,10 @@ class RelatedContent < ApplicationRecord
has_one :opposite_related_content, class_name: name, foreign_key: :related_content_id
has_many :related_content_scores, dependent: :destroy
- validates :parent_relationable_id, uniqueness: { scope: [:parent_relationable_type, :child_relationable_id, :child_relationable_type] }
+ validates :parent_relationable_id,
+ uniqueness: {
+ scope: [:parent_relationable_type, :child_relationable_id, :child_relationable_type]
+ }
validate :different_parent_and_child
after_create :create_opposite_related_content, unless: proc { opposite_related_content.present? }
@@ -66,7 +69,10 @@ class RelatedContent < ApplicationRecord
def score(value, user)
score_with_opposite(value, user)
- hide_with_opposite if (related_content_scores.sum(:value) / related_content_scores_count) < RELATED_CONTENT_SCORE_THRESHOLD
+
+ if (related_content_scores.sum(:value) / related_content_scores_count) < RELATED_CONTENT_SCORE_THRESHOLD
+ hide_with_opposite
+ end
end
def hide_with_opposite
diff --git a/app/models/signature.rb b/app/models/signature.rb
index bec7d7f39..8576916ae 100644
--- a/app/models/signature.rb
+++ b/app/models/signature.rb
@@ -28,7 +28,9 @@ class Signature < ApplicationRecord
def assign_vote_to_user
set_user
if signable.is_a? Budget::Investment
- signable.vote_by(voter: user, vote: "yes") if [nil, :no_selecting_allowed].include?(signable.reason_for_not_being_selectable_by(user))
+ if [nil, :no_selecting_allowed].include?(signable.reason_for_not_being_selectable_by(user))
+ signable.vote_by(voter: user, vote: "yes")
+ end
else
signable.register_vote(user, "yes")
end
diff --git a/app/models/verification/management/email.rb b/app/models/verification/management/email.rb
index fbda50b8f..cb1c1bc82 100644
--- a/app/models/verification/management/email.rb
+++ b/app/models/verification/management/email.rb
@@ -53,10 +53,12 @@ class Verification::Management::Email
return if errors.count > 0
if document_number_mismatch?
- errors.add(:email,
- I18n.t("management.email_verifications.document_mismatch",
- document_type: ApplicationController.helpers.humanize_document_type(user.document_type),
- document_number: user.document_number))
+ errors.add(
+ :email,
+ I18n.t("management.email_verifications.document_mismatch",
+ document_type: ApplicationController.helpers.humanize_document_type(user.document_type),
+ document_number: user.document_number)
+ )
end
end
diff --git a/app/models/verification/residence.rb b/app/models/verification/residence.rb
index f266ed0db..d52e56476 100644
--- a/app/models/verification/residence.rb
+++ b/app/models/verification/residence.rb
@@ -48,7 +48,9 @@ class Verification::Residence
end
def document_number_uniqueness
- errors.add(:document_number, I18n.t("errors.messages.taken")) if User.active.where(document_number: document_number).any?
+ if User.active.where(document_number: document_number).any?
+ errors.add(:document_number, I18n.t("errors.messages.taken"))
+ end
end
def store_failed_attempt
@@ -74,7 +76,8 @@ class Verification::Residence
end
def local_postal_code
- errors.add(:postal_code, I18n.t("verification.residence.new.error_not_allowed_postal_code")) unless valid_postal_code?
+ errors.add(:postal_code,
+ I18n.t("verification.residence.new.error_not_allowed_postal_code")) unless valid_postal_code?
end
def local_residence
diff --git a/app/views/legislation/processes/summary.xlsx.axlsx b/app/views/legislation/processes/summary.xlsx.axlsx
index a36ddd338..675904189 100644
--- a/app/views/legislation/processes/summary.xlsx.axlsx
+++ b/app/views/legislation/processes/summary.xlsx.axlsx
@@ -4,11 +4,19 @@ xlsx_package.workbook.add_worksheet(name: "Summary") do |sheet|
link = styles.add_style(fg_color: "0000FF", u: true)
if @process.debate_phase.enabled? && @process.questions.any?
- sheet.add_row [t("legislation.summary.debate_phase"), t("legislation.summary.debates", count: @process.questions.count)], style: title
+ sheet.add_row(
+ [
+ t("legislation.summary.debate_phase"),
+ t("legislation.summary.debates", count: @process.questions.count)
+ ],
+ style: title
+ )
@process.questions.each do |question|
sheet.add_row [question.title, t("shared.comments", count: question.comments.count)], style: link
- sheet.add_hyperlink location: legislation_process_question_url(question.process, question), ref: sheet.rows.last.cells.first
- sheet.add_hyperlink location: polymorphic_url(question, anchor: "comments"), ref: sheet.rows.last.cells.last
+ sheet.add_hyperlink location: legislation_process_question_url(question.process, question),
+ ref: sheet.rows.last.cells.first
+ sheet.add_hyperlink location: polymorphic_url(question, anchor: "comments"),
+ ref: sheet.rows.last.cells.last
sheet.add_row [t("legislation.summary.most_voted_comments")] if question.best_comments.any?
question.best_comments.each do |comment|
sheet.add_row [comment.body, t("legislation.summary.votes", count: comment.votes_score)]
@@ -20,22 +28,37 @@ xlsx_package.workbook.add_worksheet(name: "Summary") do |sheet|
end
if @process.proposals_phase.enabled? && @proposals.any?
- sheet.add_row [t("legislation.summary.proposals_phase"), t("legislation.summary.proposals", count: @proposals.count)], style: title
+ sheet.add_row(
+ [
+ t("legislation.summary.proposals_phase"),
+ t("legislation.summary.proposals", count: @proposals.count)
+ ],
+ style: title
+ )
@proposals.sort_by_supports.each do |proposal|
sheet.add_row [proposal.title, t("legislation.summary.votes", count: proposal.votes_score)]
- sheet.add_hyperlink location: legislation_process_proposal_url(proposal.legislation_process_id, proposal), ref: sheet.rows.last.cells.first
+ sheet.add_hyperlink(
+ location: legislation_process_proposal_url(proposal.legislation_process_id, proposal),
+ ref: sheet.rows.last.cells.first
+ )
sheet.rows.last.cells.first.style = link
end
sheet.add_row ["", ""]
end
if @process.allegations_phase.enabled? && @comments.any?
- sheet.add_row [t("legislation.summary.allegations_phase"),
- t("legislation.summary.top_comments", count: @comments.count)], style: title
+ sheet.add_row(
+ [
+ t("legislation.summary.allegations_phase"),
+ t("legislation.summary.top_comments", count: @comments.count)
+ ],
+ style: title
+ )
@comments.group_by(&:commentable).each do |annotation, annotation_comments|
sheet.add_row [t("legislation.annotations.index.comments_about")]
sheet.add_row [annotation.quote, t("shared.comments", count: annotation.comments.count)]
- sheet.add_hyperlink location: polymorphic_url(annotation, anchor: "comments"), ref: sheet.rows.last.cells.last
+ sheet.add_hyperlink location: polymorphic_url(annotation, anchor: "comments"),
+ ref: sheet.rows.last.cells.last
sheet.rows.last.cells.last.style = link
annotation_comments.each do |comment|
diff --git a/config/deploy.rb b/config/deploy.rb
index 92b8abd24..fc60ff594 100644
--- a/config/deploy.rb
+++ b/config/deploy.rb
@@ -30,7 +30,8 @@ set :pty, true
set :use_sudo, false
set :linked_files, %w[config/database.yml config/secrets.yml]
-set :linked_dirs, %w[.bundle log tmp public/system public/assets public/ckeditor_assets public/machine_learning/data storage]
+set :linked_dirs, %w[.bundle log tmp public/system public/assets
+ public/ckeditor_assets public/machine_learning/data storage]
set :keep_releases, 5
diff --git a/config/initializers/apartment.rb b/config/initializers/apartment.rb
index 511699f4b..cda7ae581 100644
--- a/config/initializers/apartment.rb
+++ b/config/initializers/apartment.rb
@@ -99,7 +99,8 @@ Apartment.configure do |config|
#
# config.pg_excluded_names = ["uuid_generate_v4"]
- # Specifies whether the database and schema (when using PostgreSQL schemas) will prepend in ActiveRecord log.
+ # Specifies whether the database and schema (when using PostgreSQL schemas)
+ # will prepend in ActiveRecord log.
# Uncomment the line below if you want to enable this behavior.
#
# config.active_record_log = true
@@ -107,9 +108,9 @@ end
# Setup a custom Tenant switching middleware. The Proc should return the name of the Tenant that
# you want to switch to.
-Rails.application.config.middleware.insert_before Warden::Manager, Apartment::Elevators::Generic, ->(request) do
- Tenant.resolve_host(request.host)
-end
+Rails.application.config.middleware.insert_before Warden::Manager,
+ Apartment::Elevators::Generic,
+ ->(request) { Tenant.resolve_host(request.host) }
# Rails.application.config.middleware.use Apartment::Elevators::Domain
# Rails.application.config.middleware.use Apartment::Elevators::Subdomain
diff --git a/config/initializers/devise-security.rb b/config/initializers/devise-security.rb
index ce6877365..6de4d3f80 100644
--- a/config/initializers/devise-security.rb
+++ b/config/initializers/devise-security.rb
@@ -63,7 +63,11 @@ module Devise
if !new_record? && !encrypted_password_change.nil? && !erased?
dummy = self.class.new
dummy.encrypted_password = encrypted_password_change.first
- dummy.password_salt = password_salt_change.first if respond_to?(:password_salt_change) && !password_salt_change.nil?
+
+ if respond_to?(:password_salt_change) && !password_salt_change.nil?
+ dummy.password_salt = password_salt_change.first
+ end
+
errors.add(:password, :equal_to_current_password) if dummy.valid_password?(password)
end
end
diff --git a/config/routes/admin.rb b/config/routes/admin.rb
index 2fa509e36..7d97f99e3 100644
--- a/config/routes/admin.rb
+++ b/config/routes/admin.rb
@@ -253,9 +253,12 @@ namespace :admin do
end
resources :images, only: [:index, :update, :destroy]
resources :content_blocks, except: [:show]
- delete "/heading_content_blocks/:id", to: "content_blocks#delete_heading_content_block", as: "delete_heading_content_block"
- get "/edit_heading_content_blocks/:id", to: "content_blocks#edit_heading_content_block", as: "edit_heading_content_block"
- put "/update_heading_content_blocks/:id", to: "content_blocks#update_heading_content_block", as: "update_heading_content_block"
+ delete "/heading_content_blocks/:id", to: "content_blocks#delete_heading_content_block",
+ as: "delete_heading_content_block"
+ get "/edit_heading_content_blocks/:id", to: "content_blocks#edit_heading_content_block",
+ as: "edit_heading_content_block"
+ put "/update_heading_content_blocks/:id", to: "content_blocks#update_heading_content_block",
+ as: "update_heading_content_block"
resources :information_texts, only: [:index] do
post :update, on: :collection
end
diff --git a/db/dev_seeds/geozones.rb b/db/dev_seeds/geozones.rb
index d608435d0..02f09499f 100644
--- a/db/dev_seeds/geozones.rb
+++ b/db/dev_seeds/geozones.rb
@@ -2,23 +2,28 @@ section "Creating Geozones" do
Geozone.create!(name: I18n.t("seeds.geozones.north_district"),
external_code: "001", census_code: "01",
html_map_coordinates: "30,139,45,153,77,148,107,165,138,201,146,218,186,198,216," \
- "196,233,203,240,215,283,194,329,185,377,184,388,165,369,126,333,113,334,84,320," \
- "66,286,73,258,65,265,57,249,47,207,58,159,84,108,85,72,101,51,114")
+ "196,233,203,240,215,283,194,329,185,377,184,388,165,369," \
+ "126,333,113,334,84,320,66,286,73,258,65,265,57,249,47," \
+ "207,58,159,84,108,85,72,101,51,114")
Geozone.create!(name: I18n.t("seeds.geozones.west_district"),
external_code: "002", census_code: "02",
html_map_coordinates: "42,153,31,176,24,202,20,221,44,235,59,249,55,320,30,354," \
- "31,372,52,396,64,432,89,453,116,432,149,419,162,412,165,377,172,357,189,352,228," \
- "327,246,313,262,297,234,291,210,284,193,284,176,294,158,303,154,310,146,289,140," \
- "268,138,246,135,236,139,222,151,214,136,197,120,179,99,159,85,149,65,149,56,149")
+ "31,372,52,396,64,432,89,453,116,432,149,419,162,412,165," \
+ "377,172,357,189,352,228,327,246,313,262,297,234,291,210," \
+ "284,193,284,176,294,158,303,154,310,146,289,140,268,138," \
+ "246,135,236,139,222,151,214,136,197,120,179,99,159,85," \
+ "149,65,149,56,149")
Geozone.create!(name: I18n.t("seeds.geozones.east_district"),
external_code: "003", census_code: "03",
html_map_coordinates: "175,353,162,378,161,407,153,416,167,432,184,447,225,426," \
- "250,409,283,390,298,369,344,363,351,334,356,296,361,267,376,245,378,185,327,188," \
- "281,195,239,216,245,221,245,232,261,244,281,238,300,242,304,251,285,262,278,277," \
- "267,294,249,312,219,333,198,346,184,353")
+ "250,409,283,390,298,369,344,363,351,334,356,296,361,267," \
+ "376,245,378,185,327,188,281,195,239,216,245,221,245,232," \
+ "261,244,281,238,300,242,304,251,285,262,278,277,267,294," \
+ "249,312,219,333,198,346,184,353")
Geozone.create!(name: I18n.t("seeds.geozones.central_district"),
external_code: "004", census_code: "04",
html_map_coordinates: "152,308,137,258,133,235,147,216,152,214,186,194,210,196," \
- "228,202,240,216,241,232,263,243,293,241,301,245,302,254,286,265,274,278,267,296," \
- "243,293,226,289,209,285,195,283,177,297")
+ "228,202,240,216,241,232,263,243,293,241,301,245,302,254," \
+ "286,265,274,278,267,296,243,293,226,289,209,285,195,283," \
+ "177,297")
end
diff --git a/db/migrate/20150820103351_create_inappropiate_flags.rb b/db/migrate/20150820103351_create_inappropiate_flags.rb
index 265bfdda5..4f4ad06c8 100644
--- a/db/migrate/20150820103351_create_inappropiate_flags.rb
+++ b/db/migrate/20150820103351_create_inappropiate_flags.rb
@@ -10,6 +10,7 @@ class CreateInappropiateFlags < ActiveRecord::Migration[4.2]
end
add_index :inappropiate_flags, [:flaggable_type, :flaggable_id]
- add_index :inappropiate_flags, [:user_id, :flaggable_type, :flaggable_id], name: "access_inappropiate_flags"
+ add_index :inappropiate_flags, [:user_id, :flaggable_type, :flaggable_id],
+ name: "access_inappropiate_flags"
end
end
diff --git a/db/migrate/20171127171925_create_related_content.rb b/db/migrate/20171127171925_create_related_content.rb
index 380104342..e9707016f 100644
--- a/db/migrate/20171127171925_create_related_content.rb
+++ b/db/migrate/20171127171925_create_related_content.rb
@@ -1,12 +1,19 @@
class CreateRelatedContent < ActiveRecord::Migration[4.2]
def change
create_table :related_contents do |t|
- t.references :parent_relationable, polymorphic: true, index: { name: "index_related_contents_on_parent_relationable" }
- t.references :child_relationable, polymorphic: true, index: { name: "index_related_contents_on_child_relationable" }
+ t.references :parent_relationable, polymorphic: true,
+ index: { name: "index_related_contents_on_parent_relationable" }
+ t.references :child_relationable, polymorphic: true,
+ index: { name: "index_related_contents_on_child_relationable" }
t.references :related_content, index: { name: "opposite_related_content" }
t.timestamps
end
- add_index :related_contents, [:parent_relationable_id, :parent_relationable_type, :child_relationable_id, :child_relationable_type], name: "unique_parent_child_related_content", unique: true, using: :btree
+ add_index :related_contents,
+ [:parent_relationable_id, :parent_relationable_type,
+ :child_relationable_id, :child_relationable_type],
+ name: "unique_parent_child_related_content",
+ unique: true,
+ using: :btree
end
end
diff --git a/db/migrate/20171219184209_create_related_content_scores.rb b/db/migrate/20171219184209_create_related_content_scores.rb
index c5136cbfc..16f8ca473 100644
--- a/db/migrate/20171219184209_create_related_content_scores.rb
+++ b/db/migrate/20171219184209_create_related_content_scores.rb
@@ -6,6 +6,10 @@ class CreateRelatedContentScores < ActiveRecord::Migration[4.2]
t.integer :value
end
- add_index :related_content_scores, [:user_id, :related_content_id], name: "unique_user_related_content_scoring", unique: true, using: :btree
+ add_index :related_content_scores,
+ [:user_id, :related_content_id],
+ name: "unique_user_related_content_scoring",
+ unique: true,
+ using: :btree
end
end
diff --git a/db/migrate/20180723102010_rename_administrator_task_to_dashboard_administrator_task.rb b/db/migrate/20180723102010_rename_administrator_task_to_dashboard_administrator_task.rb
index 59ce79074..92c2091d3 100644
--- a/db/migrate/20180723102010_rename_administrator_task_to_dashboard_administrator_task.rb
+++ b/db/migrate/20180723102010_rename_administrator_task_to_dashboard_administrator_task.rb
@@ -1,6 +1,8 @@
class RenameAdministratorTaskToDashboardAdministratorTask < ActiveRecord::Migration[4.2]
def change
- rename_index :administrator_tasks, "index_administrator_tasks_on_source_type_and_source_id", "index_dashboard_administrator_tasks_on_source"
+ rename_index :administrator_tasks,
+ "index_administrator_tasks_on_source_type_and_source_id",
+ "index_dashboard_administrator_tasks_on_source"
rename_table :administrator_tasks, :dashboard_administrator_tasks
end
end
diff --git a/db/migrate/20190423072214_create_legislation_people_proposals_table.rb b/db/migrate/20190423072214_create_legislation_people_proposals_table.rb
index 09485fb9c..5ae6628a3 100644
--- a/db/migrate/20190423072214_create_legislation_people_proposals_table.rb
+++ b/db/migrate/20190423072214_create_legislation_people_proposals_table.rb
@@ -29,6 +29,9 @@ class CreateLegislationPeopleProposalsTable < ActiveRecord::Migration[4.2]
t.boolean "validated"
t.integer "cached_votes_score", default: 0
end
- add_index "legislation_people_proposals", ["cached_votes_score"], name: "index_legislation_people_proposals_on_cached_votes_score", using: :btree
+ add_index "legislation_people_proposals",
+ ["cached_votes_score"],
+ name: "index_legislation_people_proposals_on_cached_votes_score",
+ using: :btree
end
end
diff --git a/db/migrate/20201117200945_create_sdg_relations.rb b/db/migrate/20201117200945_create_sdg_relations.rb
index 55415c78c..054aabd27 100644
--- a/db/migrate/20201117200945_create_sdg_relations.rb
+++ b/db/migrate/20201117200945_create_sdg_relations.rb
@@ -4,7 +4,9 @@ class CreateSDGRelations < ActiveRecord::Migration[5.2]
t.references :related_sdg, polymorphic: true
t.references :relatable, polymorphic: true
- t.index [:related_sdg_id, :related_sdg_type, :relatable_id, :relatable_type], name: "sdg_relations_unique", unique: true
+ t.index [:related_sdg_id, :related_sdg_type, :relatable_id, :relatable_type],
+ name: "sdg_relations_unique",
+ unique: true
t.timestamps
end
diff --git a/db/migrate/20210619201902_create_active_storage_tables.active_storage.rb b/db/migrate/20210619201902_create_active_storage_tables.active_storage.rb
index ce71f5783..1aeb2879a 100644
--- a/db/migrate/20210619201902_create_active_storage_tables.active_storage.rb
+++ b/db/migrate/20210619201902_create_active_storage_tables.active_storage.rb
@@ -20,7 +20,9 @@ class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
t.datetime :created_at, null: false
- t.index [:record_type, :record_id, :name, :blob_id], name: "index_active_storage_attachments_uniqueness", unique: true
+ t.index [:record_type, :record_id, :name, :blob_id],
+ name: "index_active_storage_attachments_uniqueness",
+ unique: true
t.foreign_key :active_storage_blobs, column: :blob_id
end
end
diff --git a/lib/manager_authenticator.rb b/lib/manager_authenticator.rb
index fbe1ccab8..d0521aa96 100644
--- a/lib/manager_authenticator.rb
+++ b/lib/manager_authenticator.rb
@@ -1,6 +1,10 @@
class ManagerAuthenticator
def initialize(data = {})
- @manager = { login: data[:login], user_key: data[:clave_usuario], date: data[:fecha_conexion] }.with_indifferent_access
+ @manager = {
+ login: data[:login],
+ user_key: data[:clave_usuario],
+ date: data[:fecha_conexion]
+ }.with_indifferent_access
end
def auth
@@ -13,7 +17,11 @@ class ManagerAuthenticator
private
def manager_exists?
- response = client.call(:get_status_user_data, message: { ub: { user_key: @manager[:user_key], date: @manager[:date] }}).body
+ response = client.call(
+ :get_status_user_data,
+ message: { ub: { user_key: @manager[:user_key], date: @manager[:date] }}
+ ).body
+
parsed_response = parser.parse((response[:get_status_user_data_response][:get_status_user_data_return]))
@manager[:login] == parsed_response["USUARIO"]["LOGIN"]
rescue
@@ -21,13 +29,17 @@ class ManagerAuthenticator
end
def application_authorized?
- response = client.call(:get_applications_user_list, message: { ub: { user_key: @manager[:user_key] }}).body
+ response = client.call(
+ :get_applications_user_list,
+ message: { ub: { user_key: @manager[:user_key] }}
+ ).body
+
user_list_return = response[:get_applications_user_list_response][:get_applications_user_list_return]
parsed_response = parser.parse(user_list_return)
-
aplication_value = parsed_response["APLICACIONES"]["APLICACION"]
# aplication_value from UWEB can be an array of hashes or a hash
- aplication_value.include?("CLAVE_APLICACION" => application_key) || aplication_value["CLAVE_APLICACION"] == application_key
+ aplication_value.include?("CLAVE_APLICACION" => application_key) ||
+ aplication_value["CLAVE_APLICACION"] == application_key
rescue
false
end
diff --git a/spec/components/account/permissions_list_component_spec.rb b/spec/components/account/permissions_list_component_spec.rb
index c8d30f5a7..30b047919 100644
--- a/spec/components/account/permissions_list_component_spec.rb
+++ b/spec/components/account/permissions_list_component_spec.rb
@@ -11,7 +11,8 @@ describe Account::PermissionsListComponent do
it "adds a hint when an action cannot be performed" do
render_inline Account::PermissionsListComponent.new(User.new)
- expect(page).to have_css "li", exact_text: "Additional verification needed Support proposals", normalize_ws: true
+ expect(page).to have_css "li", exact_text: "Additional verification needed Support proposals",
+ normalize_ws: true
expect(page).to have_css "li", exact_text: "Participate in debates", normalize_ws: true
end
end
diff --git a/spec/components/admin/budget_headings/form_component_spec.rb b/spec/components/admin/budget_headings/form_component_spec.rb
index 11ade0905..8a032b9c7 100644
--- a/spec/components/admin/budget_headings/form_component_spec.rb
+++ b/spec/components/admin/budget_headings/form_component_spec.rb
@@ -26,7 +26,8 @@ describe Admin::BudgetHeadings::FormComponent do
render_inline component
- expect(page).to have_select "Scope of operation", options: ["All city", "Under the sea", "Above the skies"]
+ expect(page).to have_select "Scope of operation",
+ options: ["All city", "Under the sea", "Above the skies"]
end
end
end
diff --git a/spec/components/admin/geozones/index_component_spec.rb b/spec/components/admin/geozones/index_component_spec.rb
index dc5b7e1e9..75c32f529 100644
--- a/spec/components/admin/geozones/index_component_spec.rb
+++ b/spec/components/admin/geozones/index_component_spec.rb
@@ -6,7 +6,9 @@ describe Admin::Geozones::IndexComponent, :admin do
geozones = [
create(:geozone, :with_geojson, name: "GeoJSON", external_code: "1", census_code: "2"),
create(:geozone, :with_html_coordinates, name: "HTML", external_code: "3", census_code: "4"),
- create(:geozone, :with_geojson, :with_html_coordinates, name: "With both", external_code: "6", census_code: "7"),
+ create(:geozone, :with_geojson, :with_html_coordinates, name: "With both",
+ external_code: "6",
+ census_code: "7"),
create(:geozone, name: "With none", external_code: "8", census_code: "9")
]
diff --git a/spec/components/admin/site_customization/pages/index_component_spec.rb b/spec/components/admin/site_customization/pages/index_component_spec.rb
index 1792e52cb..157d2bc8b 100644
--- a/spec/components/admin/site_customization/pages/index_component_spec.rb
+++ b/spec/components/admin/site_customization/pages/index_component_spec.rb
@@ -1,6 +1,7 @@
require "rails_helper"
-describe Admin::SiteCustomization::Pages::IndexComponent, controller: Admin::SiteCustomization::PagesController do
+describe Admin::SiteCustomization::Pages::IndexComponent,
+ controller: Admin::SiteCustomization::PagesController do
before { SiteCustomization::Page.delete_all }
it "shows date in created_at and updated_at fields" do
diff --git a/spec/components/budgets/budget_component_spec.rb b/spec/components/budgets/budget_component_spec.rb
index 0119c9330..7567b03e5 100644
--- a/spec/components/budgets/budget_component_spec.rb
+++ b/spec/components/budgets/budget_component_spec.rb
@@ -32,7 +32,8 @@ describe Budgets::BudgetComponent do
render_inline Budgets::BudgetComponent.new(budget)
page.find(".budget-header") do |header|
- expect(header).to have_link "Participate now!", href: "https://consuldemocracy.org", class: "main-link"
+ expect(header).to have_link "Participate now!", href: "https://consuldemocracy.org",
+ class: "main-link"
end
end
end
diff --git a/spec/components/sdg/related_list_selector_component_spec.rb b/spec/components/sdg/related_list_selector_component_spec.rb
index de5cd772b..b0b78af68 100644
--- a/spec/components/sdg/related_list_selector_component_spec.rb
+++ b/spec/components/sdg/related_list_selector_component_spec.rb
@@ -68,7 +68,8 @@ describe SDG::RelatedListSelectorComponent do
expect(page.find_field("Goals and Targets")["data-suggestions-list"]).to eq([{
tag: "1.1. Eradicate Extreme Poverty",
display_text: "1.1",
- title: "By 2030, eradicate extreme poverty for all people everywhere, currently measured as people living on less than $1.25 a day",
+ title: "By 2030, eradicate extreme poverty for all people everywhere, " \
+ "currently measured as people living on less than $1.25 a day",
value: "1.1"
}].to_json)
end
diff --git a/spec/controllers/documents_controller_spec.rb b/spec/controllers/documents_controller_spec.rb
index 9b0977034..2fc0638cc 100644
--- a/spec/controllers/documents_controller_spec.rb
+++ b/spec/controllers/documents_controller_spec.rb
@@ -10,7 +10,8 @@ describe DocumentsController do
document = create(:document, documentable: current_answer)
delete :destroy, params: { id: document }
- expect(flash[:alert]).to eq "You do not have permission to carry out the action 'destroy' on Document."
+ expect(flash[:alert]).to eq "You do not have permission to " \
+ "carry out the action 'destroy' on Document."
expect(Document.count).to eq 1
end
diff --git a/spec/controllers/moderation/users_controller_spec.rb b/spec/controllers/moderation/users_controller_spec.rb
index a1e9fcea2..97bc1b172 100644
--- a/spec/controllers/moderation/users_controller_spec.rb
+++ b/spec/controllers/moderation/users_controller_spec.rb
@@ -30,7 +30,8 @@ describe Moderation::UsersController do
put :block, params: { id: user }
expect(response).to redirect_to proposals_path
- expect(flash[:notice]).to eq "The user has been blocked. All contents authored by this user have been hidden."
+ expect(flash[:notice]).to eq "The user has been blocked. " \
+ "All contents authored by this user have been hidden."
end
it "redirects to the index with a nested resource" do
diff --git a/spec/factories/administration.rb b/spec/factories/administration.rb
index 780bd1e16..a8da8a3ed 100644
--- a/spec/factories/administration.rb
+++ b/spec/factories/administration.rb
@@ -19,7 +19,9 @@ FactoryBot.define do
end
trait :with_geojson do
- geojson { '{ "geometry": { "type": "Polygon", "coordinates": [[-0.117,51.513],[-0.118,51.512],[-0.119,51.514]] } }' }
+ geojson do
+ '{ "geometry": { "type": "Polygon", "coordinates": [[0.117,51.513],[0.118,51.512],[0.119,51.514]] } }'
+ end
end
end
diff --git a/spec/helpers/signature_sheets_helper_spec.rb b/spec/helpers/signature_sheets_helper_spec.rb
index e9b6a2953..6f93a3d4d 100644
--- a/spec/helpers/signature_sheets_helper_spec.rb
+++ b/spec/helpers/signature_sheets_helper_spec.rb
@@ -14,7 +14,8 @@ describe SignatureSheetsHelper do
Setting["remote_census.request.postal_code"] = nil
text_help_1 = "To verify a user, your application needs: Document number"
- text_help_2 = "Required fields for each user must be separated by commas and each user must be separated by semicolons."
+ text_help_2 = "Required fields for each user must be separated by commas " \
+ "and each user must be separated by semicolons."
text_example = "Example: 12345678Z; 87654321Y"
expect(required_fields_to_verify_text_help).to include(text_help_1)
@@ -25,8 +26,10 @@ describe SignatureSheetsHelper do
it "returns text help when date_of_birth is required" do
Setting["remote_census.request.postal_code"] = nil
- text_help_1 = "To verify a user, your application needs: Document number, Day of birth (dd/mm/yyyy)"
- text_help_2 = "Required fields for each user must be separated by commas and each user must be separated by semicolons."
+ text_help_1 = "To verify a user, your application needs: " \
+ "Document number, Day of birth (dd/mm/yyyy)"
+ text_help_2 = "Required fields for each user must be separated by commas " \
+ "and each user must be separated by semicolons."
text_example = "Example: 12345678Z, 01/01/1980; 87654321Y, 01/02/1990"
expect(required_fields_to_verify_text_help).to include(text_help_1)
@@ -37,8 +40,10 @@ describe SignatureSheetsHelper do
it "returns text help when postal_code is required" do
Setting["remote_census.request.date_of_birth"] = nil
- text_help_1 = "To verify a user, your application needs: Document number and Postal Code"
- text_help_2 = "Required fields for each user must be separated by commas and each user must be separated by semicolons."
+ text_help_1 = "To verify a user, your application needs: " \
+ "Document number and Postal Code"
+ text_help_2 = "Required fields for each user must be separated by commas " \
+ "and each user must be separated by semicolons."
text_example = "Example: 12345678Z, 28001; 87654321Y, 28002"
expect(required_fields_to_verify_text_help).to include(text_help_1)
@@ -47,8 +52,10 @@ describe SignatureSheetsHelper do
end
it "returns text help when date_of_birth and postal_code are required" do
- text_help_1 = "To verify a user, your application needs: Document number, Day of birth (dd/mm/yyyy) and Postal Code"
- text_help_2 = "Required fields for each user must be separated by commas and each user must be separated by semicolons."
+ text_help_1 = "To verify a user, your application needs: " \
+ "Document number, Day of birth (dd/mm/yyyy) and Postal Code"
+ text_help_2 = "Required fields for each user must be separated by commas " \
+ "and each user must be separated by semicolons."
text_example = "Example: 12345678Z, 01/01/1980, 28001; 87654321Y, 01/02/1990, 28002"
expect(required_fields_to_verify_text_help).to include(text_help_1)
diff --git a/spec/helpers/users_helper_spec.rb b/spec/helpers/users_helper_spec.rb
index 0a032fb73..e48ff015b 100644
--- a/spec/helpers/users_helper_spec.rb
+++ b/spec/helpers/users_helper_spec.rb
@@ -16,8 +16,10 @@ describe UsersHelper do
debate.hide
- expect(comment_commentable_title(comment)).to eq("" + comment.commentable.title +
- ' (This debate has been deleted)')
+ expect(comment_commentable_title(comment)).to eq "#{comment.commentable.title} " \
+ '' \
+ "(This debate has been deleted)" \
+ ""
end
it "returns the appropriate message for deleted proposals" do
@@ -26,8 +28,10 @@ describe UsersHelper do
proposal.hide
- expect(comment_commentable_title(comment)).to eq("" + comment.commentable.title +
- ' (This proposal has been deleted)')
+ expect(comment_commentable_title(comment)).to eq "#{comment.commentable.title} " \
+ '' \
+ "(This proposal has been deleted)" \
+ ""
end
it "returns the appropriate message for deleted budget investment" do
@@ -36,8 +40,10 @@ describe UsersHelper do
investment.hide
- expect(comment_commentable_title(comment)).to eq("" + comment.commentable.title +
- ' (This investment project has been deleted)')
+ expect(comment_commentable_title(comment)).to eq "#{comment.commentable.title} " \
+ '' \
+ "(This investment project has been deleted)" \
+ ""
end
end
@@ -50,8 +56,10 @@ describe UsersHelper do
it "returns a hint if the commentable has been deleted" do
comment = create(:comment)
comment.commentable.hide
- expect(comment_commentable_title(comment)).to eq("" + comment.commentable.title +
- ' (This debate has been deleted)')
+ expect(comment_commentable_title(comment)).to eq "#{comment.commentable.title} " \
+ '' \
+ "(This debate has been deleted)" \
+ ""
end
end
end
diff --git a/spec/i18n_spec.rb b/spec/i18n_spec.rb
index 41bc9fc28..2f27703d4 100644
--- a/spec/i18n_spec.rb
+++ b/spec/i18n_spec.rb
@@ -7,13 +7,13 @@ describe "I18n" do
let(:unused_keys) { i18n.unused_keys }
it "does not have missing keys" do
- expect(missing_keys).to be_empty,
- "Missing #{missing_keys.leaves.count} i18n keys, run `i18n-tasks missing' to show them"
+ expect(missing_keys).to be_empty, "Missing #{missing_keys.leaves.count} i18n keys, " \
+ "run `i18n-tasks missing' to show them"
end
it "does not have unused keys" do
- expect(unused_keys).to be_empty,
- "#{unused_keys.leaves.count} unused i18n keys, run `i18n-tasks unused' to show them"
+ expect(unused_keys).to be_empty, "#{unused_keys.leaves.count} unused i18n keys, " \
+ "run `i18n-tasks unused' to show them"
end
context "Plurals" do
diff --git a/spec/lib/document_parser_spec.rb b/spec/lib/document_parser_spec.rb
index 476f3e2ee..6162bc9e7 100644
--- a/spec/lib/document_parser_spec.rb
+++ b/spec/lib/document_parser_spec.rb
@@ -21,12 +21,16 @@ describe DocumentParser do
end
it "tries all the dni variants padding with zeroes" do
- expect(DocumentParser.get_document_number_variants(1, "0123456")).to eq(["123456", "0123456", "00123456"])
- expect(DocumentParser.get_document_number_variants(1, "00123456")).to eq(["123456", "0123456", "00123456"])
+ expect(DocumentParser.get_document_number_variants(1, "0123456"))
+ .to eq(["123456", "0123456", "00123456"])
+
+ expect(DocumentParser.get_document_number_variants(1, "00123456"))
+ .to eq(["123456", "0123456", "00123456"])
end
it "adds upper and lowercase letter when the letter is present" do
- expect(DocumentParser.get_document_number_variants(1, "1234567A")).to eq(%w[1234567 01234567 1234567a 1234567A 01234567a 01234567A])
+ expect(DocumentParser.get_document_number_variants(1, "1234567A"))
+ .to eq(%w[1234567 01234567 1234567a 1234567A 01234567a 01234567A])
end
end
end
diff --git a/spec/lib/graphql_spec.rb b/spec/lib/graphql_spec.rb
index b0b33a638..459547f16 100644
--- a/spec/lib/graphql_spec.rb
+++ b/spec/lib/graphql_spec.rb
@@ -185,7 +185,8 @@ describe "Consul Schema" do
it "returns nested votes for a proposal" do
proposal = create(:proposal, voters: [create(:user), create(:user)])
- response = execute("{ proposal(id: #{proposal.id}) { votes_for { edges { node { public_created_at } } } } }")
+ response = execute("{ proposal(id: #{proposal.id}) " \
+ "{ votes_for { edges { node { public_created_at } } } } }")
votes = response["data"]["proposal"]["votes_for"]["edges"]
expect(votes.count).to eq(2)
diff --git a/spec/lib/manager_authenticator_spec.rb b/spec/lib/manager_authenticator_spec.rb
index 13ec6a352..0c456d0dd 100644
--- a/spec/lib/manager_authenticator_spec.rb
+++ b/spec/lib/manager_authenticator_spec.rb
@@ -1,21 +1,38 @@
require "rails_helper"
describe ManagerAuthenticator do
- let(:authenticator) { ManagerAuthenticator.new(login: "JJB033", clave_usuario: "31415926", fecha_conexion: "20151031135905") }
+ let(:authenticator) do
+ ManagerAuthenticator.new(login: "JJB033", clave_usuario: "31415926", fecha_conexion: "20151031135905")
+ end
describe "initialization params" do
it "causes auth to return false if blank login" do
- blank_login_authenticator = ManagerAuthenticator.new(login: "", clave_usuario: "31415926", fecha_conexion: "20151031135905")
+ blank_login_authenticator = ManagerAuthenticator.new(
+ login: "",
+ clave_usuario: "31415926",
+ fecha_conexion: "20151031135905"
+ )
+
expect(blank_login_authenticator.auth).to be false
end
it "causes auth to return false if blank user_key" do
- blank_user_key_authenticator = ManagerAuthenticator.new(login: "JJB033", clave_usuario: "", fecha_conexion: "20151031135905")
+ blank_user_key_authenticator = ManagerAuthenticator.new(
+ login: "JJB033",
+ clave_usuario: "",
+ fecha_conexion: "20151031135905"
+ )
+
expect(blank_user_key_authenticator.auth).to be false
end
it "causes auth to return false if blank date" do
- blank_date_authenticator = ManagerAuthenticator.new(login: "JJB033", clave_usuario: "31415926", fecha_conexion: "")
+ blank_date_authenticator = ManagerAuthenticator.new(
+ login: "JJB033",
+ clave_usuario: "31415926",
+ fecha_conexion: ""
+ )
+
expect(blank_date_authenticator.auth).to be false
end
end
@@ -53,7 +70,8 @@ describe ManagerAuthenticator do
it "calls the permissions check method" do
allow(authenticator).to receive(:manager_exists?).and_return(true)
- allow(authenticator.send(:client)).to receive(:call).with(:get_applications_user_list, message: { ub: { user_key: "31415926" }})
+ allow(authenticator.send(:client)).to receive(:call).with(:get_applications_user_list,
+ message: { ub: { user_key: "31415926" }})
authenticator.auth
end
end
diff --git a/spec/lib/remote_translations/microsoft/client_spec.rb b/spec/lib/remote_translations/microsoft/client_spec.rb
index 3a796f476..4fcbbccfe 100644
--- a/spec/lib/remote_translations/microsoft/client_spec.rb
+++ b/spec/lib/remote_translations/microsoft/client_spec.rb
@@ -80,14 +80,16 @@ describe RemoteTranslations::Microsoft::Client do
response_another_start_text = [another_start_translated_text_es]
response_another_end_text = [another_end_translated_text_es]
- expect_any_instance_of(BingTranslator).to receive(:translate_array).with([start_another_text_en], to: :es)
- .exactly(1)
- .times
- .and_return(response_another_start_text)
- expect_any_instance_of(BingTranslator).to receive(:translate_array).with([end_another_text_en], to: :es)
- .exactly(1)
- .times
- .and_return(response_another_end_text)
+ expect_any_instance_of(BingTranslator).to(receive(:translate_array)
+ .with([start_another_text_en], to: :es)
+ .exactly(1)
+ .times
+ .and_return(response_another_start_text))
+ expect_any_instance_of(BingTranslator).to(receive(:translate_array)
+ .with([end_another_text_en], to: :es)
+ .exactly(1)
+ .times
+ .and_return(response_another_end_text))
result = client.call([text_en, another_text_en], :es)
diff --git a/spec/models/abilities/administrator_spec.rb b/spec/models/abilities/administrator_spec.rb
index 956fed48c..39a42dbd6 100644
--- a/spec/models/abilities/administrator_spec.rb
+++ b/spec/models/abilities/administrator_spec.rb
@@ -95,7 +95,11 @@ describe Abilities::Administrator do
it { should be_able_to(:read_results, create(:budget, :reviewing_ballots, :with_winner)) }
it { should be_able_to(:read_results, create(:budget, :finished, :with_winner)) }
it { should be_able_to(:read_results, create(:budget, :finished, results_enabled: true)) }
- it { should_not be_able_to(:read_results, create(:budget, :balloting, :with_winner, results_enabled: true)) }
+
+ it do
+ should_not be_able_to(:read_results, create(:budget, :balloting, :with_winner, results_enabled: true))
+ end
+
it { should_not be_able_to(:read_results, create(:budget, :reviewing_ballots, results_enabled: true)) }
it { should_not be_able_to(:read_results, create(:budget, :finished, results_enabled: false)) }
diff --git a/spec/models/abilities/common_spec.rb b/spec/models/abilities/common_spec.rb
index 92fab9aba..6c3918ec8 100644
--- a/spec/models/abilities/common_spec.rb
+++ b/spec/models/abilities/common_spec.rb
@@ -25,10 +25,18 @@ describe Abilities::Common do
let(:investment_in_reviewing_budget) { create(:budget_investment, budget: reviewing_budget) }
let(:investment_in_selecting_budget) { create(:budget_investment, budget: selecting_budget) }
let(:investment_in_balloting_budget) { create(:budget_investment, budget: balloting_budget) }
- let(:own_investment_in_accepting_budget) { create(:budget_investment, budget: accepting_budget, author: user) }
- let(:own_investment_in_reviewing_budget) { create(:budget_investment, budget: reviewing_budget, author: user) }
- let(:own_investment_in_selecting_budget) { create(:budget_investment, budget: selecting_budget, author: user) }
- let(:own_investment_in_balloting_budget) { create(:budget_investment, budget: balloting_budget, author: user) }
+ let(:own_investment_in_accepting_budget) do
+ create(:budget_investment, budget: accepting_budget, author: user)
+ end
+ let(:own_investment_in_reviewing_budget) do
+ create(:budget_investment, budget: reviewing_budget, author: user)
+ end
+ let(:own_investment_in_selecting_budget) do
+ create(:budget_investment, budget: selecting_budget, author: user)
+ end
+ let(:own_investment_in_balloting_budget) do
+ create(:budget_investment, budget: balloting_budget, author: user)
+ end
let(:ballot_in_accepting_budget) { create(:budget_ballot, budget: accepting_budget) }
let(:ballot_in_selecting_budget) { create(:budget_ballot, budget: selecting_budget) }
let(:ballot_in_balloting_budget) { create(:budget_ballot, budget: balloting_budget) }
@@ -45,9 +53,13 @@ describe Abilities::Common do
let(:poll_question_from_other_geozone) { create(:poll_question, poll: poll_from_other_geozone) }
let(:poll_question_from_all_geozones) { create(:poll_question, poll: poll) }
- let(:expired_poll_question_from_own_geozone) { create(:poll_question, poll: expired_poll_from_own_geozone) }
- let(:expired_poll_question_from_other_geozone) { create(:poll_question, poll: expired_poll_from_other_geozone) }
- let(:expired_poll_question_from_all_geozones) { create(:poll_question, poll: expired_poll) }
+ let(:expired_poll_question_from_own_geozone) do
+ create(:poll_question, poll: expired_poll_from_own_geozone)
+ end
+ let(:expired_poll_question_from_other_geozone) do
+ create(:poll_question, poll: expired_poll_from_other_geozone)
+ end
+ let(:expired_poll_question_from_all_geozones) { create(:poll_question, poll: expired_poll) }
let(:own_proposal_document) { build(:document, documentable: own_proposal) }
let(:proposal_document) { build(:document, documentable: proposal) }
diff --git a/spec/models/abilities/valuator_spec.rb b/spec/models/abilities/valuator_spec.rb
index 328c1cb48..87b52f472 100644
--- a/spec/models/abilities/valuator_spec.rb
+++ b/spec/models/abilities/valuator_spec.rb
@@ -8,9 +8,15 @@ describe Abilities::Valuator do
let(:group) { create(:valuator_group) }
let(:valuator) { create(:valuator, valuator_group: group, can_edit_dossier: true, can_comment: true) }
let(:non_assigned_investment) { create(:budget_investment) }
- let(:assigned_investment) { create(:budget_investment, budget: create(:budget, :valuating), valuators: [valuator]) }
- let(:group_assigned_investment) { create(:budget_investment, budget: create(:budget, :valuating), valuator_groups: [group]) }
- let(:finished_assigned_investment) { create(:budget_investment, budget: create(:budget, :finished), valuators: [valuator]) }
+ let(:assigned_investment) do
+ create(:budget_investment, budget: create(:budget, :valuating), valuators: [valuator])
+ end
+ let(:group_assigned_investment) do
+ create(:budget_investment, budget: create(:budget, :valuating), valuator_groups: [group])
+ end
+ let(:finished_assigned_investment) do
+ create(:budget_investment, budget: create(:budget, :finished), valuators: [valuator])
+ end
it "cannot valuate an assigned investment with a finished valuation" do
assigned_investment.update!(valuation_finished: true)
diff --git a/spec/models/ahoy/data_source_spec.rb b/spec/models/ahoy/data_source_spec.rb
index 4da39bba7..b72f3d728 100644
--- a/spec/models/ahoy/data_source_spec.rb
+++ b/spec/models/ahoy/data_source_spec.rb
@@ -30,7 +30,9 @@ describe Ahoy::DataSource do
ds = Ahoy::DataSource.new
ds.add "foo", Ahoy::Event.where(name: "foo").group_by_day(:time).count
ds.add "bar", Ahoy::Event.where(name: "bar").group_by_day(:time).count
- expect(ds.build).to eq :x => ["2015-01-01", "2015-01-02", "2015-01-03"], "foo" => [2, 1, 0], "bar" => [1, 0, 2]
+ expect(ds.build).to eq :x => ["2015-01-01", "2015-01-02", "2015-01-03"],
+ "foo" => [2, 1, 0],
+ "bar" => [1, 0, 2]
end
end
end
diff --git a/spec/models/budget/investment_spec.rb b/spec/models/budget/investment_spec.rb
index d0a754158..04ee16775 100644
--- a/spec/models/budget/investment_spec.rb
+++ b/spec/models/budget/investment_spec.rb
@@ -714,7 +714,8 @@ describe Budget::Investment do
unselected_undecided_investment = create(:budget_investment, :unselected, :undecided)
unselected_feasible_investment = create(:budget_investment, :unselected, :feasible)
- expect(Budget::Investment.unselected).to match_array [unselected_undecided_investment, unselected_feasible_investment]
+ expect(Budget::Investment.unselected).to match_array [unselected_undecided_investment,
+ unselected_feasible_investment]
end
it "does not return selected investments" do
@@ -732,8 +733,17 @@ describe Budget::Investment do
describe "sort_by_title" do
it "sorts using the title in the current locale" do
- create(:budget_investment, title_en: "CCCC", title_es: "BBBB", description_en: "CCCC", description_es: "BBBB")
- create(:budget_investment, title_en: "DDDD", title_es: "AAAA", description_en: "DDDD", description_es: "AAAA")
+ create(:budget_investment,
+ title_en: "CCCC",
+ title_es: "BBBB",
+ description_en: "CCCC",
+ description_es: "BBBB")
+
+ create(:budget_investment,
+ title_en: "DDDD",
+ title_es: "AAAA",
+ description_en: "DDDD",
+ description_es: "AAAA")
expect(Budget::Investment.sort_by_title.map(&:title)).to eq %w[CCCC DDDD]
end
diff --git a/spec/models/budget/result_spec.rb b/spec/models/budget/result_spec.rb
index 37b54729d..282f33ffa 100644
--- a/spec/models/budget/result_spec.rb
+++ b/spec/models/budget/result_spec.rb
@@ -44,7 +44,9 @@ describe Budget::Result do
it "removes winners and recalculates" do
create(:budget_investment, :selected, heading: heading, price: 200, ballot_lines_count: 90)
create(:budget_investment, :winner, heading: heading, price: 300, ballot_lines_count: 80)
- create(:budget_investment, :winner, :incompatible, heading: heading, price: 500, ballot_lines_count: 70)
+ create(:budget_investment, :winner, :incompatible, heading: heading,
+ price: 500,
+ ballot_lines_count: 70)
create(:budget_investment, :winner, heading: heading, price: 500, ballot_lines_count: 60)
create(:budget_investment, :winner, heading: heading, price: 100, ballot_lines_count: 50)
diff --git a/spec/models/budget/stats_spec.rb b/spec/models/budget/stats_spec.rb
index 476969876..e24e42f0d 100644
--- a/spec/models/budget/stats_spec.rb
+++ b/spec/models/budget/stats_spec.rb
@@ -76,8 +76,9 @@ describe Budget::Stats do
end
it "doesn't count nil user ids" do
- create(:budget_ballot_line, investment: investment,
- ballot: create(:budget_ballot, budget: budget.reload, user: nil, physical: true))
+ create(:budget_ballot_line,
+ investment: investment,
+ ballot: create(:budget_ballot, budget: budget.reload, user: nil, physical: true))
expect(stats.total_participants_vote_phase).to be 0
end
diff --git a/spec/models/debate_spec.rb b/spec/models/debate_spec.rb
index 85e7a214a..0f086cc05 100644
--- a/spec/models/debate_spec.rb
+++ b/spec/models/debate_spec.rb
@@ -62,12 +62,14 @@ describe Debate do
describe "#tag_list" do
it "is not valid with a tag list of more than 6 elements" do
- debate.tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa", "Huelgas"]
+ debate.tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción",
+ "Fiestas populares", "Prensa", "Huelgas"]
expect(debate).not_to be_valid
end
it "is valid with a tag list of 6 elements" do
- debate.tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa"]
+ debate.tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción",
+ "Fiestas populares", "Prensa"]
expect(debate).to be_valid
end
end
@@ -314,7 +316,9 @@ describe Debate do
describe "#confidence_score" do
it "takes into account percentage of total votes and total_positive and total negative votes" do
- debate = create(:debate, :with_confidence_score, cached_votes_up: 100, cached_votes_score: 100, cached_votes_total: 100)
+ debate = create(:debate, :with_confidence_score, cached_votes_up: 100,
+ cached_votes_score: 100,
+ cached_votes_total: 100)
expect(debate.confidence_score).to eq(10000)
debate = create(:debate, :with_confidence_score, cached_votes_up: 0, cached_votes_total: 100)
diff --git a/spec/models/direct_upload_spec.rb b/spec/models/direct_upload_spec.rb
index ec342f0de..ce9b0f22f 100644
--- a/spec/models/direct_upload_spec.rb
+++ b/spec/models/direct_upload_spec.rb
@@ -10,10 +10,25 @@ describe DirectUpload do
end
it "is not valid for different kind of combinations with invalid atttachment content types" do
- expect(build(:direct_upload, :proposal, :documents, attachment: fixture_file_upload("clippy.png"))).not_to be_valid
- expect(build(:direct_upload, :proposal, :image, attachment: fixture_file_upload("empty.pdf"))).not_to be_valid
- expect(build(:direct_upload, :budget_investment, :documents, attachment: fixture_file_upload("clippy.png"))).not_to be_valid
- expect(build(:direct_upload, :budget_investment, :image, attachment: fixture_file_upload("empty.pdf"))).not_to be_valid
+ expect(build(:direct_upload,
+ :proposal,
+ :documents,
+ attachment: fixture_file_upload("clippy.png"))).not_to be_valid
+
+ expect(build(:direct_upload,
+ :proposal,
+ :image,
+ attachment: fixture_file_upload("empty.pdf"))).not_to be_valid
+
+ expect(build(:direct_upload,
+ :budget_investment,
+ :documents,
+ attachment: fixture_file_upload("clippy.png"))).not_to be_valid
+
+ expect(build(:direct_upload,
+ :budget_investment,
+ :image,
+ attachment: fixture_file_upload("empty.pdf"))).not_to be_valid
end
it "is not valid without resource_type" do
diff --git a/spec/models/legislation/annotation_spec.rb b/spec/models/legislation/annotation_spec.rb
index f0ac81a2e..a3e239521 100644
--- a/spec/models/legislation/annotation_spec.rb
+++ b/spec/models/legislation/annotation_spec.rb
@@ -10,16 +10,19 @@ RSpec.describe Legislation::Annotation, type: :model do
end
it "calculates the context for multinode annotations" do
- quote = "ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam" \
- " erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex" \
- " ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum" \
- " dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril" \
- " delenit augue duis dolore te feugait nulla facilisi." \
- "\n\n" \
- "Expetenda tincidunt in sed, ex partem placerat sea, porro commodo ex eam. His putant aeterno interesset at. Usu ea mundi" \
- " tincidunt, omnium virtute aliquando ius ex. Ea aperiri sententiae duo. Usu nullam dolorum quaestio ei, sit vidit facilisis" \
- " ea. Per ne impedit iracundia neglegentur. Consetetur neglegentur eum ut, vis animal legimus inimicus id." \
- "\n\n" \
+ quote = "ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh " \
+ "euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi " \
+ "enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit " \
+ "lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum " \
+ "iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel " \
+ "illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto " \
+ "odio dignissim qui blandit praesent luptatum zzril delenit augue duis " \
+ "dolore te feugait nulla facilisi.\n\n" \
+ "Expetenda tincidunt in sed, ex partem placerat sea, porro commodo ex eam. " \
+ "His putant aeterno interesset at. Usu ea mundi tincidunt, omnium virtute " \
+ "aliquando ius ex. Ea aperiri sententiae duo. Usu nullam dolorum quaestio " \
+ "ei, sit vidit facilisis ea. Per ne impedit iracundia neglegentur. " \
+ "Consetetur neglegentur eum ut, vis animal legimus inimicus id.\n\n" \
"His audiam"
annotation = create(
:legislation_annotation,
@@ -28,25 +31,37 @@ RSpec.describe Legislation::Annotation, type: :model do
ranges: [{ "start" => "/p[1]", "startOffset" => 6, "end" => "/p[3]", "endOffset" => 11 }]
)
- context = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt" \
- " ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper" \
- " suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit" \
- " esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui" \
- " blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.\n\nExpetenda tincidunt in sed, ex" \
- " partem placerat sea, porro commodo ex eam. His putant aeterno interesset at. Usu ea mundi tincidunt, omnium virtute" \
- " aliquando ius ex. Ea aperiri sententiae duo. Usu nullam dolorum quaestio ei, sit vidit facilisis ea. Per ne impedit" \
- " iracundia neglegentur. Consetetur neglegentur eum ut, vis animal legimus inimicus id.\n\nHis audiamdeserunt in, eum" \
- " ubique voluptatibus te. In reque dicta usu. Ne rebum dissentiet eam, vim omnis deseruisse id. Ullum deleniti vituperata at" \
- " quo, insolens complectitur te eos, ea pri dico munere propriae. Vel ferri facilis ut, qui paulo ridens praesent ad. Possim" \
- " alterum qui cu. Accusamus consulatu ius te, cu decore soleat appareat usu."
+ context = "Lorem " \
+ "ipsum dolor sit amet, consectetuer adipiscing " \
+ "elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna " \
+ "aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci " \
+ "tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo " \
+ "consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate " \
+ "velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis " \
+ "at vero eros et accumsan et iusto odio dignissim qui blandit praesent " \
+ "luptatum zzril delenit augue duis dolore te feugait nulla facilisi.\n\n" \
+ "Expetenda tincidunt in sed, ex partem placerat sea, porro commodo ex " \
+ "eam. His putant aeterno interesset at. Usu ea mundi tincidunt, omnium " \
+ "virtute aliquando ius ex. Ea aperiri sententiae duo. Usu nullam dolorum " \
+ "quaestio ei, sit vidit facilisis ea. Per ne impedit iracundia neglegentur. " \
+ "Consetetur neglegentur eum ut, vis animal legimus inimicus id.\n\n" \
+ "His audiam" \
+ "deserunt in, eum ubique voluptatibus te. In reque dicta usu. Ne " \
+ "rebum dissentiet eam, vim omnis deseruisse id. Ullum deleniti vituperata " \
+ "at quo, insolens complectitur te eos, ea pri dico munere propriae. Vel " \
+ "ferri facilis ut, qui paulo ridens praesent ad. Possim alterum qui cu. " \
+ "Accusamus consulatu ius te, cu decore soleat appareat usu."
expect(annotation.context).to eq(context)
end
it "calculates the context for multinode annotations 2" do
- quote = "Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla" \
- " facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore" \
- " te feugait nulla facilisi.\r\n\r\nExpetenda tincidunt in sed, ex partem placerat sea, porro commodo ex eam. His putant" \
- " aeterno interesset at. Usu ea mundi tincidunt, omnium virtute aliquando ius ex. Ea aperiri sententiae duo"
+ quote = "Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse " \
+ "molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero " \
+ "eros et accumsan et iusto odio dignissim qui blandit praesent luptatum " \
+ "zzril delenit augue duis dolore te feugait nulla facilisi.\r\n\r\n" \
+ "Expetenda tincidunt in sed, ex partem placerat sea, porro commodo ex eam. " \
+ "His putant aeterno interesset at. Usu ea mundi tincidunt, omnium virtute " \
+ "aliquando ius ex. Ea aperiri sententiae duo"
annotation = create(
:legislation_annotation,
draft_version: draft_version,
@@ -54,45 +69,69 @@ RSpec.describe Legislation::Annotation, type: :model do
ranges: [{ "start" => "/p[1]", "startOffset" => 273, "end" => "/p[2]", "endOffset" => 190 }]
)
- context = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna" \
- " aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut" \
- " aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit" \
- " esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui" \
- " blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.\r\n\r\nExpetenda tincidunt in sed, ex" \
- " partem placerat sea, porro commodo ex eam. His putant aeterno interesset at. Usu ea mundi tincidunt, omnium virtute" \
- " aliquando ius ex. Ea aperiri sententiae duo. Usu nullam dolorum quaestio ei, sit vidit facilisis ea. Per ne impedit" \
- " iracundia neglegentur. Consetetur neglegentur eum ut, vis animal legimus inimicus id."
+ context = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam " \
+ "nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat " \
+ "volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation " \
+ "ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. " \
+ "Duis autem vel eum iriure dolor in hendrerit " \
+ "in vulputate velit esse molestie consequat, vel illum dolore eu feugiat " \
+ "nulla facilisis at vero eros et accumsan et iusto odio dignissim qui " \
+ "blandit praesent luptatum zzril delenit augue duis dolore te feugait " \
+ "nulla facilisi.\r\n\r\n" \
+ "Expetenda tincidunt in sed, ex partem placerat sea, porro commodo ex " \
+ "eam. His putant aeterno interesset at. Usu ea mundi tincidunt, omnium " \
+ "virtute aliquando ius ex. Ea aperiri sententiae duo" \
+ ". Usu nullam dolorum quaestio ei, sit vidit facilisis ea. Per " \
+ "ne impedit iracundia neglegentur. Consetetur neglegentur eum ut, vis " \
+ "animal legimus inimicus id."
+
expect(annotation.context).to eq(context)
end
it "calculates the context for multinode annotations 3" do
- body = "The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed" \
- " to ensure cooperation with the community in the case of network server software.\r\n\r\nThe licenses for most software and" \
- " other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public" \
- " Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free" \
- " software for all its users.\r\n\r\nWhen we speak of free software, we are referring to freedom, not price. Our General" \
- " Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for" \
- " them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces" \
- " of it in new free programs, and that you know you can do these things.\r\n\r\nDevelopers that use our General Public Licenses" \
- " protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you" \
- " legal permission to copy, distribute and/or modify the software.\r\n\r\nA secondary benefit of defending all users' freedom" \
- " is that improvements made in alternate versions of the program, if they receive widespread use, become available for other" \
- " developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation." \
- " However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License" \
- " permits making a modified version and letting the public access it on a server without ever releasing its source code to the" \
- " public.\r\n\r\nThe GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified" \
- " source code becomes available to the community. It requires the operator of a network server to provide the source code of" \
- " the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly" \
- " accessible server, gives the public access to the source code of the modified version.\r\n\r\nAn older license, called the" \
- " Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license," \
- " not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this" \
- " license."
+ body = "The GNU Affero General Public License is a free, copyleft license for " \
+ "software and other kinds of works, specifically designed to ensure " \
+ "cooperation with the community in the case of network server software.\r\n\r\n" \
+ "The licenses for most software and other practical works are designed to " \
+ "take away your freedom to share and change the works. By contrast, our " \
+ "General Public Licenses are intended to guarantee your freedom to share and " \
+ "change all versions of a program--to make sure it remains free software for " \
+ "all its users.\r\n\r\n" \
+ "When we speak of free software, we are referring to freedom, not price. " \
+ "Our General Public Licenses are designed to make sure that you have the " \
+ "freedom to distribute copies of free software (and charge for them if you wish), " \
+ "that you receive source code or can get it if you want it, that you can change " \
+ "the software or use pieces of it in new free programs, and that you know you " \
+ "can do these things.\r\n\r\n" \
+ "Developers that use our General Public Licenses protect your rights with two " \
+ "steps: (1) assert copyright on the software, and (2) offer you this License which " \
+ "gives you legal permission to copy, distribute and/or modify the software.\r\n\r\n" \
+ "A secondary benefit of defending all users' freedom is that improvements made in " \
+ "alternate versions of the program, if they receive widespread use, become " \
+ "available for other developers to incorporate. Many developers of free software " \
+ "are heartened and encouraged by the resulting cooperation. " \
+ "However, in the case of software used on network servers, this result may fail " \
+ "to come about. The GNU General Public License permits making a modified version " \
+ "and letting the public access it on a server without ever releasing its source " \
+ "code to the public.\r\n\r\n" \
+ "The GNU Affero General Public License is designed specifically to ensure that, " \
+ "in such cases, the modified source code becomes available to the community. " \
+ "It requires the operator of a network server to provide the source code of " \
+ "the modified version running there to the users of that server. Therefore, " \
+ "public use of a modified version, on a publicly accessible server, gives the " \
+ "public access to the source code of the modified version.\r\n\r\n" \
+ "An older license, called the Affero General Public License and published by " \
+ "Affero, was designed to accomplish similar goals. This is a different license, " \
+ "not a version of the Affero GPL, but Affero has released a new version of the " \
+ "Affero GPL which permits relicensing under this license."
draft_version = create(:legislation_draft_version, body: body)
- quote = "By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a" \
- " program--to make sure it remains free software for all its users.\r\n\r\nWhen we speak of free software, we are referring to" \
- " freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of" \
- " free software (and charge for them if you wish)"
+ quote = "By contrast, our General Public Licenses are intended to guarantee your " \
+ "freedom to share and change all versions of a program--to make sure it " \
+ "remains free software for all its users.\r\n\r\n" \
+ "When we speak of free software, we are referring to freedom, not price. " \
+ "Our General Public Licenses are designed to make sure that you have the " \
+ "freedom to distribute copies of free software (and charge for them if you wish)"
annotation = create(
:legislation_annotation,
@@ -101,13 +140,17 @@ RSpec.describe Legislation::Annotation, type: :model do
ranges: [{ "start" => "/p[2]", "startOffset" => 127, "end" => "/p[3]", "endOffset" => 223 }]
)
- context = "The licenses for most software and other practical works are designed to take away your freedom to share and change the" \
- " works. By contrast, our General Public Licenses are intended to guarantee your freedom to share" \
- " and change all versions of a program--to make sure it remains free software for all its users.\r\n\r\nWhen we speak of" \
- " free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have" \
- " the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code" \
- " or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know" \
- " you can do these things."
+ context = "The licenses for most software and other practical works are designed to " \
+ "take away your freedom to share and change the works. " \
+ "By contrast, our General Public Licenses are " \
+ "intended to guarantee your freedom to share and change all versions of " \
+ "a program--to make sure it remains free software for all its users.\r\n\r\n" \
+ "When we speak of free software, we are referring to freedom, not price. " \
+ "Our General Public Licenses are designed to make sure that you have the " \
+ "freedom to distribute copies of free software (and charge for them if you wish)" \
+ ", that you receive source code or can get it if you want it, that " \
+ "you can change the software or use pieces of it in new free programs, " \
+ "and that you know you can do these things."
expect(annotation.context).to eq(context)
end
diff --git a/spec/models/legislation/question_spec.rb b/spec/models/legislation/question_spec.rb
index 2168be88b..d710415ea 100644
--- a/spec/models/legislation/question_spec.rb
+++ b/spec/models/legislation/question_spec.rb
@@ -46,7 +46,9 @@ describe Legislation::Question do
describe "#next_question_id" do
let!(:question1) { create(:legislation_question) }
- let!(:question2) { create(:legislation_question, legislation_process_id: question1.legislation_process_id) }
+ let!(:question2) do
+ create(:legislation_question, legislation_process_id: question1.legislation_process_id)
+ end
it "returns the next question" do
expect(question1.next_question_id).to eq(question2.id)
@@ -59,7 +61,9 @@ describe Legislation::Question do
describe "#first_question_id" do
let!(:question1) { create(:legislation_question) }
- let!(:question2) { create(:legislation_question, legislation_process_id: question1.legislation_process_id) }
+ let!(:question2) do
+ create(:legislation_question, legislation_process_id: question1.legislation_process_id)
+ end
it "returns the first question" do
expect(question1.first_question_id).to eq(question1.id)
diff --git a/spec/models/officing/residence_spec.rb b/spec/models/officing/residence_spec.rb
index a9d842d85..d30113111 100644
--- a/spec/models/officing/residence_spec.rb
+++ b/spec/models/officing/residence_spec.rb
@@ -196,7 +196,11 @@ describe Officing::Residence do
end
it "makes half-verified users fully verified" do
- user = create(:user, residence_verified_at: Time.current, document_type: "1", document_number: "12345678Z")
+ user = create(:user,
+ residence_verified_at: Time.current,
+ document_type: "1",
+ document_number: "12345678Z")
+
expect(user).to be_unverified
residence = build(:officing_residence, document_number: "12345678Z", year_of_birth: 1980)
expect(residence).to be_valid
diff --git a/spec/models/poll/ballot_spec.rb b/spec/models/poll/ballot_spec.rb
index 1cebae0a2..81f8cc9f0 100644
--- a/spec/models/poll/ballot_spec.rb
+++ b/spec/models/poll/ballot_spec.rb
@@ -7,7 +7,9 @@ describe Poll::Ballot do
let(:investment) { create(:budget_investment, :selected, price: 5000000, heading: heading) }
let(:poll) { create(:poll, budget: budget) }
let(:poll_ballot_sheet) { create(:poll_ballot_sheet, poll: poll) }
- let(:poll_ballot) { create(:poll_ballot, ballot_sheet: poll_ballot_sheet, external_id: 1, data: investment.id) }
+ let(:poll_ballot) do
+ create(:poll_ballot, ballot_sheet: poll_ballot_sheet, external_id: 1, data: investment.id)
+ end
before { create(:budget_ballot, budget: budget, physical: true, poll_ballot: poll_ballot) }
describe "#verify" do
diff --git a/spec/models/poll/shift_spec.rb b/spec/models/poll/shift_spec.rb
index 599a1dd8f..be7d3f7d5 100644
--- a/spec/models/poll/shift_spec.rb
+++ b/spec/models/poll/shift_spec.rb
@@ -5,7 +5,9 @@ describe Poll::Shift do
let(:booth) { create(:poll_booth) }
let(:user) { create(:user, username: "Ana", email: "ana@example.com") }
let(:officer) { create(:poll_officer, user: user) }
- let(:recount_shift) { build(:poll_shift, booth: booth, officer: officer, date: Date.current, task: :recount_scrutiny) }
+ let(:recount_shift) do
+ build(:poll_shift, booth: booth, officer: officer, date: Date.current, task: :recount_scrutiny)
+ end
describe "validations" do
let(:shift) { build(:poll_shift) }
@@ -37,19 +39,28 @@ describe Poll::Shift do
it "is not valid with same booth, officer, date and task" do
recount_shift.save!
- expect(build(:poll_shift, booth: booth, officer: officer, date: Date.current, task: :recount_scrutiny)).not_to be_valid
+ expect(build(:poll_shift, booth: booth,
+ officer: officer,
+ date: Date.current,
+ task: :recount_scrutiny)).not_to be_valid
end
it "is valid with same booth, officer and date but different task" do
recount_shift.save!
- expect(build(:poll_shift, booth: booth, officer: officer, date: Date.current, task: :vote_collection)).to be_valid
+ expect(build(:poll_shift, booth: booth,
+ officer: officer,
+ date: Date.current,
+ task: :vote_collection)).to be_valid
end
it "is valid with same booth, officer and task but different date" do
recount_shift.save!
- expect(build(:poll_shift, booth: booth, officer: officer, date: Date.tomorrow, task: :recount_scrutiny)).to be_valid
+ expect(build(:poll_shift, booth: booth,
+ officer: officer,
+ date: Date.tomorrow,
+ task: :recount_scrutiny)).to be_valid
end
end
@@ -58,7 +69,9 @@ describe Poll::Shift do
booth_assignment1 = create(:poll_booth_assignment, booth: booth)
booth_assignment2 = create(:poll_booth_assignment, booth: booth)
- expect { create(:poll_shift, booth: booth, officer: officer, date: Date.current) }.to change { Poll::OfficerAssignment.all.count }.by(2)
+ expect do
+ create(:poll_shift, booth: booth, officer: officer, date: Date.current)
+ end.to change { Poll::OfficerAssignment.all.count }.by(2)
officer_assignments = Poll::OfficerAssignment.all
oa1 = officer_assignments.first
@@ -74,7 +87,9 @@ describe Poll::Shift do
expect(oa2.booth_assignment).to eq(booth_assignment2)
expect(oa2.final).to be_falsey
- create(:poll_officer_assignment, officer: officer, booth_assignment: booth_assignment1, date: Date.tomorrow)
+ create(:poll_officer_assignment, officer: officer,
+ booth_assignment: booth_assignment1,
+ date: Date.tomorrow)
expect { Poll::Shift.last.destroy }.to change { Poll::OfficerAssignment.all.count }.by(-2)
end
diff --git a/spec/models/proposal_spec.rb b/spec/models/proposal_spec.rb
index abb152549..90e5dc19b 100644
--- a/spec/models/proposal_spec.rb
+++ b/spec/models/proposal_spec.rb
@@ -110,12 +110,14 @@ describe Proposal do
describe "tag_list" do
it "is not valid with a tag list of more than 6 elements" do
- proposal.tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa", "Huelgas"]
+ proposal.tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción",
+ "Fiestas populares", "Prensa", "Huelgas"]
expect(proposal).not_to be_valid
end
it "is valid with a tag list of up to 6 elements" do
- proposal.tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa"]
+ proposal.tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción",
+ "Fiestas populares", "Prensa"]
expect(proposal).to be_valid
end
end
@@ -256,7 +258,9 @@ describe Proposal do
user = create(:user, verified_at: Time.current)
archived_proposal = create(:proposal, :archived)
- expect { archived_proposal.register_vote(user, "yes") }.to change { proposal.reload.votes_for.size }.by(0)
+ expect do
+ archived_proposal.register_vote(user, "yes")
+ end.to change { proposal.reload.votes_for.size }.by(0)
end
end
@@ -623,7 +627,8 @@ describe Proposal do
it "gives much more weight to word matches than votes" do
exact_title_few_votes = create(:proposal, title: "stop corruption", cached_votes_up: 5)
- similar_title_many_votes = create(:proposal, title: "stop some of the corruption", cached_votes_up: 500)
+ similar_title_many_votes = create(:proposal, title: "stop some of the corruption",
+ cached_votes_up: 500)
results = Proposal.search("stop corruption")
@@ -683,9 +688,9 @@ describe Proposal do
end
it "is able to reorder by most commented after searching" do
- least_commented = create(:proposal, title: "stop corruption", cached_votes_up: 1, comments_count: 1)
- most_commented = create(:proposal, title: "stop corruption", cached_votes_up: 2, comments_count: 100)
- some_comments = create(:proposal, title: "stop corruption", cached_votes_up: 3, comments_count: 10)
+ least_commented = create(:proposal, title: "stop corruption", cached_votes_up: 1, comments_count: 1)
+ most_commented = create(:proposal, title: "stop corruption", cached_votes_up: 2, comments_count: 100)
+ some_comments = create(:proposal, title: "stop corruption", cached_votes_up: 3, comments_count: 10)
results = Proposal.search("stop corruption")
diff --git a/spec/models/related_content_spec.rb b/spec/models/related_content_spec.rb
index af8851f0b..f5a9a7d85 100644
--- a/spec/models/related_content_spec.rb
+++ b/spec/models/related_content_spec.rb
@@ -10,9 +10,11 @@ describe RelatedContent do
end
it "allows relationables from various classes" do
- expect(build(:related_content, parent_relationable: parent_relationable, child_relationable: child_relationable)).to be_valid
- expect(build(:related_content, parent_relationable: parent_relationable, child_relationable: child_relationable)).to be_valid
- expect(build(:related_content, parent_relationable: parent_relationable, child_relationable: child_relationable)).to be_valid
+ 3.times do
+ expect(build(:related_content,
+ parent_relationable: parent_relationable,
+ child_relationable: child_relationable)).to be_valid
+ end
end
it "does not allow empty relationables" do
@@ -21,8 +23,15 @@ describe RelatedContent do
end
it "does not allow repeated related contents" do
- related_content = create(:related_content, parent_relationable: parent_relationable, child_relationable: child_relationable, author: build(:user))
- new_related_content = build(:related_content, parent_relationable: related_content.parent_relationable, child_relationable: related_content.child_relationable)
+ related_content = create(:related_content,
+ parent_relationable: parent_relationable,
+ child_relationable: child_relationable,
+ author: build(:user))
+
+ new_related_content = build(:related_content,
+ parent_relationable: related_content.parent_relationable,
+ child_relationable: related_content.child_relationable)
+
expect(new_related_content).not_to be_valid
end
@@ -61,7 +70,12 @@ describe RelatedContent do
describe "create_opposite_related_content" do
let(:parent_relationable) { create(:proposal) }
let(:child_relationable) { create(:debate) }
- let(:related_content) { build(:related_content, parent_relationable: parent_relationable, child_relationable: child_relationable, author: build(:user)) }
+ let(:related_content) do
+ build(:related_content,
+ parent_relationable: parent_relationable,
+ child_relationable: child_relationable,
+ author: build(:user))
+ end
it "creates an opposite related_content" do
expect { related_content.save }.to change { RelatedContent.count }.by(2)
@@ -72,8 +86,14 @@ describe RelatedContent do
describe "#relationed_contents" do
before do
- related_content = create(:related_content, parent_relationable: parent_relationable, child_relationable: create(:proposal), author: build(:user))
- create(:related_content, parent_relationable: parent_relationable, child_relationable: child_relationable, author: build(:user))
+ related_content = create(:related_content,
+ parent_relationable: parent_relationable,
+ child_relationable: create(:proposal),
+ author: build(:user))
+ create(:related_content,
+ parent_relationable: parent_relationable,
+ child_relationable: child_relationable,
+ author: build(:user))
2.times do
related_content.send(:score_positive, build(:user))
diff --git a/spec/models/sdg/local_target_spec.rb b/spec/models/sdg/local_target_spec.rb
index df4b341da..2f4def3f6 100644
--- a/spec/models/sdg/local_target_spec.rb
+++ b/spec/models/sdg/local_target_spec.rb
@@ -25,14 +25,18 @@ describe SDG::LocalTarget do
local_target = build(:sdg_local_target, code: "1.6.1", target: SDG::Target[1.1])
expect(local_target).not_to be_valid
- expect(local_target.errors.full_messages).to include "Code must start with the same code as its target followed by a dot and end with a number"
+ expect(local_target.errors.full_messages).to include "Code must start with the same " \
+ "code as its target followed by " \
+ "a dot and end with a number"
end
it "is not valid when local target code part is not a number" do
local_target = build(:sdg_local_target, code: "1.1.A", target: SDG::Target[1.1])
expect(local_target).not_to be_valid
- expect(local_target.errors.full_messages).to include "Code must start with the same code as its target followed by a dot and end with a number"
+ expect(local_target.errors.full_messages).to include "Code must start with the same " \
+ "code as its target followed by " \
+ "a dot and end with a number"
end
it "is not valid if code is not unique" do
diff --git a/spec/models/sdg/relatable_spec.rb b/spec/models/sdg/relatable_spec.rb
index 20e716d43..f6c9bbb4e 100644
--- a/spec/models/sdg/relatable_spec.rb
+++ b/spec/models/sdg/relatable_spec.rb
@@ -171,7 +171,10 @@ describe SDG::Relatable do
it "assigns goals, targets and local_targets" do
relatable.related_sdg_list = "1.1,3,4,4.1,#{another_local_target.code}"
- expect(relatable.reload.sdg_goals).to match_array [SDG::Goal[1], another_local_target.goal, SDG::Goal[3], SDG::Goal[4]]
+ expect(relatable.reload.sdg_goals).to match_array [SDG::Goal[1],
+ another_local_target.goal,
+ SDG::Goal[3],
+ SDG::Goal[4]]
expect(relatable.reload.sdg_global_targets).to match_array [SDG::Target[1.1], SDG::Target[4.1]]
expect(relatable.reload.sdg_local_targets).to match_array [another_local_target]
end
diff --git a/spec/models/signature_sheet_spec.rb b/spec/models/signature_sheet_spec.rb
index 9224b61a9..39caa34a0 100644
--- a/spec/models/signature_sheet_spec.rb
+++ b/spec/models/signature_sheet_spec.rb
@@ -200,21 +200,32 @@ describe SignatureSheet do
it "returns an array after spliting document numbers by semicolons" do
signature_sheet.required_fields_to_verify = "123A\r\n;456B;\n789C;123B"
- expect(signature_sheet.parsed_required_fields_to_verify_groups).to eq([["123A"], ["456B"], ["789C"], ["123B"]])
+ expect(signature_sheet.parsed_required_fields_to_verify_groups).to eq([["123A"],
+ ["456B"],
+ ["789C"],
+ ["123B"]])
end
it "returns an array after spliting all required_fields_to_verify by semicolons" do
- required_fields_to_verify = "123A\r\n, 01/01/1980\r\n, 28001\r\n; 456B\n, 01/02/1980\n, 28002\n; 789C, 01/03/1980"
+ required_fields_to_verify = "123A\r\n, 01/01/1980\r\n, 28001\r\n; " \
+ "456B\n, 01/02/1980\n, 28002\n; " \
+ "789C, 01/03/1980"
# signature_sheet.required_fields_to_verify = "123A\r\n456B\n789C;123B"
signature_sheet.required_fields_to_verify = required_fields_to_verify
- expect(signature_sheet.parsed_required_fields_to_verify_groups).to eq([["123A", "01/01/1980", "28001"], ["456B", "01/02/1980", "28002"], ["789C", "01/03/1980"]])
+ expect(signature_sheet.parsed_required_fields_to_verify_groups).to eq([["123A", "01/01/1980", "28001"],
+ ["456B", "01/02/1980", "28002"],
+ ["789C", "01/03/1980"]])
end
it "strips spaces between number and letter" do
- signature_sheet.required_fields_to_verify = "123 A, 01/01/1980, 28001;\n456 B , 01/02/1980, 28002;\n 789C ,01/03/1980, 28 003"
+ signature_sheet.required_fields_to_verify = "123 A, 01/01/1980, 28001;\n" \
+ "456 B , 01/02/1980, 28002;\n" \
+ "789C ,01/03/1980, 28 003"
- expect(signature_sheet.parsed_required_fields_to_verify_groups).to eq([["123A", "01/01/1980", "28001"], ["456B", "01/02/1980", "28002"], ["789C", "01/03/1980", "28003"]])
+ expect(signature_sheet.parsed_required_fields_to_verify_groups).to eq([["123A", "01/01/1980", "28001"],
+ ["456B", "01/02/1980", "28002"],
+ ["789C", "01/03/1980", "28003"]])
end
end
end
diff --git a/spec/models/signature_spec.rb b/spec/models/signature_spec.rb
index aa524a670..ac237ca76 100644
--- a/spec/models/signature_spec.rb
+++ b/spec/models/signature_spec.rb
@@ -95,7 +95,8 @@ describe Signature do
investment = create(:budget_investment)
signature_sheet = create(:signature_sheet, signable: investment)
user = create(:user, :level_two, document_number: "123A")
- signature = create(:signature, document_number: user.document_number, signature_sheet: signature_sheet)
+ signature = create(:signature, document_number: user.document_number,
+ signature_sheet: signature_sheet)
signature.verify
@@ -116,7 +117,8 @@ describe Signature do
investment = create(:budget_investment)
signature_sheet = create(:signature_sheet, signable: investment)
user = create(:user, document_number: "123A")
- signature = create(:signature, document_number: user.document_number, signature_sheet: signature_sheet)
+ signature = create(:signature, document_number: user.document_number,
+ signature_sheet: signature_sheet)
signature.verify
@@ -128,7 +130,8 @@ describe Signature do
investment = create(:budget_investment)
signature_sheet = create(:signature_sheet, signable: investment)
user = create(:user, :level_two, document_number: "123A")
- signature = create(:signature, document_number: user.document_number, signature_sheet: signature_sheet)
+ signature = create(:signature, document_number: user.document_number,
+ signature_sheet: signature_sheet)
signature.verify
signature.verify
@@ -140,7 +143,8 @@ describe Signature do
user = create(:user, :level_two, document_number: "123A")
proposal = create(:proposal, voters: [user])
signature_sheet = create(:signature_sheet, signable: proposal)
- signature = create(:signature, signature_sheet: signature_sheet, document_number: user.document_number)
+ signature = create(:signature, signature_sheet: signature_sheet,
+ document_number: user.document_number)
signature.verify
@@ -152,7 +156,8 @@ describe Signature do
investment = create(:budget_investment, voters: [user])
signature_sheet = create(:signature_sheet, signable: investment)
- signature = create(:signature, document_number: user.document_number, signature_sheet: signature_sheet)
+ signature = create(:signature, document_number: user.document_number,
+ signature_sheet: signature_sheet)
expect(Vote.count).to eq(1)
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index fc295d20f..50106de69 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -786,22 +786,26 @@ describe User do
debate = create(:debate, :hidden, author: user)
investment = create(:budget_investment, :hidden, author: user)
proposal = create(:proposal, :hidden, author: user)
- proposal_notification = create(:proposal_notification, :hidden, proposal: proposal)
legislation_proposal = create(:legislation_proposal, :hidden, author: user)
+ proposal_notification = create(:proposal_notification, :hidden, proposal: proposal)
old_hidden_comment = create(:comment, hidden_at: 3.days.ago, author: user)
old_hidden_debate = create(:debate, hidden_at: 3.days.ago, author: user)
old_hidden_investment = create(:budget_investment, hidden_at: 3.days.ago, author: user)
old_hidden_proposal = create(:proposal, hidden_at: 3.days.ago, author: user)
- old_hidden_proposal_notification = create(:proposal_notification, hidden_at: 3.days.ago, proposal: proposal)
old_hidden_legislation_proposal = create(:legislation_proposal, hidden_at: 3.days.ago, author: user)
+ old_hidden_proposal_notification = create(:proposal_notification,
+ hidden_at: 3.days.ago,
+ proposal: proposal)
other_user_comment = create(:comment, :hidden, author: other_user)
other_user_debate = create(:debate, :hidden, author: other_user)
other_user_proposal = create(:proposal, :hidden, author: other_user)
other_user_investment = create(:budget_investment, :hidden, author: other_user)
- other_user_proposal_notification = create(:proposal_notification, :hidden, proposal: other_user_proposal)
other_user_legislation_proposal = create(:legislation_proposal, :hidden, author: other_user)
+ other_user_proposal_notification = create(:proposal_notification,
+ :hidden,
+ proposal: other_user_proposal)
user.full_restore
diff --git a/spec/models/verification/management/document_spec.rb b/spec/models/verification/management/document_spec.rb
index 6dee5b10b..f814e088c 100644
--- a/spec/models/verification/management/document_spec.rb
+++ b/spec/models/verification/management/document_spec.rb
@@ -75,41 +75,49 @@ describe Verification::Management::Document do
end
describe "Allowed Age" do
- let(:min_age) { User.minimum_required_age }
- let(:over_minium_age_date_of_birth) { Date.new((min_age + 10).years.ago.year, 12, 31) }
- let(:under_minium_age_date_of_birth) { Date.new(min_age.years.ago.year, 12, 31) }
- let(:just_minium_age_date_of_birth) { Date.new(min_age.years.ago.year, min_age.years.ago.month, min_age.years.ago.day) }
+ let(:min_age) { User.minimum_required_age }
+ let(:over_minium_age_date_of_birth) { Date.new((min_age + 10).years.ago.year, 12, 31) }
+ let(:under_minium_age_date_of_birth) { Date.new(min_age.years.ago.year, 12, 31) }
+ let(:just_minium_age_date_of_birth) do
+ Date.new(min_age.years.ago.year, min_age.years.ago.month, min_age.years.ago.day)
+ end
describe "#valid_age?" do
it "returns false when the user is younger than the user's minimum required age" do
- census_response = instance_double("CensusApi::Response", date_of_birth: under_minium_age_date_of_birth)
+ census_response = instance_double("CensusApi::Response",
+ date_of_birth: under_minium_age_date_of_birth)
expect(Verification::Management::Document.new.valid_age?(census_response)).to be false
end
it "returns true when the user has the user's minimum required age" do
- census_response = instance_double("CensusApi::Response", date_of_birth: just_minium_age_date_of_birth)
+ census_response = instance_double("CensusApi::Response",
+ date_of_birth: just_minium_age_date_of_birth)
expect(Verification::Management::Document.new.valid_age?(census_response)).to be true
end
it "returns true when the user is older than the user's minimum required age" do
- census_response = instance_double("CensusApi::Response", date_of_birth: over_minium_age_date_of_birth)
+ census_response = instance_double("CensusApi::Response",
+ date_of_birth: over_minium_age_date_of_birth)
expect(Verification::Management::Document.new.valid_age?(census_response)).to be true
end
end
describe "#under_age?" do
it "returns true when the user is younger than the user's minimum required age" do
- census_response = instance_double("CensusApi::Response", date_of_birth: under_minium_age_date_of_birth)
+ census_response = instance_double("CensusApi::Response",
+ date_of_birth: under_minium_age_date_of_birth)
expect(Verification::Management::Document.new.under_age?(census_response)).to be true
end
it "returns false when the user is user's minimum required age" do
- census_response = instance_double("CensusApi::Response", date_of_birth: just_minium_age_date_of_birth)
+ census_response = instance_double("CensusApi::Response",
+ date_of_birth: just_minium_age_date_of_birth)
expect(Verification::Management::Document.new.under_age?(census_response)).to be false
end
it "returns false when the user is older than user's minimum required age" do
- census_response = instance_double("CensusApi::Response", date_of_birth: over_minium_age_date_of_birth)
+ census_response = instance_double("CensusApi::Response",
+ date_of_birth: over_minium_age_date_of_birth)
expect(Verification::Management::Document.new.under_age?(census_response)).to be false
end
end
diff --git a/spec/models/verification/management/email_spec.rb b/spec/models/verification/management/email_spec.rb
index 8f081b061..91d1c62f8 100644
--- a/spec/models/verification/management/email_spec.rb
+++ b/spec/models/verification/management/email_spec.rb
@@ -2,7 +2,11 @@ require "rails_helper"
describe Verification::Management::Email do
describe "#user" do
- subject { Verification::Management::Email.new(document_type: "1", document_number: "1234", email: "inexisting@gmail.com") }
+ subject do
+ Verification::Management::Email.new(document_type: "1",
+ document_number: "1234",
+ email: "inexisting@gmail.com")
+ end
it "returns nil/false when the user does not exist" do
expect(subject.user).to be_nil
@@ -12,34 +16,50 @@ describe Verification::Management::Email do
describe "validations" do
it "is not valid if the user does not exist" do
- expect(Verification::Management::Email.new(document_type: "1", document_number: "1234", email: "inexisting@gmail.com")).not_to be_valid
+ expect(Verification::Management::Email.new(document_type: "1",
+ document_number: "1234",
+ email: "inexisting@gmail.com")).not_to be_valid
end
it "is not valid if the user is already level 3" do
user = create(:user, :level_three)
- expect(Verification::Management::Email.new(document_type: "1", document_number: "1234", email: user.email)).not_to be_valid
+
+ expect(Verification::Management::Email.new(document_type: "1",
+ document_number: "1234",
+ email: user.email)).not_to be_valid
end
it "is not valid if the user already has a different document number" do
user = create(:user, document_number: "1234", document_type: "1")
- expect(Verification::Management::Email.new(document_type: "1", document_number: "5678", email: user.email)).not_to be_valid
+
+ expect(Verification::Management::Email.new(document_type: "1",
+ document_number: "5678",
+ email: user.email)).not_to be_valid
end
end
describe "#save" do
it "does nothing if not valid" do
- expect(Verification::Management::Email.new(document_type: "1", document_number: "1234", email: "inexisting@gmail.com").save).to eq(false)
+ email = Verification::Management::Email.new(document_type: "1",
+ document_number: "1234",
+ email: "inexisting@gmail.com")
+
+ expect(email.save).to eq(false)
end
it "updates the user and sends an email" do
user = create(:user)
- validation = Verification::Management::Email.new(document_type: "1", document_number: "1234", email: user.email)
+ validation = Verification::Management::Email.new(document_type: "1",
+ document_number: "1234",
+ email: user.email)
mail = double(:mail)
allow(validation).to receive(:user).and_return user
allow(mail).to receive(:deliver_later)
- allow(Devise.token_generator).to receive(:generate).with(User, :email_verification_token).and_return(["1", "2"])
+ allow(Devise.token_generator).to(receive(:generate)
+ .with(User, :email_verification_token)
+ .and_return(["1", "2"]))
allow(Mailer).to receive(:email_verification).with(user, user.email, "2", "1", "1234").and_return(mail)
validation.save!
diff --git a/spec/models/verification/residence_spec.rb b/spec/models/verification/residence_spec.rb
index 8dc4b18e6..988b2a805 100644
--- a/spec/models/verification/residence_spec.rb
+++ b/spec/models/verification/residence_spec.rb
@@ -11,13 +11,17 @@ describe Verification::Residence do
describe "dates" do
it "is valid with a valid date of birth" do
- residence = Verification::Residence.new("date_of_birth(3i)" => "1", "date_of_birth(2i)" => "1", "date_of_birth(1i)" => "1980")
+ residence = Verification::Residence.new("date_of_birth(3i)" => "1",
+ "date_of_birth(2i)" => "1",
+ "date_of_birth(1i)" => "1980")
expect(residence.errors[:date_of_birth]).to be_empty
end
it "is not valid without a date of birth" do
- residence = Verification::Residence.new("date_of_birth(3i)" => "", "date_of_birth(2i)" => "", "date_of_birth(1i)" => "")
+ residence = Verification::Residence.new("date_of_birth(3i)" => "",
+ "date_of_birth(2i)" => "",
+ "date_of_birth(1i)" => "")
expect(residence).not_to be_valid
expect(residence.errors[:date_of_birth]).to include("can't be blank")
end
diff --git a/spec/shared/models/acts_as_paranoid.rb b/spec/shared/models/acts_as_paranoid.rb
index 899032d02..25feac564 100644
--- a/spec/shared/models/acts_as_paranoid.rb
+++ b/spec/shared/models/acts_as_paranoid.rb
@@ -37,14 +37,17 @@ shared_examples "acts as paranoid" do |factory_name|
resource.destroy!
resource.reload
- expect { resource.restore(recursive: true) }.to change { resource.translations.with_deleted.first.hidden_at }
+ expect do
+ resource.restore(recursive: true)
+ end.to change { resource.translations.with_deleted.first.hidden_at }
end
it "can be recovered after soft deletion through recursive restore" do
original_translation = resource.translations.first
new_translation = resource.translations.build
described_class.translated_attribute_names.each do |translated_attribute_name|
- new_translation.send("#{translated_attribute_name}=", original_translation.send(translated_attribute_name))
+ new_translation.send("#{translated_attribute_name}=",
+ original_translation.send(translated_attribute_name))
end
new_translation.locale = :fr
new_translation.save!
diff --git a/spec/shared/system/mappable.rb b/spec/shared/system/mappable.rb
index cf12103db..66c4742b8 100644
--- a/spec/shared/system/mappable.rb
+++ b/spec/shared/system/mappable.rb
@@ -1,9 +1,14 @@
-shared_examples "mappable" do |mappable_factory_name, mappable_association_name, mappable_new_path, mappable_edit_path, mappable_show_path, mappable_path_arguments: {}, management: false|
+shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
+ mappable_new_path, mappable_edit_path, mappable_show_path,
+ mappable_path_arguments: {},
+ management: false|
let!(:user) { create(:user, :level_two) }
let!(:arguments) { {} }
let!(:mappable) { create(mappable_factory_name.to_s.to_sym) }
- let!(:map_location) { create(:map_location, "#{mappable_factory_name}_map_location".to_sym, "#{mappable_association_name}": mappable) }
let(:management) { management }
+ let!(:map_location) do
+ create(:map_location, :"#{mappable_factory_name}_map_location", "#{mappable_association_name}": mappable)
+ end
before do
Setting["feature.map"] = true
@@ -181,8 +186,10 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
visit send(mappable_edit_path, id: mappable.id)
expect(page).to have_content "Navigate the map to the location and place the marker."
- expect(page).to have_field "#{mappable_factory_name}_map_location_attributes_latitude", type: :hidden, with: "51.48"
- expect(page).to have_field "#{mappable_factory_name}_map_location_attributes_longitude", type: :hidden, with: "0.0"
+ expect(page).to have_field "#{mappable_factory_name}_map_location_attributes_latitude", type: :hidden,
+ with: "51.48"
+ expect(page).to have_field "#{mappable_factory_name}_map_location_attributes_longitude", type: :hidden,
+ with: "0.0"
end
scenario "Should edit default values from map on #{mappable_factory_name} edit page" do
diff --git a/spec/shared/system/relationable.rb b/spec/shared/system/relationable.rb
index c9faf9221..e6a4b31ca 100644
--- a/spec/shared/system/relationable.rb
+++ b/spec/shared/system/relationable.rb
@@ -9,7 +9,10 @@ shared_examples "relationable" do |relationable_model_name|
end
scenario "related contents are listed" do
- create(:related_content, parent_relationable: relationable, child_relationable: related1, author: build(:user))
+ create(:related_content,
+ parent_relationable: relationable,
+ child_relationable: related1,
+ author: build(:user))
visit polymorphic_path(relationable)
within("#related-content-list") do
@@ -136,7 +139,10 @@ shared_examples "relationable" do |relationable_model_name|
end
scenario "related content can be scored positively" do
- create(:related_content, parent_relationable: relationable, child_relationable: related1, author: build(:user))
+ create(:related_content,
+ parent_relationable: relationable,
+ child_relationable: related1,
+ author: build(:user))
login_as(user)
visit polymorphic_path(relationable)
@@ -150,7 +156,10 @@ shared_examples "relationable" do |relationable_model_name|
end
scenario "related content can be scored negatively" do
- create(:related_content, parent_relationable: relationable, child_relationable: related1, author: build(:user))
+ create(:related_content,
+ parent_relationable: relationable,
+ child_relationable: related1,
+ author: build(:user))
login_as(user)
visit polymorphic_path(relationable)
@@ -164,7 +173,10 @@ shared_examples "relationable" do |relationable_model_name|
end
scenario "if related content has negative score it will be hidden" do
- related_content = create(:related_content, parent_relationable: relationable, child_relationable: related1, author: build(:user))
+ related_content = create(:related_content,
+ parent_relationable: relationable,
+ child_relationable: related1,
+ author: build(:user))
2.times do
related_content.send(:score_positive, build(:user))
diff --git a/spec/shared/system/remotely_translatable.rb b/spec/shared/system/remotely_translatable.rb
index 2912b1497..f23d7e3ac 100644
--- a/spec/shared/system/remotely_translatable.rb
+++ b/spec/shared/system/remotely_translatable.rb
@@ -58,7 +58,8 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume
select "Español", from: "Language:"
expect(page).not_to have_button("Traducir página")
- expect(page).to have_content("En un breve periodo de tiempo refrescando la página podrá ver todo el contenido en su idioma")
+ expect(page).to have_content "En un breve periodo de tiempo refrescando la página " \
+ "podrá ver todo el contenido en su idioma"
end
end
@@ -152,8 +153,9 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume
click_button "Traducir página"
- expect(page).to have_content("Se han solicitado correctamente las traducciones.")
- expect(page).to have_content("En un breve periodo de tiempo refrescando la página podrá ver todo el contenido en su idioma")
+ expect(page).to have_content "Se han solicitado correctamente las traducciones."
+ expect(page).to have_content "En un breve periodo de tiempo refrescando la página " \
+ "podrá ver todo el contenido en su idioma"
end
scenario "should be present only informative text when user visit page with all content enqueued" do
@@ -166,8 +168,9 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume
select "Español", from: "Idioma:"
expect(page).not_to have_button "Traducir página"
- expect(page).not_to have_content("Se han solicitado correctamente las traducciones.")
- expect(page).to have_content("En un breve periodo de tiempo refrescando la página podrá ver todo el contenido en su idioma")
+ expect(page).not_to have_content "Se han solicitado correctamente las traducciones."
+ expect(page).to have_content "En un breve periodo de tiempo refrescando la página " \
+ "podrá ver todo el contenido en su idioma"
end
end
diff --git a/spec/support/matchers/be_rendered.rb b/spec/support/matchers/be_rendered.rb
index f375f7589..0a2f69182 100644
--- a/spec/support/matchers/be_rendered.rb
+++ b/spec/support/matchers/be_rendered.rb
@@ -9,7 +9,8 @@ RSpec::Matchers.define :be_rendered do |with: nil|
failure_message do |page|
if page.has_css?("body")
- "expected page to be rendered with #{with}, but was rendered with #{page.find("body").native.inner_html}"
+ "expected page to be rendered with #{with}, " \
+ "but was rendered with #{page.find("body").native.inner_html}"
else
"expected page to be rendered with #{with}, but was not rendered"
end
diff --git a/spec/system/admin/budgets_spec.rb b/spec/system/admin/budgets_spec.rb
index 7d1fb85e7..e1e2a966b 100644
--- a/spec/system/admin/budgets_spec.rb
+++ b/spec/system/admin/budgets_spec.rb
@@ -198,7 +198,9 @@ describe "Admin budgets", :admin do
scenario "Destroy a budget without investments" do
visit admin_budget_path(budget)
- message = "Are you sure? This will delete the budget and all its associated groups and headings. This action cannot be undone."
+ message = "Are you sure? " \
+ "This will delete the budget and all its associated groups and headings. " \
+ "This action cannot be undone."
accept_confirm(message) { click_button "Delete budget" }
diff --git a/spec/system/admin/hidden_users_spec.rb b/spec/system/admin/hidden_users_spec.rb
index 0cf4744d4..4fb320a6f 100644
--- a/spec/system/admin/hidden_users_spec.rb
+++ b/spec/system/admin/hidden_users_spec.rb
@@ -6,7 +6,9 @@ describe "Admin hidden users", :admin do
debate1 = create(:debate, :hidden, author: user)
debate2 = create(:debate, author: user)
- comment1 = create(:comment, :hidden, user: user, commentable: debate2, body: "You have the manners of a beggar")
+ comment1 = create(:comment, :hidden, user: user,
+ commentable: debate2,
+ body: "You have the manners of a beggar")
comment2 = create(:comment, user: user, commentable: debate2, body: "Not Spam")
visit admin_hidden_user_path(user)
diff --git a/spec/system/admin/machine_learning_spec.rb b/spec/system/admin/machine_learning_spec.rb
index f7f4606e8..0332b4db9 100644
--- a/spec/system/admin/machine_learning_spec.rb
+++ b/spec/system/admin/machine_learning_spec.rb
@@ -217,7 +217,9 @@ describe "Machine learning" do
updated_at: 2.minutes.from_now)
comments_file = MachineLearning.data_folder.join(MachineLearning.comments_filename)
File.write(comments_file, [].to_json)
- proposals_comments_summary_file = MachineLearning.data_folder.join(MachineLearning.proposals_comments_summary_filename)
+ proposals_comments_summary_file = MachineLearning
+ .data_folder
+ .join(MachineLearning.proposals_comments_summary_filename)
File.write(proposals_comments_summary_file, [].to_json)
end
diff --git a/spec/system/admin/poll/shifts_spec.rb b/spec/system/admin/poll/shifts_spec.rb
index 3effc075c..a5e25a554 100644
--- a/spec/system/admin/poll/shifts_spec.rb
+++ b/spec/system/admin/poll/shifts_spec.rb
@@ -30,8 +30,16 @@ describe "Admin shifts", :admin do
poll = create(:poll)
booth = create(:poll_booth, polls: [poll, create(:poll, :expired)])
officer = create(:poll_officer)
- vote_collection_dates = (Date.current..poll.ends_at.to_date).to_a.map { |date| I18n.l(date, format: :long) }
- recount_scrutiny_dates = (poll.ends_at.to_date..poll.ends_at.to_date + 1.week).to_a.map { |date| I18n.l(date, format: :long) }
+ vote_collection_dates = (Date.current..poll.ends_at.to_date)
+ .to_a
+ .map do |date|
+ I18n.l(date, format: :long)
+ end
+ recount_scrutiny_dates = (poll.ends_at.to_date..poll.ends_at.to_date + 1.week)
+ .to_a
+ .map do |date|
+ I18n.l(date, format: :long)
+ end
visit available_admin_booths_path
@@ -45,7 +53,8 @@ describe "Admin shifts", :admin do
click_button "Search"
click_link "Edit shifts"
- expect(page).to have_select("shift_date_vote_collection_date", options: ["Select day", *vote_collection_dates])
+ expect(page).to have_select("shift_date_vote_collection_date",
+ options: ["Select day", *vote_collection_dates])
expect(page).not_to have_select("shift_date_recount_scrutiny_date")
select I18n.l(Date.current, format: :long), from: "shift_date_vote_collection_date"
click_button "Add shift"
@@ -73,7 +82,8 @@ describe "Admin shifts", :admin do
select "Recount & Scrutiny", from: "shift_task"
- expect(page).to have_select("shift_date_recount_scrutiny_date", options: ["Select day", *recount_scrutiny_dates])
+ expect(page).to have_select("shift_date_recount_scrutiny_date",
+ options: ["Select day", *recount_scrutiny_dates])
expect(page).not_to have_select("shift_date_vote_collection_date")
select I18n.l(poll.ends_at.to_date + 4.days, format: :long), from: "shift_date_recount_scrutiny_date"
click_button "Add shift"
@@ -98,8 +108,11 @@ describe "Admin shifts", :admin do
vote_collection_dates = (Date.current..poll.ends_at.to_date).excluding(Date.current)
.map { |date| I18n.l(date, format: :long) }
- recount_scrutiny_dates = (poll.ends_at.to_date..poll.ends_at.to_date + 1.week).excluding(Time.zone.tomorrow)
- .map { |date| I18n.l(date, format: :long) }
+ recount_scrutiny_dates = (poll.ends_at.to_date..poll.ends_at.to_date + 1.week)
+ .excluding(Time.zone.tomorrow)
+ .map do |date|
+ I18n.l(date, format: :long)
+ end
visit available_admin_booths_path
@@ -113,9 +126,11 @@ describe "Admin shifts", :admin do
click_button "Search"
click_link "Edit shifts"
- expect(page).to have_select("shift_date_vote_collection_date", options: ["Select day", *vote_collection_dates])
+ expect(page).to have_select("shift_date_vote_collection_date",
+ options: ["Select day", *vote_collection_dates])
select "Recount & Scrutiny", from: "shift_task"
- expect(page).to have_select("shift_date_recount_scrutiny_date", options: ["Select day", *recount_scrutiny_dates])
+ expect(page).to have_select("shift_date_recount_scrutiny_date",
+ options: ["Select day", *recount_scrutiny_dates])
end
scenario "Change option from Recount & Scrutinity to Collect Votes" do
diff --git a/spec/system/admin/signature_sheets_spec.rb b/spec/system/admin/signature_sheets_spec.rb
index 032414f1a..d2c36191d 100644
--- a/spec/system/admin/signature_sheets_spec.rb
+++ b/spec/system/admin/signature_sheets_spec.rb
@@ -83,7 +83,8 @@ describe "Signature sheets", :admin do
select "Citizen proposal", from: "signature_sheet_signable_type"
fill_in "signature_sheet_signable_id", with: proposal.id
- fill_in "signature_sheet_required_fields_to_verify", with: "12345678Z, 31/12/1980, 28013; 99999999Z, 31/12/1980, 28013"
+ fill_in "signature_sheet_required_fields_to_verify",
+ with: "12345678Z, 31/12/1980, 28013; 99999999Z, 31/12/1980, 28013"
click_button "Create signature sheet"
expect(page).to have_content "Signature sheet created successfully"
@@ -102,7 +103,8 @@ describe "Signature sheets", :admin do
select "Investment", from: "signature_sheet_signable_type"
fill_in "signature_sheet_signable_id", with: investment.id
- fill_in "signature_sheet_required_fields_to_verify", with: "12345678Z, 31/12/1980, 28013; 99999999Z, 31/12/1980, 28013"
+ fill_in "signature_sheet_required_fields_to_verify",
+ with: "12345678Z, 31/12/1980, 28013; 99999999Z, 31/12/1980, 28013"
click_button "Create signature sheet"
expect(page).to have_content "Signature sheet created successfully"
diff --git a/spec/system/admin/widgets/cards_spec.rb b/spec/system/admin/widgets/cards_spec.rb
index d34549503..319ab3770 100644
--- a/spec/system/admin/widgets/cards_spec.rb
+++ b/spec/system/admin/widgets/cards_spec.rb
@@ -211,7 +211,9 @@ describe "Cards", :admin do
card_1 = create(:widget_card, cardable: custom_page, title: "Card one")
card_2 = create(:widget_card, cardable: custom_page, title: "Card two")
- card_1.update!(image: create(:image, imageable: card_1, attachment: fixture_file_upload("clippy.jpg")))
+ card_1.update!(image: create(:image,
+ imageable: card_1,
+ attachment: fixture_file_upload("clippy.jpg")))
card_2.update!(image: nil)
visit custom_page.url
diff --git a/spec/system/advanced_search_spec.rb b/spec/system/advanced_search_spec.rb
index 12517920d..0adf6ebba 100644
--- a/spec/system/advanced_search_spec.rb
+++ b/spec/system/advanced_search_spec.rb
@@ -254,9 +254,11 @@ describe "Advanced search" do
expect(page).to have_content("citizen proposals cannot be found")
within ".advanced-search-form" do
- expect(page).to have_select("advanced_search[date_min]", selected: "Customized")
- expect(page).to have_selector("input[name='advanced_search[date_min]'][value*='#{7.days.ago.strftime("%d/%m/%Y")}']")
- expect(page).to have_selector("input[name='advanced_search[date_max]'][value*='#{1.day.ago.strftime("%d/%m/%Y")}']")
+ expect(page).to have_select "advanced_search[date_min]", selected: "Customized"
+ expect(page).to have_selector "input[name='advanced_search[date_min]']" \
+ "[value*='#{7.days.ago.strftime("%d/%m/%Y")}']"
+ expect(page).to have_selector "input[name='advanced_search[date_max]']" \
+ "[value*='#{1.day.ago.strftime("%d/%m/%Y")}']"
end
end
end
diff --git a/spec/system/budgets/ballots_spec.rb b/spec/system/budgets/ballots_spec.rb
index ccd80d364..debd21ee9 100644
--- a/spec/system/budgets/ballots_spec.rb
+++ b/spec/system/budgets/ballots_spec.rb
@@ -326,7 +326,8 @@ describe "Ballots" do
expect(page).not_to have_css "#progressbar"
expect(page).to have_content "You have active votes in another heading: California"
- expect(page).to have_link california.name, href: budget_investments_path(budget, heading_id: california.id)
+ expect(page).to have_link california.name,
+ href: budget_investments_path(budget, heading_id: california.id)
end
end
diff --git a/spec/system/budgets/investments_spec.rb b/spec/system/budgets/investments_spec.rb
index c48f9425e..f0b42694a 100644
--- a/spec/system/budgets/investments_spec.rb
+++ b/spec/system/budgets/investments_spec.rb
@@ -661,7 +661,10 @@ describe "Budget Investments" do
expect(page).not_to have_content("#{heading.name} (#{budget.formatted_heading_price(heading)})")
expect(page).to have_select "Heading",
- options: ["", "Health: More hospitals", "Health: Medical supplies", "Education: Schools"]
+ options: ["",
+ "Health: More hospitals",
+ "Health: Medical supplies",
+ "Education: Schools"]
select "Health: Medical supplies", from: "Heading"
@@ -691,7 +694,11 @@ describe "Budget Investments" do
scenario "Edit" do
daniel = create(:user, :level_two)
- create(:budget_investment, heading: heading, title: "Get Schwifty", author: daniel, created_at: 1.day.ago)
+ create(:budget_investment,
+ heading: heading,
+ title: "Get Schwifty",
+ author: daniel,
+ created_at: 1.day.ago)
login_as(daniel)
@@ -1101,9 +1108,15 @@ describe "Budget Investments" do
expect(page).not_to have_content("Local government is not competent in this matter")
end
- it_behaves_like "followable", "budget_investment", "budget_investment_path", { budget_id: "budget_id", id: "id" }
+ it_behaves_like "followable",
+ "budget_investment",
+ "budget_investment_path",
+ { budget_id: "budget_id", id: "id" }
- it_behaves_like "imageable", "budget_investment", "budget_investment_path", { budget_id: "budget_id", id: "id" }
+ it_behaves_like "imageable",
+ "budget_investment",
+ "budget_investment_path",
+ { budget_id: "budget_id", id: "id" }
it_behaves_like "nested imageable",
"budget_investment",
@@ -1113,7 +1126,10 @@ describe "Budget Investments" do
"Create Investment",
"Budget Investment created successfully."
- it_behaves_like "documentable", "budget_investment", "budget_investment_path", { budget_id: "budget_id", id: "id" }
+ it_behaves_like "documentable",
+ "budget_investment",
+ "budget_investment_path",
+ { budget_id: "budget_id", id: "id" }
it_behaves_like "nested documentable",
"user",
@@ -1383,11 +1399,17 @@ describe "Budget Investments" do
end
scenario "Order by cost (only when balloting)" do
- mid_investment = create(:budget_investment, :selected, heading: heading, title: "Build a nice house", price: 1000)
+ mid_investment = create(:budget_investment, :selected, heading: heading,
+ title: "Build a nice house",
+ price: 1000)
mid_investment.update_column(:confidence_score, 10)
- low_investment = create(:budget_investment, :selected, heading: heading, title: "Build an ugly house", price: 1000)
+ low_investment = create(:budget_investment, :selected, heading: heading,
+ title: "Build an ugly house",
+ price: 1000)
low_investment.update_column(:confidence_score, 5)
- high_investment = create(:budget_investment, :selected, heading: heading, title: "Build a skyscraper", price: 20000)
+ high_investment = create(:budget_investment, :selected, heading: heading,
+ title: "Build a skyscraper",
+ price: 20000)
visit budget_investments_path(budget, heading_id: heading.id)
@@ -1699,8 +1721,23 @@ describe "Budget Investments" do
end
scenario "Shows the polygon associated to the current heading" do
- triangle = '{ "geometry": { "type": "Polygon", "coordinates": [[-0.1,51.5],[-0.2,51.4],[-0.3,51.6]] } }'
- rectangle = '{ "geometry": { "type": "Polygon", "coordinates": [[-0.1,51.5],[-0.2,51.5],[-0.2,51.6],[-0.1,51.6]] } }'
+ triangle = <<~JSON
+ {
+ "geometry": {
+ "type": "Polygon",
+ "coordinates": [[-0.1,51.5],[-0.2,51.4],[-0.3,51.6]]
+ }
+ }
+ JSON
+
+ rectangle = <<~JSON
+ {
+ "geometry": {
+ "type": "Polygon",
+ "coordinates": [[-0.1,51.5],[-0.2,51.5],[-0.2,51.6],[-0.1,51.6]]
+ }
+ }
+ JSON
park = create(:geozone, geojson: triangle, color: "#03ee03")
square = create(:geozone, geojson: rectangle, color: "#ff04ff")
diff --git a/spec/system/budgets/results_spec.rb b/spec/system/budgets/results_spec.rb
index b17618ef6..777eeb74a 100644
--- a/spec/system/budgets/results_spec.rb
+++ b/spec/system/budgets/results_spec.rb
@@ -6,10 +6,24 @@ describe "Results" do
let(:heading) { create(:budget_heading, group: group, price: 1000) }
before do
- create(:budget_investment, :selected, title: "First selected", heading: heading, price: 200, ballot_lines_count: 900)
- create(:budget_investment, :selected, title: "Second selected", heading: heading, price: 300, ballot_lines_count: 800)
- create(:budget_investment, :incompatible, title: "Incompatible investment", heading: heading, price: 500, ballot_lines_count: 700)
- create(:budget_investment, :selected, title: "Exceeding price", heading: heading, price: 600, ballot_lines_count: 600)
+ create(:budget_investment, :selected, title: "First selected",
+ heading: heading,
+ price: 200,
+ ballot_lines_count: 900)
+
+ create(:budget_investment, :selected, title: "Second selected",
+ heading: heading, price: 300,
+ ballot_lines_count: 800)
+
+ create(:budget_investment, :incompatible, title: "Incompatible investment",
+ heading: heading,
+ price: 500,
+ ballot_lines_count: 700)
+
+ create(:budget_investment, :selected, title: "Exceeding price",
+ heading: heading,
+ price: 600,
+ ballot_lines_count: 600)
Budget::Result.new(budget, heading).calculate_winners
end
diff --git a/spec/system/budgets/votes_spec.rb b/spec/system/budgets/votes_spec.rb
index 9d38b47b6..27df7c53e 100644
--- a/spec/system/budgets/votes_spec.rb
+++ b/spec/system/budgets/votes_spec.rb
@@ -149,7 +149,8 @@ describe "Votes" do
participation = find(".participation-not-allowed")
headings = participation.text
- .match(/You have already supported investments in (.+) and (.+)\./)&.captures
+ .match(/You have already supported investments in (.+) and (.+)\./)
+ &.captures
expect(headings).to match_array [new_york.name, san_francisco.name]
diff --git a/spec/system/comments/budget_investments_spec.rb b/spec/system/comments/budget_investments_spec.rb
index 639db3a24..28f8dea6e 100644
--- a/spec/system/comments/budget_investments_spec.rb
+++ b/spec/system/comments/budget_investments_spec.rb
@@ -36,7 +36,8 @@ describe "Commenting Budget::Investments" do
expect(page).to have_content "First subcomment"
expect(page).to have_content "Last subcomment"
- expect(page).to have_link "Go back to #{investment.title}", href: budget_investment_path(investment.budget, investment)
+ expect(page).to have_link "Go back to #{investment.title}",
+ href: budget_investment_path(investment.budget, investment)
within ".comment", text: "Parent" do
expect(page).to have_selector(".comment", count: 2)
@@ -60,8 +61,14 @@ describe "Commenting Budget::Investments" do
scenario "Collapsable comments" do
parent_comment = create(:comment, body: "Main comment", commentable: investment)
- child_comment = create(:comment, body: "First subcomment", commentable: investment, parent: parent_comment)
- grandchild_comment = create(:comment, body: "Last subcomment", commentable: investment, parent: child_comment)
+ child_comment = create(:comment,
+ body: "First subcomment",
+ commentable: investment,
+ parent: parent_comment)
+ grandchild_comment = create(:comment,
+ body: "Last subcomment",
+ commentable: investment,
+ parent: child_comment)
visit budget_investment_path(investment.budget, investment)
@@ -126,8 +133,14 @@ describe "Commenting Budget::Investments" do
scenario "Creation date works differently in roots and child comments when sorting by confidence_score" do
old_root = create(:comment, commentable: investment, created_at: Time.current - 10)
new_root = create(:comment, commentable: investment, created_at: Time.current)
- old_child = create(:comment, commentable: investment, parent_id: new_root.id, created_at: Time.current - 10)
- new_child = create(:comment, commentable: investment, parent_id: new_root.id, created_at: Time.current)
+ old_child = create(:comment,
+ commentable: investment,
+ parent_id: new_root.id,
+ created_at: Time.current - 10)
+ new_child = create(:comment,
+ commentable: investment,
+ parent_id: new_root.id,
+ created_at: Time.current)
visit budget_investment_path(investment.budget, investment, order: :most_voted)
@@ -160,7 +173,9 @@ describe "Commenting Budget::Investments" do
scenario "Sanitizes comment body for security" do
create :comment, commentable: investment,
- body: " click me http://www.url.com"
+ body: " " \
+ "click me " \
+ "http://www.url.com"
visit budget_investment_path(investment.budget, investment)
diff --git a/spec/system/comments/debates_spec.rb b/spec/system/comments/debates_spec.rb
index f56e52c35..b3d846f59 100644
--- a/spec/system/comments/debates_spec.rb
+++ b/spec/system/comments/debates_spec.rb
@@ -176,7 +176,9 @@ describe "Commenting debates" do
scenario "Sanitizes comment body for security" do
create :comment, commentable: debate,
- body: " click me http://www.url.com"
+ body: " " \
+ "click me " \
+ "http://www.url.com"
visit debate_path(debate)
diff --git a/spec/system/comments/legislation_annotations_spec.rb b/spec/system/comments/legislation_annotations_spec.rb
index 54ae77b22..0e409c55b 100644
--- a/spec/system/comments/legislation_annotations_spec.rb
+++ b/spec/system/comments/legislation_annotations_spec.rb
@@ -57,8 +57,14 @@ describe "Commenting legislation questions" do
scenario "Collapsable comments" do
parent_comment = annotation.comments.first
- child_comment = create(:comment, body: "First subcomment", commentable: annotation, parent: parent_comment)
- grandchild_comment = create(:comment, body: "Last subcomment", commentable: annotation, parent: child_comment)
+ child_comment = create(:comment,
+ body: "First subcomment",
+ commentable: annotation,
+ parent: parent_comment)
+ grandchild_comment = create(:comment,
+ body: "Last subcomment",
+ commentable: annotation,
+ parent: child_comment)
visit polymorphic_path(annotation)
@@ -123,8 +129,14 @@ describe "Commenting legislation questions" do
scenario "Creation date works differently in roots and child comments when sorting by confidence_score" do
old_root = create(:comment, commentable: annotation, created_at: Time.current - 10)
new_root = create(:comment, commentable: annotation, created_at: Time.current)
- old_child = create(:comment, commentable: annotation, parent_id: new_root.id, created_at: Time.current - 10)
- new_child = create(:comment, commentable: annotation, parent_id: new_root.id, created_at: Time.current)
+ old_child = create(:comment,
+ commentable: annotation,
+ parent_id: new_root.id,
+ created_at: Time.current - 10)
+ new_child = create(:comment,
+ commentable: annotation,
+ parent_id: new_root.id,
+ created_at: Time.current)
visit polymorphic_path(annotation, order: :most_voted)
@@ -158,7 +170,9 @@ describe "Commenting legislation questions" do
scenario "Sanitizes comment body for security" do
create :comment, commentable: annotation,
- body: " click me http://www.url.com"
+ body: " " \
+ "click me " \
+ "http://www.url.com"
visit polymorphic_path(annotation)
@@ -563,12 +577,16 @@ describe "Commenting legislation questions" do
describe "Merged comment threads" do
let!(:draft_version) { create(:legislation_draft_version, :published) }
let!(:annotation1) do
- create(:legislation_annotation, draft_version: draft_version, text: "my annotation",
- ranges: [{ "start" => "/p[1]", "startOffset" => 1, "end" => "/p[1]", "endOffset" => 5 }])
+ create(:legislation_annotation,
+ draft_version: draft_version,
+ text: "my annotation",
+ ranges: [{ "start" => "/p[1]", "startOffset" => 1, "end" => "/p[1]", "endOffset" => 5 }])
end
let!(:annotation2) do
- create(:legislation_annotation, draft_version: draft_version, text: "my other annotation",
- ranges: [{ "start" => "/p[1]", "startOffset" => 1, "end" => "/p[1]", "endOffset" => 10 }])
+ create(:legislation_annotation,
+ draft_version: draft_version,
+ text: "my other annotation",
+ ranges: [{ "start" => "/p[1]", "startOffset" => 1, "end" => "/p[1]", "endOffset" => 10 }])
end
let!(:comment1) { annotation1.comments.first }
let!(:comment2) { annotation2.comments.first }
diff --git a/spec/system/comments/legislation_questions_spec.rb b/spec/system/comments/legislation_questions_spec.rb
index 83bda571d..bec16a685 100644
--- a/spec/system/comments/legislation_questions_spec.rb
+++ b/spec/system/comments/legislation_questions_spec.rb
@@ -63,7 +63,10 @@ describe "Commenting legislation questions" do
scenario "Collapsable comments" do
parent_comment = create(:comment, body: "Main comment", commentable: question)
child_comment = create(:comment, body: "First subcomment", commentable: question, parent: parent_comment)
- grandchild_comment = create(:comment, body: "Last subcomment", commentable: question, parent: child_comment)
+ grandchild_comment = create(:comment,
+ body: "Last subcomment",
+ commentable: question,
+ parent: child_comment)
visit legislation_process_question_path(question.process, question)
@@ -162,7 +165,9 @@ describe "Commenting legislation questions" do
scenario "Sanitizes comment body for security" do
create :comment, commentable: question,
- body: " click me http://www.url.com"
+ body: " " \
+ "click me " \
+ "http://www.url.com"
visit legislation_process_question_path(question.process, question)
diff --git a/spec/system/comments/polls_spec.rb b/spec/system/comments/polls_spec.rb
index c4ffbd90f..461177820 100644
--- a/spec/system/comments/polls_spec.rb
+++ b/spec/system/comments/polls_spec.rb
@@ -154,7 +154,9 @@ describe "Commenting polls" do
scenario "Sanitizes comment body for security" do
create :comment, commentable: poll,
- body: " click me http://www.url.com"
+ body: " " \
+ "click me " \
+ "http://www.url.com"
visit poll_path(poll)
diff --git a/spec/system/comments/proposals_spec.rb b/spec/system/comments/proposals_spec.rb
index 4e229f3cb..bece16b5a 100644
--- a/spec/system/comments/proposals_spec.rb
+++ b/spec/system/comments/proposals_spec.rb
@@ -57,7 +57,10 @@ describe "Commenting proposals" do
scenario "Collapsable comments" do
parent_comment = create(:comment, body: "Main comment", commentable: proposal)
child_comment = create(:comment, body: "First subcomment", commentable: proposal, parent: parent_comment)
- grandchild_comment = create(:comment, body: "Last subcomment", commentable: proposal, parent: child_comment)
+ grandchild_comment = create(:comment,
+ body: "Last subcomment",
+ commentable: proposal,
+ parent: child_comment)
visit proposal_path(proposal)
@@ -156,7 +159,9 @@ describe "Commenting proposals" do
scenario "Sanitizes comment body for security" do
create :comment, commentable: proposal,
- body: " click me http://www.url.com"
+ body: " " \
+ "click me " \
+ "http://www.url.com"
visit proposal_path(proposal)
diff --git a/spec/system/comments/topics_spec.rb b/spec/system/comments/topics_spec.rb
index 51484eec0..1fb666c05 100644
--- a/spec/system/comments/topics_spec.rb
+++ b/spec/system/comments/topics_spec.rb
@@ -169,7 +169,9 @@ describe "Commenting topics from proposals" do
community = proposal.community
topic = create(:topic, community: community)
create :comment, commentable: topic,
- body: " click me http://www.url.com"
+ body: " " \
+ "click me " \
+ "http://www.url.com"
visit community_topic_path(community, topic)
@@ -716,7 +718,9 @@ describe "Commenting topics from budget investments" do
community = investment.community
topic = create(:topic, community: community)
create :comment, commentable: topic,
- body: " click me http://www.url.com"
+ body: " " \
+ "click me " \
+ "http://www.url.com"
visit community_topic_path(community, topic)
diff --git a/spec/system/debates_spec.rb b/spec/system/debates_spec.rb
index 71febb1e9..4f981e0fb 100644
--- a/spec/system/debates_spec.rb
+++ b/spec/system/debates_spec.rb
@@ -295,7 +295,9 @@ describe "Debates" do
scenario "JS injection is prevented but autolinking is respected", :no_js do
author = create(:user)
- js_injection_string = " click me http://example.org"
+ js_injection_string = " " \
+ "click me " \
+ "http://example.org"
login_as(author)
visit new_debate_path
@@ -673,10 +675,19 @@ describe "Debates" do
create(:debate, title: "First debate has 1 vote", cached_votes_up: 1)
create(:debate, title: "Second debate has 2 votes", cached_votes_up: 2)
create(:debate, title: "Third debate has 3 votes", cached_votes_up: 3)
- create(:debate, title: "This one has 4 votes", description: "This is the fourth debate", cached_votes_up: 4)
+ create(:debate,
+ title: "This one has 4 votes",
+ description: "This is the fourth debate",
+ cached_votes_up: 4)
create(:debate, title: "Fifth debate has 5 votes", cached_votes_up: 5)
- create(:debate, title: "Sixth debate has 6 votes", description: "This is the sixth debate", cached_votes_up: 6)
- create(:debate, title: "This has seven votes, and is not suggest", description: "This is the seven", cached_votes_up: 7)
+ create(:debate,
+ title: "Sixth debate has 6 votes",
+ description: "This is the sixth debate",
+ cached_votes_up: 6)
+ create(:debate,
+ title: "This has seven votes, and is not suggest",
+ description: "This is the seven",
+ cached_votes_up: 7)
login_as(create(:user))
visit new_debate_path
diff --git a/spec/system/emails_spec.rb b/spec/system/emails_spec.rb
index 38f1ea940..5d488053f 100644
--- a/spec/system/emails_spec.rb
+++ b/spec/system/emails_spec.rb
@@ -386,8 +386,9 @@ describe "Emails" do
expect(page).to have_content "Dossier updated"
email = open_last_email
- expect(email).to have_subject("Your investment project '#{investment.code}' has been marked as unfeasible")
- expect(email).to deliver_to(investment.author.email)
+ expect(email).to have_subject "Your investment project '#{investment.code}' " \
+ "has been marked as unfeasible"
+ expect(email).to deliver_to investment.author.email
expect(email).to have_body_text "This is not legal as stated in Article 34.9"
end
diff --git a/spec/system/legislation/draft_versions_spec.rb b/spec/system/legislation/draft_versions_spec.rb
index b306c0207..745494f5d 100644
--- a/spec/system/legislation/draft_versions_spec.rb
+++ b/spec/system/legislation/draft_versions_spec.rb
@@ -93,8 +93,12 @@ describe "Legislation Draft Versions" do
context "for final versions" do
it "does not show the comments panel" do
- final_version = create(:legislation_draft_version, process: process, title: "Final version",
- body: "Final body", status: "published", final_version: true)
+ final_version = create(:legislation_draft_version,
+ process: process,
+ title: "Final version",
+ body: "Final body",
+ status: "published",
+ final_version: true)
visit legislation_process_draft_version_path(process, final_version)
@@ -213,10 +217,17 @@ describe "Legislation Draft Versions" do
end
scenario "View annotations and comments" do
- annotation1 = create(:legislation_annotation, draft_version: draft_version, text: "my annotation",
- ranges: [{ "start" => "/p[1]", "startOffset" => 5, "end" => "/p[1]", "endOffset" => 10 }])
- create(:legislation_annotation, draft_version: draft_version, text: "my other annotation",
- ranges: [{ "start" => "/p[1]", "startOffset" => 12, "end" => "/p[1]", "endOffset" => 19 }])
+ annotation1 = create(:legislation_annotation,
+ draft_version: draft_version,
+ text: "my annotation",
+ ranges: [{ "start" => "/p[1]",
+ "startOffset" => 5,
+ "end" => "/p[1]",
+ "endOffset" => 10 }])
+ create(:legislation_annotation,
+ draft_version: draft_version,
+ text: "my other annotation",
+ ranges: [{ "start" => "/p[1]", "startOffset" => 12, "end" => "/p[1]", "endOffset" => 19 }])
comment = create(:comment, commentable: annotation1)
visit legislation_process_draft_version_path(draft_version.process, draft_version)
@@ -231,8 +242,10 @@ describe "Legislation Draft Versions" do
end
scenario "Publish new comment for an annotation from comments box" do
- create(:legislation_annotation, draft_version: draft_version, text: "my annotation",
- ranges: [{ "start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11 }])
+ create(:legislation_annotation,
+ draft_version: draft_version,
+ text: "my annotation",
+ ranges: [{ "start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11 }])
visit legislation_process_draft_version_path(draft_version.process, draft_version)
@@ -306,10 +319,14 @@ describe "Legislation Draft Versions" do
before { login_as user }
scenario "View annotations and comments in an included range" do
- create(:legislation_annotation, draft_version: draft_version, text: "my annotation",
- ranges: [{ "start" => "/p[1]", "startOffset" => 1, "end" => "/p[1]", "endOffset" => 5 }])
- create(:legislation_annotation, draft_version: draft_version, text: "my other annotation",
- ranges: [{ "start" => "/p[1]", "startOffset" => 1, "end" => "/p[1]", "endOffset" => 10 }])
+ create(:legislation_annotation,
+ draft_version: draft_version,
+ text: "my annotation",
+ ranges: [{ "start" => "/p[1]", "startOffset" => 1, "end" => "/p[1]", "endOffset" => 5 }])
+ create(:legislation_annotation,
+ draft_version: draft_version,
+ text: "my other annotation",
+ ranges: [{ "start" => "/p[1]", "startOffset" => 1, "end" => "/p[1]", "endOffset" => 10 }])
visit legislation_process_draft_version_path(draft_version.process, draft_version)
@@ -328,10 +345,16 @@ describe "Legislation Draft Versions" do
let(:draft_version) { create(:legislation_draft_version, :published) }
before do
- create(:legislation_annotation, draft_version: draft_version, text: "my annotation", quote: "ipsum",
- ranges: [{ "start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11 }])
- create(:legislation_annotation, draft_version: draft_version, text: "my other annotation", quote: "audiam",
- ranges: [{ "start" => "/p[3]", "startOffset" => 6, "end" => "/p[3]", "endOffset" => 11 }])
+ create(:legislation_annotation,
+ draft_version: draft_version,
+ text: "my annotation",
+ quote: "ipsum",
+ ranges: [{ "start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11 }])
+ create(:legislation_annotation,
+ draft_version: draft_version,
+ text: "my other annotation",
+ quote: "audiam",
+ ranges: [{ "start" => "/p[3]", "startOffset" => 6, "end" => "/p[3]", "endOffset" => 11 }])
end
scenario "See all annotations for a draft version" do
@@ -347,10 +370,14 @@ describe "Legislation Draft Versions" do
let(:current) { create(:legislation_draft_version, :published, process: process, title: "Current") }
before do
- create(:legislation_annotation, draft_version: original, quote: "quote for version 1",
- ranges: [{ "start" => "/p[1]", "startOffset" => 11, "end" => "/p[1]", "endOffset" => 30 }])
- create(:legislation_annotation, draft_version: current, quote: "quote for version 2",
- ranges: [{ "start" => "/p[1]", "startOffset" => 11, "end" => "/p[1]", "endOffset" => 30 }])
+ create(:legislation_annotation,
+ draft_version: original,
+ quote: "quote for version 1",
+ ranges: [{ "start" => "/p[1]", "startOffset" => 11, "end" => "/p[1]", "endOffset" => 30 }])
+ create(:legislation_annotation,
+ draft_version: current,
+ quote: "quote for version 2",
+ ranges: [{ "start" => "/p[1]", "startOffset" => 11, "end" => "/p[1]", "endOffset" => 30 }])
end
scenario "without js", :no_js do
@@ -380,13 +407,22 @@ describe "Legislation Draft Versions" do
let(:draft_version) { create(:legislation_draft_version, :published) }
before do
- create(:legislation_annotation, draft_version: draft_version, text: "my annotation", quote: "ipsum",
- ranges: [{ "start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11 }])
+ create(:legislation_annotation,
+ draft_version: draft_version,
+ text: "my annotation",
+ quote: "ipsum",
+ ranges: [{ "start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11 }])
end
scenario "See one annotation with replies for a draft version" do
- annotation = create(:legislation_annotation, draft_version: draft_version, text: "my other annotation", quote: "audiam",
- ranges: [{ "start" => "/p[3]", "startOffset" => 6, "end" => "/p[3]", "endOffset" => 11 }])
+ annotation = create(:legislation_annotation,
+ draft_version: draft_version,
+ text: "my other annotation",
+ quote: "audiam",
+ ranges: [{ "start" => "/p[3]",
+ "startOffset" => 6,
+ "end" => "/p[3]",
+ "endOffset" => 11 }])
visit polymorphic_path(annotation)
diff --git a/spec/system/legislation/processes_spec.rb b/spec/system/legislation/processes_spec.rb
index 6540ae3e5..5a3bee659 100644
--- a/spec/system/legislation/processes_spec.rb
+++ b/spec/system/legislation/processes_spec.rb
@@ -4,8 +4,10 @@ describe "Legislation" do
let!(:administrator) { create(:administrator).user }
shared_examples "not published permissions" do |path|
- let(:not_published_process) { create(:legislation_process, :not_published, title: "Process not published") }
let!(:not_permission_message) { "You do not have permission to carry out the action" }
+ let(:not_published_process) do
+ create(:legislation_process, :not_published, title: "Process not published")
+ end
it "is forbidden for a normal user" do
visit send(path, not_published_process)
@@ -276,7 +278,9 @@ describe "Legislation" do
context "debate phase" do
scenario "not open", :with_frozen_time do
- process = create(:legislation_process, debate_start_date: Date.current + 1.day, debate_end_date: Date.current + 2.days)
+ process = create(:legislation_process,
+ debate_start_date: Date.current + 1.day,
+ debate_end_date: Date.current + 2.days)
visit legislation_process_path(process)
@@ -284,7 +288,9 @@ describe "Legislation" do
end
scenario "open without questions" do
- process = create(:legislation_process, debate_start_date: Date.current - 1.day, debate_end_date: Date.current + 2.days)
+ process = create(:legislation_process,
+ debate_start_date: Date.current - 1.day,
+ debate_end_date: Date.current + 2.days)
visit legislation_process_path(process)
@@ -292,7 +298,9 @@ describe "Legislation" do
end
scenario "open with questions" do
- process = create(:legislation_process, debate_start_date: Date.current - 1.day, debate_end_date: Date.current + 2.days)
+ process = create(:legislation_process,
+ debate_start_date: Date.current - 1.day,
+ debate_end_date: Date.current + 2.days)
create(:legislation_question, process: process, title: "Question 1")
create(:legislation_question, process: process, title: "Question 2")
@@ -328,7 +336,9 @@ describe "Legislation" do
context "allegations phase" do
scenario "not open", :with_frozen_time do
- process = create(:legislation_process, allegations_start_date: Date.current + 1.day, allegations_end_date: Date.current + 2.days)
+ process = create(:legislation_process,
+ allegations_start_date: Date.current + 1.day,
+ allegations_end_date: Date.current + 2.days)
visit allegations_legislation_process_path(process)
@@ -336,7 +346,9 @@ describe "Legislation" do
end
scenario "open" do
- process = create(:legislation_process, allegations_start_date: Date.current - 1.day, allegations_end_date: Date.current + 2.days)
+ process = create(:legislation_process,
+ allegations_start_date: Date.current - 1.day,
+ allegations_end_date: Date.current + 2.days)
visit allegations_legislation_process_path(process)
diff --git a/spec/system/legislation/summary_spec.rb b/spec/system/legislation/summary_spec.rb
index 37618b9e1..36c9ffe28 100644
--- a/spec/system/legislation/summary_spec.rb
+++ b/spec/system/legislation/summary_spec.rb
@@ -123,12 +123,16 @@ describe "Legislation" do
before do
user = create(:user, :level_two)
- draft_version_1 = create(:legislation_draft_version, process: process,
- title: "Version 1", body: "Body of the first version",
- status: "published")
- draft_version_2 = create(:legislation_draft_version, process: process,
- title: "Version 2", body: "Body of the second version and that's it all of it",
- status: "published")
+ draft_version_1 = create(:legislation_draft_version,
+ process: process,
+ title: "Version 1",
+ body: "Body of the first version",
+ status: "published")
+ draft_version_2 = create(:legislation_draft_version,
+ process: process,
+ title: "Version 2",
+ body: "Body of the second version and that's it all of it",
+ status: "published")
annotation0 = create(:legislation_annotation,
draft_version: draft_version_1, text: "my annotation123",
ranges: annotation_ranges(5, 10))
diff --git a/spec/system/management/email_verifications_spec.rb b/spec/system/management/email_verifications_spec.rb
index 82e0fbe37..54f511a05 100644
--- a/spec/system/management/email_verifications_spec.rb
+++ b/spec/system/management/email_verifications_spec.rb
@@ -15,7 +15,8 @@ describe "EmailVerifications" do
fill_in "email_verification_email", with: user.email
click_button "Send verification email"
- expect(page).to have_content("In order to completely verify this user, it is necessary that the user clicks on a link")
+ expect(page).to have_content "In order to completely verify this user, " \
+ "it is necessary that the user clicks on a link"
user.reload
diff --git a/spec/system/management/managed_users_spec.rb b/spec/system/management/managed_users_spec.rb
index db1640796..75f375a29 100644
--- a/spec/system/management/managed_users_spec.rb
+++ b/spec/system/management/managed_users_spec.rb
@@ -70,7 +70,8 @@ describe "Managed User" do
fill_in "email_verification_email", with: user.email
click_button "Send verification email"
- expect(page).to have_content("In order to completely verify this user, it is necessary that the user clicks on a link")
+ expect(page).to have_content "In order to completely verify this user, " \
+ "it is necessary that the user clicks on a link"
within(".account-info") do
expect(page).to have_content "Identified as"
diff --git a/spec/system/moderation/comments_spec.rb b/spec/system/moderation/comments_spec.rb
index 294ba3598..0c980b247 100644
--- a/spec/system/moderation/comments_spec.rb
+++ b/spec/system/moderation/comments_spec.rb
@@ -211,8 +211,14 @@ describe "Moderate comments" do
end
scenario "sorting comments" do
- flagged_comment = create(:comment, body: "Flagged comment", created_at: 1.day.ago, flags_count: 5)
- flagged_new_comment = create(:comment, body: "Flagged new comment", created_at: 12.hours.ago, flags_count: 3)
+ flagged_comment = create(:comment,
+ body: "Flagged comment",
+ created_at: 1.day.ago,
+ flags_count: 5)
+ flagged_new_comment = create(:comment,
+ body: "Flagged new comment",
+ created_at: 12.hours.ago,
+ flags_count: 3)
newer_comment = create(:comment, body: "Newer comment", created_at: Time.current)
visit moderation_comments_path(order: "newest")
diff --git a/spec/system/moderation/debates_spec.rb b/spec/system/moderation/debates_spec.rb
index 092476220..ba64470dd 100644
--- a/spec/system/moderation/debates_spec.rb
+++ b/spec/system/moderation/debates_spec.rb
@@ -180,8 +180,14 @@ describe "Moderate debates" do
end
scenario "sorting debates" do
- flagged_debate = create(:debate, title: "Flagged debate", created_at: 1.day.ago, flags_count: 5)
- flagged_new_debate = create(:debate, title: "Flagged new debate", created_at: 12.hours.ago, flags_count: 3)
+ flagged_debate = create(:debate,
+ title: "Flagged debate",
+ created_at: 1.day.ago,
+ flags_count: 5)
+ flagged_new_debate = create(:debate,
+ title: "Flagged new debate",
+ created_at: 12.hours.ago,
+ flags_count: 3)
newer_debate = create(:debate, title: "Newer debate", created_at: Time.current)
visit moderation_debates_path(order: "created_at")
diff --git a/spec/system/moderation/proposal_notifications_spec.rb b/spec/system/moderation/proposal_notifications_spec.rb
index 9b2ee8b83..f609991d0 100644
--- a/spec/system/moderation/proposal_notifications_spec.rb
+++ b/spec/system/moderation/proposal_notifications_spec.rb
@@ -4,7 +4,9 @@ describe "Moderate proposal notifications" do
scenario "Hide" do
citizen = create(:user)
proposal = create(:proposal)
- proposal_notification = create(:proposal_notification, proposal: proposal, created_at: Date.current - 4.days)
+ proposal_notification = create(:proposal_notification,
+ proposal: proposal,
+ created_at: Date.current - 4.days)
moderator = create(:moderator)
login_as(moderator.user)
@@ -27,7 +29,9 @@ describe "Moderate proposal notifications" do
scenario "Can not hide own proposal notification" do
moderator = create(:moderator)
proposal = create(:proposal, author: moderator.user)
- proposal_notification = create(:proposal_notification, proposal: proposal, created_at: Date.current - 4.days)
+ proposal_notification = create(:proposal_notification,
+ proposal: proposal,
+ created_at: Date.current - 4.days)
login_as(moderator.user)
visit proposal_path(proposal)
@@ -188,10 +192,21 @@ describe "Moderate proposal notifications" do
end
scenario "sorting proposal notifications" do
- moderated_notification = create(:proposal_notification, :moderated, title: "Moderated notification", created_at: 1.day.ago)
- moderated_new_notification = create(:proposal_notification, :moderated, title: "Moderated new notification", created_at: 12.hours.ago)
- newer_notification = create(:proposal_notification, title: "Newer notification", created_at: Time.current)
- old_moderated_notification = create(:proposal_notification, :moderated, title: "Older notification", created_at: 2.days.ago)
+ moderated_notification = create(:proposal_notification,
+ :moderated,
+ title: "Moderated notification",
+ created_at: 1.day.ago)
+ moderated_new_notification = create(:proposal_notification,
+ :moderated,
+ title: "Moderated new notification",
+ created_at: 12.hours.ago)
+ newer_notification = create(:proposal_notification,
+ title: "Newer notification",
+ created_at: Time.current)
+ old_moderated_notification = create(:proposal_notification,
+ :moderated,
+ title: "Older notification",
+ created_at: 2.days.ago)
visit moderation_proposal_notifications_path(filter: "all", order: "created_at")
diff --git a/spec/system/moderation/proposals_spec.rb b/spec/system/moderation/proposals_spec.rb
index 8bbc739cc..8be434b17 100644
--- a/spec/system/moderation/proposals_spec.rb
+++ b/spec/system/moderation/proposals_spec.rb
@@ -179,8 +179,14 @@ describe "Moderate proposals" do
end
scenario "sorting proposals" do
- flagged_proposal = create(:proposal, title: "Flagged proposal", created_at: 1.day.ago, flags_count: 5)
- flagged_new_proposal = create(:proposal, title: "Flagged new proposal", created_at: 12.hours.ago, flags_count: 3)
+ flagged_proposal = create(:proposal,
+ title: "Flagged proposal",
+ created_at: 1.day.ago,
+ flags_count: 5)
+ flagged_new_proposal = create(:proposal,
+ title: "Flagged new proposal",
+ created_at: 12.hours.ago,
+ flags_count: 3)
newer_proposal = create(:proposal, title: "Newer proposal", created_at: Time.current)
visit moderation_proposals_path(order: "created_at")
diff --git a/spec/system/official_positions_spec.rb b/spec/system/official_positions_spec.rb
index 7fad3f9d7..8ab484380 100644
--- a/spec/system/official_positions_spec.rb
+++ b/spec/system/official_positions_spec.rb
@@ -2,7 +2,9 @@ require "rails_helper"
describe "Official positions" do
context "Badge" do
- let(:user1) { create(:user, official_level: 1, official_position: "Employee", official_position_badge: true) }
+ let(:user1) do
+ create(:user, official_level: 1, official_position: "Employee", official_position_badge: true)
+ end
let(:user2) { create(:user, official_level: 0, official_position: "") }
scenario "Comments" do
diff --git a/spec/system/officing/ballot_sheets_spec.rb b/spec/system/officing/ballot_sheets_spec.rb
index b6d50acb4..6f9a26f58 100644
--- a/spec/system/officing/ballot_sheets_spec.rb
+++ b/spec/system/officing/ballot_sheets_spec.rb
@@ -23,7 +23,8 @@ describe "Officing ballot sheets" do
within("tr", text: "Latest budget poll") { click_link "Add results" }
select "The only booth", from: "Booth"
- fill_in "CSV data", with: "#{investments[0..1].map(&:id).join(",")};#{investments[1..2].map(&:id).join(",")}"
+ fill_in "CSV data",
+ with: "#{investments[0..1].map(&:id).join(",")};#{investments[1..2].map(&:id).join(",")}"
click_button "Save"
expect(page).to have_content "Creation date"
diff --git a/spec/system/officing/results_spec.rb b/spec/system/officing/results_spec.rb
index 7fa0d8926..8f65e714c 100644
--- a/spec/system/officing/results_spec.rb
+++ b/spec/system/officing/results_spec.rb
@@ -91,7 +91,9 @@ describe "Officing Results", :with_frozen_time do
amount: 7777
)
- visit officing_poll_results_path(poll, date: I18n.l(partial_result.date), booth_assignment_id: partial_result.booth_assignment_id)
+ visit officing_poll_results_path(poll,
+ date: I18n.l(partial_result.date),
+ booth_assignment_id: partial_result.booth_assignment_id)
within("#question_#{question_1.id}_0_result") { expect(page).to have_content("7777") }
diff --git a/spec/system/officing/voters_spec.rb b/spec/system/officing/voters_spec.rb
index 4123602d9..63143123d 100644
--- a/spec/system/officing/voters_spec.rb
+++ b/spec/system/officing/voters_spec.rb
@@ -68,7 +68,10 @@ describe "Voters" do
end
scenario "Had already verified his residence, but is not level 2 yet" do
- user = create(:user, residence_verified_at: Time.current, document_type: "1", document_number: "12345678Z")
+ user = create(:user,
+ residence_verified_at: Time.current,
+ document_type: "1",
+ document_number: "12345678Z")
expect(user).not_to be_level_two_verified
visit root_path
diff --git a/spec/system/officing_spec.rb b/spec/system/officing_spec.rb
index c48bafb48..78a2fe18a 100644
--- a/spec/system/officing_spec.rb
+++ b/spec/system/officing_spec.rb
@@ -137,7 +137,11 @@ describe "Poll Officing" do
expect(page).to have_content "Document verified with Census"
click_button "Confirm vote"
expect(page).to have_content "Vote introduced!"
- expect(Poll::Voter.where(document_number: "12345678Z", poll_id: poll, origin: "booth", officer_id: officer1).count).to be(1)
+ expect(Poll::Voter.where(document_number: "12345678Z",
+ poll_id: poll,
+ origin: "booth",
+ officer_id: officer1)
+ .count).to be(1)
visit final_officing_polls_path
expect(page).to have_content("Polls ready for final recounting")
@@ -156,7 +160,11 @@ describe "Poll Officing" do
expect(page).to have_content "Document verified with Census"
click_button "Confirm vote"
expect(page).to have_content "Vote introduced!"
- expect(Poll::Voter.where(document_number: "12345678Y", poll_id: poll, origin: "booth", officer_id: officer2).count).to be(1)
+ expect(Poll::Voter.where(document_number: "12345678Y",
+ poll_id: poll,
+ origin: "booth",
+ officer_id: officer2)
+ .count).to be(1)
visit final_officing_polls_path
expect(page).to have_content("Polls ready for final recounting")
diff --git a/spec/system/polls/polls_spec.rb b/spec/system/polls/polls_spec.rb
index 11e13f440..6016c92bf 100644
--- a/spec/system/polls/polls_spec.rb
+++ b/spec/system/polls/polls_spec.rb
@@ -337,7 +337,8 @@ describe "Polls" do
login_as user
visit poll_path(poll)
- expect(page).to have_content "You have already participated in a physical booth. You can not participate again."
+ expect(page).to have_content "You have already participated in a physical booth. " \
+ "You can not participate again."
within("#poll_question_#{question.id}_answers") do
expect(page).to have_content("Yes")
diff --git a/spec/system/polls/voter_spec.rb b/spec/system/polls/voter_spec.rb
index 46086b2e5..640670524 100644
--- a/spec/system/polls/voter_spec.rb
+++ b/spec/system/polls/voter_spec.rb
@@ -68,8 +68,9 @@ describe "Voter" do
expect(page).to have_link("No", href: verification_path)
end
- expect(page).to have_content("You must verify your account in order to answer")
- expect(page).not_to have_content("You have already participated in this poll. If you vote again it will be overwritten")
+ expect(page).to have_content "You must verify your account in order to answer"
+ expect(page).not_to have_content "You have already participated in this poll. " \
+ "If you vote again it will be overwritten"
end
scenario "Voting in booth" do
@@ -173,7 +174,8 @@ describe "Voter" do
within("#poll_question_#{question.id}_answers") do
expect(page).not_to have_button("Yes")
end
- expect(page).to have_content "You have already participated in a physical booth. You can not participate again."
+ expect(page).to have_content "You have already participated in a physical booth. " \
+ "You can not participate again."
expect(Poll::Voter.count).to eq(1)
visit root_path
@@ -213,7 +215,8 @@ describe "Voter" do
expect(page).not_to have_button("Yes")
end
- expect(page).to have_content "You have already participated in a physical booth. You can not participate again."
+ expect(page).to have_content "You have already participated in a physical booth. " \
+ "You can not participate again."
expect(Poll::Voter.count).to eq(1)
visit root_path
diff --git a/spec/system/proposals_spec.rb b/spec/system/proposals_spec.rb
index 5969d856a..6bd950fef 100644
--- a/spec/system/proposals_spec.rb
+++ b/spec/system/proposals_spec.rb
@@ -505,7 +505,9 @@ describe "Proposals" do
scenario "JS injection is prevented but autolinking is respected", :no_js do
author = create(:user)
- js_injection_string = " click me http://example.org"
+ js_injection_string = " " \
+ "click me " \
+ "http://example.org"
login_as(author)
visit new_proposal_path
diff --git a/spec/system/sdg/goals_spec.rb b/spec/system/sdg/goals_spec.rb
index 898e1f52e..5d083cc91 100644
--- a/spec/system/sdg/goals_spec.rb
+++ b/spec/system/sdg/goals_spec.rb
@@ -166,7 +166,8 @@ describe "SDG Goals" do
click_link "Local targets"
- expect(page).not_to have_content "15.1 By 2020, ensure the conservation, restoration and sustainable use"
+ expect(page).not_to have_content "15.1 By 2020, ensure the conservation, " \
+ "restoration and sustainable use"
expect(page).to have_content "SDG local target sample text"
end
end
diff --git a/spec/system/tags/budget_investments_spec.rb b/spec/system/tags/budget_investments_spec.rb
index b970f59e1..8233dbcfb 100644
--- a/spec/system/tags/budget_investments_spec.rb
+++ b/spec/system/tags/budget_investments_spec.rb
@@ -53,7 +53,9 @@ describe "Tags" do
end
scenario "Show" do
- investment = create(:budget_investment, heading: heading, tag_list: "#{tag_medio_ambiente.name}, #{tag_economia.name}")
+ investment = create(:budget_investment,
+ heading: heading,
+ tag_list: "#{tag_medio_ambiente.name}, #{tag_economia.name}")
visit budget_investment_path(budget, investment)
@@ -157,7 +159,8 @@ describe "Tags" do
fill_in_ckeditor "Description", with: "I want to live in a high tower over the clouds"
check "budget_investment_terms_of_service"
- fill_in "budget_investment_tag_list", with: "Impuestos, Economía, Hacienda, Sanidad, Educación, Política, Igualdad"
+ fill_in "budget_investment_tag_list",
+ with: "Impuestos, Economía, Hacienda, Sanidad, Educación, Política, Igualdad"
click_button "Create Investment"
diff --git a/spec/system/topics_spec.rb b/spec/system/topics_spec.rb
index 45e33492b..f2704f848 100644
--- a/spec/system/topics_spec.rb
+++ b/spec/system/topics_spec.rb
@@ -42,8 +42,13 @@ describe "Topics" do
expect(page).to have_content "Title"
expect(page).to have_content "Initial text"
expect(page).to have_content "Recommendations to create a topic"
- expect(page).to have_content "Do not write the topic title or whole sentences in capital letters. On the internet that is considered shouting. And no one likes to be yelled at."
- expect(page).to have_content "Any topic or comment that implies an illegal action will be eliminated, also those that intend to sabotage the spaces of the subject, everything else is allowed."
+ expect(page).to have_content "Do not write the topic title or whole sentences in " \
+ "capital letters. On the internet that is considered " \
+ "shouting. And no one likes to be yelled at."
+ expect(page).to have_content "Any topic or comment that implies an illegal action " \
+ "will be eliminated, also those that intend to " \
+ "sabotage the spaces of the subject, everything else " \
+ "is allowed."
expect(page).to have_content "Enjoy this space, the voices that fill it, it's yours too."
expect(page).to have_button("Create topic")
end
diff --git a/spec/system/users_auth_spec.rb b/spec/system/users_auth_spec.rb
index 4fb0ed6e3..f5934515a 100644
--- a/spec/system/users_auth_spec.rb
+++ b/spec/system/users_auth_spec.rb
@@ -4,7 +4,8 @@ describe "Users" do
context "Regular authentication" do
context "Sign up" do
scenario "Success" do
- message = "You have been sent a message containing a verification link. Please click on this link to activate your account."
+ message = "You have been sent a message containing a verification link. " \
+ "Please click on this link to activate your account."
visit "/"
click_link "Register"
@@ -32,7 +33,8 @@ describe "Users" do
end
scenario "User already confirmed email with the token" do
- message = "You have been sent a message containing a verification link. Please click on this link to activate your account."
+ message = "You have been sent a message containing a verification link. " \
+ "Please click on this link to activate your account."
visit "/"
click_link "Register"
@@ -224,7 +226,9 @@ describe "Users" do
context "Twitter" do
let(:twitter_hash) { { uid: "12345", info: { name: "manuela" }} }
- let(:twitter_hash_with_email) { { uid: "12345", info: { name: "manuela", email: "manuelacarmena@example.com" }} }
+ let(:twitter_hash_with_email) do
+ { uid: "12345", info: { name: "manuela", email: "manuelacarmena@example.com" }}
+ end
let(:twitter_hash_with_verified_email) do
{
uid: "12345",
@@ -264,7 +268,8 @@ describe "Users" do
click_link "Sign up with Twitter"
expect(page).to have_current_path(new_user_session_path)
- expect(page).to have_content "To continue, please click on the confirmation link that we have sent you via email"
+ expect(page).to have_content "To continue, please click on the confirmation " \
+ "link that we have sent you via email"
confirm_email
expect(page).to have_content "Your account has been confirmed"
@@ -294,7 +299,8 @@ describe "Users" do
fill_in "Email", with: "manueladelascarmenas@example.com"
click_button "Register"
- expect(page).to have_content "To continue, please click on the confirmation link that we have sent you via email"
+ expect(page).to have_content "To continue, please click on the confirmation " \
+ "link that we have sent you via email"
confirm_email
expect(page).to have_content "Your account has been confirmed"
@@ -393,7 +399,8 @@ describe "Users" do
fill_in "Username", with: "manuela2"
click_button "Register"
- expect(page).to have_content "To continue, please click on the confirmation link that we have sent you via email"
+ expect(page).to have_content "To continue, please click on the confirmation " \
+ "link that we have sent you via email"
confirm_email
@@ -429,7 +436,8 @@ describe "Users" do
fill_in "Email", with: "somethingelse@example.com"
click_button "Register"
- expect(page).to have_content "To continue, please click on the confirmation link that we have sent you via email"
+ expect(page).to have_content "To continue, please click on the confirmation " \
+ "link that we have sent you via email"
confirm_email
expect(page).to have_content "Your account has been confirmed"
@@ -462,7 +470,8 @@ describe "Users" do
fill_in "Email", with: "somethingelse@example.com"
click_button "Register"
- expect(page).to have_content "To continue, please click on the confirmation link that we have sent you via email"
+ expect(page).to have_content "To continue, please click on the confirmation " \
+ "link that we have sent you via email"
confirm_email
expect(page).to have_content "Your account has been confirmed"
@@ -529,7 +538,8 @@ describe "Users" do
click_link "Sign up with Wordpress"
expect(page).to have_current_path(new_user_session_path)
- expect(page).to have_content "To continue, please click on the confirmation link that we have sent you via email"
+ expect(page).to have_content "To continue, please click on the confirmation " \
+ "link that we have sent you via email"
confirm_email
expect(page).to have_content "Your account has been confirmed"
@@ -569,7 +579,8 @@ describe "Users" do
click_button "Register"
expect(page).to have_current_path(new_user_session_path)
- expect(page).to have_content "To continue, please click on the confirmation link that we have sent you via email"
+ expect(page).to have_content "To continue, please click on the confirmation " \
+ "link that we have sent you via email"
confirm_email
expect(page).to have_content "Your account has been confirmed"
diff --git a/spec/system/verification/letter_spec.rb b/spec/system/verification/letter_spec.rb
index f75a64669..5f5d61b4b 100644
--- a/spec/system/verification/letter_spec.rb
+++ b/spec/system/verification/letter_spec.rb
@@ -10,8 +10,10 @@ describe "Verify Letter" do
click_link "Send me a letter with the code"
- expect(page).to have_content "Thank you for requesting your maximum security code (only required for the final votes). In a few days" \
- " we will send it to the address featuring in the data we have on file."
+ expect(page).to have_content "Thank you for requesting your maximum security code " \
+ "(only required for the final votes). In a few days " \
+ "we will send it to the address featuring in the data " \
+ "we have on file."
user.reload
diff --git a/spec/system/verification/level_three_verification_spec.rb b/spec/system/verification/level_three_verification_spec.rb
index 0d2a30749..060688b84 100644
--- a/spec/system/verification/level_three_verification_spec.rb
+++ b/spec/system/verification/level_three_verification_spec.rb
@@ -87,7 +87,9 @@ describe "Level three verification" do
click_link "Send me a letter with the code"
- expect(page).to have_content "Thank you for requesting your maximum security code (only required for the final votes)." \
- " In a few days we will send it to the address featuring in the data we have on file."
+ expect(page).to have_content "Thank you for requesting your maximum security code " \
+ "(only required for the final votes). In a few days " \
+ "we will send it to the address featuring in the data " \
+ "we have on file."
end
end
diff --git a/spec/system/verification/verification_path_spec.rb b/spec/system/verification/verification_path_spec.rb
index 56c953bfc..d3e826cac 100644
--- a/spec/system/verification/verification_path_spec.rb
+++ b/spec/system/verification/verification_path_spec.rb
@@ -41,7 +41,10 @@ describe "Verification path" do
end
scenario "User received a verification sms" do
- user = create(:user, residence_verified_at: Time.current, unconfirmed_phone: "666666666", sms_confirmation_code: "666")
+ user = create(:user,
+ residence_verified_at: Time.current,
+ unconfirmed_phone: "666666666",
+ sms_confirmation_code: "666")
login_as(user)
visit verification_path