Add and apply ArgumentAlignment rubocop rule

We're choosing the default `with_first_argument` style because it's the
one we use the most.
This commit is contained in:
Javi Martín
2023-07-01 17:37:58 +02:00
parent 32b1fc53e1
commit 629e208e9d
202 changed files with 907 additions and 830 deletions

View File

@@ -18,6 +18,9 @@ Bundler/OrderedGems:
Enabled: true Enabled: true
ConsiderPunctuation: true ConsiderPunctuation: true
Layout/ArgumentAlignment:
Enabled: true
Layout/ArrayAlignment: Layout/ArrayAlignment:
Enabled: true Enabled: true

View File

@@ -29,7 +29,8 @@
<%= enabled_cell(phase) %> <%= enabled_cell(phase) %>
</td> </td>
<td> <td>
<%= render Admin::TableActionsComponent.new(phase, <%= render Admin::TableActionsComponent.new(
phase,
actions: [:edit], actions: [:edit],
edit_path: edit_path(phase) edit_path: edit_path(phase)
) %> ) %>

View File

@@ -17,7 +17,8 @@
</td> </td>
<td> <td>
<% if officer.persisted? %> <% if officer.persisted? %>
<%= render Admin::TableActionsComponent.new(officer, <%= render Admin::TableActionsComponent.new(
officer,
actions: [:destroy], actions: [:destroy],
destroy_text: t("admin.poll_officers.officer.delete"), destroy_text: t("admin.poll_officers.officer.delete"),
destroy_options: { class: "destroy-officer-link" } destroy_options: { class: "destroy-officer-link" }

View File

@@ -1,5 +1,6 @@
<% if already_has_role? %> <% if already_has_role? %>
<%= render Admin::TableActionsComponent.new(record, <%= render Admin::TableActionsComponent.new(
record,
actions: actions, actions: actions,
destroy_options: { class: "destroy-role-link" } destroy_options: { class: "destroy-role-link" }
) %> ) %>

View File

@@ -13,7 +13,8 @@
<%= label_tag :status, t("budgets.executions.filters.status.label") %> <%= label_tag :status, t("budgets.executions.filters.status.label") %>
<%= select_tag :status, <%= select_tag :status,
options_from_collection_for_select(statuses, options_from_collection_for_select(statuses,
:id, lambda { |s| "#{s.name} (#{filters_select_counts(s.id)})" }, :id,
lambda { |s| "#{s.name} (#{filters_select_counts(s.id)})" },
params[:status]), params[:status]),
prompt: t("budgets.executions.filters.status.all", prompt: t("budgets.executions.filters.status.all",
count: budget.investments.winners.with_milestones.count) %> count: budget.investments.winners.with_milestones.count) %>

View File

@@ -10,8 +10,7 @@
<% elsif assigned_heading.present? %> <% elsif assigned_heading.present? %>
<p> <p>
<%= sanitize(t("budgets.investments.index.sidebar.different_heading_assigned", <%= sanitize(t("budgets.investments.index.sidebar.different_heading_assigned",
heading_link: heading_link(assigned_heading, budget) heading_link: heading_link(assigned_heading, budget))) %>
)) %>
<br> <br>
<small> <small>
<%= sanitize(t("budgets.investments.index.sidebar.change_ballot", <%= sanitize(t("budgets.investments.index.sidebar.change_ballot",

View File

@@ -12,7 +12,8 @@ class GraphqlController < ApplicationController
begin begin
raise GraphqlController::QueryStringError if query_string.nil? raise GraphqlController::QueryStringError if query_string.nil?
result = ConsulSchema.execute(query_string, result = ConsulSchema.execute(
query_string,
variables: prepare_variables, variables: prepare_variables,
context: {}, context: {},
operation_name: params[:operationName] operation_name: params[:operationName]

View File

@@ -62,8 +62,10 @@ class Poll < ApplicationRecord
end end
def self.overlaping_with(poll) def self.overlaping_with(poll)
where("? < ends_at and ? >= starts_at", poll.starts_at.beginning_of_day, where("? < ends_at and ? >= starts_at",
poll.ends_at.end_of_day).where.not(id: poll.id) poll.starts_at.beginning_of_day,
poll.ends_at.end_of_day)
.where.not(id: poll.id)
.where(related: poll.related) .where(related: poll.related)
end end

View File

@@ -1,5 +1,6 @@
<h2 class="inline-block"><%= t("admin.admin_notifications.index.section_title") %></h2> <h2 class="inline-block"><%= t("admin.admin_notifications.index.section_title") %></h2>
<%= link_to t("admin.admin_notifications.index.new_notification"), new_admin_admin_notification_path, <%= link_to t("admin.admin_notifications.index.new_notification"),
new_admin_admin_notification_path,
class: "button float-right" %> class: "button float-right" %>
<% if @admin_notifications.any? %> <% if @admin_notifications.any? %>

View File

@@ -1,5 +1,6 @@
<%= link_to t("admin.banners.index.create"), <%= link_to t("admin.banners.index.create"),
new_admin_banner_path, class: "button float-right" %> new_admin_banner_path,
class: "button float-right" %>
<h2 class="inline-block"><%= t("admin.banners.index.title") %></h2> <h2 class="inline-block"><%= t("admin.banners.index.title") %></h2>

View File

@@ -9,7 +9,8 @@
<% if @investments.any? %> <% if @investments.any? %>
<h3 class="inline-block"><%= page_entries_info @investments %></h3> <h3 class="inline-block"><%= page_entries_info @investments %></h3>
<%= render "admin/shared/columns_selector", <%= render "admin/shared/columns_selector",
cookie: "investments-columns", default: %w[id title supports admin valuator geozone feasibility price valuation_finished visible_to_valuators selected incompatible] %> cookie: "investments-columns",
default: %w[id title supports admin valuator geozone feasibility price valuation_finished visible_to_valuators selected incompatible] %>
<br> <br>
<%= render "filters_description", i18n_namespace: "admin.budget_investments.index" %> <%= render "filters_description", i18n_namespace: "admin.budget_investments.index" %>

View File

@@ -5,7 +5,8 @@
<%= f.label :action_type %> <%= f.label :action_type %>
<% ::Dashboard::Action.action_types.keys.each do |action_type_value| %> <% ::Dashboard::Action.action_types.keys.each do |action_type_value| %>
<span class="margin-right"> <span class="margin-right">
<%= f.radio_button :action_type, action_type_value, <%= f.radio_button :action_type,
action_type_value,
data: { toggle: "request_to_administrators short_description" } %> data: { toggle: "request_to_administrators short_description" } %>
</span> </span>
<% end %> <% end %>

View File

@@ -1,5 +1,6 @@
<%= link_to t("admin.dashboard.actions.index.create"), <%= link_to t("admin.dashboard.actions.index.create"),
new_admin_dashboard_action_path, class: "button success float-right" %> new_admin_dashboard_action_path,
class: "button success float-right" %>
<h2 class="inline-block"> <h2 class="inline-block">
<%= t("admin.dashboard.actions.index.title") %> <%= t("admin.dashboard.actions.index.title") %>

View File

@@ -25,7 +25,8 @@
</td> </td>
<td> <td>
<% unless task.executed_at? %> <% unless task.executed_at? %>
<%= render Admin::TableActionsComponent.new(task, <%= render Admin::TableActionsComponent.new(
task,
actions: [:edit], actions: [:edit],
edit_text: t("admin.dashboard.administrator_tasks.index.solve") edit_text: t("admin.dashboard.administrator_tasks.index.solve")
) %> ) %>

View File

@@ -29,7 +29,9 @@
<div class="js-add-fields-container"> <div class="js-add-fields-container">
<div class="small-12 medium-9 column"> <div class="small-12 medium-9 column">
<%= link_to_add_association t("admin.legislation.questions.form.add_option"), <%= link_to_add_association t("admin.legislation.questions.form.add_option"),
f, :question_options, class: "button hollow" %> f,
:question_options,
class: "button hollow" %>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -1,5 +1,6 @@
<h2 class="inline-block"><%= t("admin.newsletters.index.title") %></h2> <h2 class="inline-block"><%= t("admin.newsletters.index.title") %></h2>
<%= link_to t("admin.newsletters.index.new_newsletter"), new_admin_newsletter_path, <%= link_to t("admin.newsletters.index.new_newsletter"),
new_admin_newsletter_path,
class: "button float-right" %> class: "button float-right" %>
<% if @newsletters.any? %> <% if @newsletters.any? %>

View File

@@ -12,7 +12,8 @@
</td> </td>
<td> <td>
<% unless @poll.expired? %> <% unless @poll.expired? %>
<%= render Admin::TableActionsComponent.new(booth_assignment, <%= render Admin::TableActionsComponent.new(
booth_assignment,
actions: [:destroy], actions: [:destroy],
destroy_text: t("admin.booth_assignments.manage.actions.unassign"), destroy_text: t("admin.booth_assignments.manage.actions.unassign"),
destroy_confirmation: (booth_assignment.shifts? ? t("admin.poll_booth_assignments.alert.shifts") : ""), destroy_confirmation: (booth_assignment.shifts? ? t("admin.poll_booth_assignments.alert.shifts") : ""),

View File

@@ -7,7 +7,8 @@
<td class="text-center"><%= poll.sdg_target_list %></td> <td class="text-center"><%= poll.sdg_target_list %></td>
<% end %> <% end %>
<td> <td>
<%= render Admin::TableActionsComponent.new(poll, <%= render Admin::TableActionsComponent.new(
poll,
destroy_confirmation: t("admin.polls.destroy.alert") destroy_confirmation: t("admin.polls.destroy.alert")
) do |actions| %> ) do |actions| %>
<%= actions.action(:configure) %> <%= actions.action(:configure) %>

View File

@@ -17,7 +17,8 @@
<td><%= shift.officer_email %></td> <td><%= shift.officer_email %></td>
<td><%= t("admin.poll_shifts.#{shift.task}") %></td> <td><%= t("admin.poll_shifts.#{shift.task}") %></td>
<td> <td>
<%= render Admin::TableActionsComponent.new(shift, <%= render Admin::TableActionsComponent.new(
shift,
actions: [:destroy], actions: [:destroy],
destroy_text: t("admin.poll_shifts.new.remove_shift") destroy_text: t("admin.poll_shifts.new.remove_shift")
) %> ) %>

View File

@@ -93,7 +93,8 @@
<% if investment.should_show_price_explanation? %> <% if investment.should_show_price_explanation? %>
<div class="text-center" data-magellan> <div class="text-center" data-magellan>
<%= link_to t("budgets.investments.show.see_price_explanation"), <%= link_to t("budgets.investments.show.see_price_explanation"),
"#price_explanation", class: "small" %> "#price_explanation",
class: "small" %>
</div> </div>
<% end %> <% end %>
<% end %> <% end %>

View File

@@ -3,7 +3,8 @@
<% if can?(:create, Budget::Investment.new(budget: @budget)) %> <% if can?(:create, Budget::Investment.new(budget: @budget)) %>
<% if current_user && current_user.level_two_or_three_verified? %> <% if current_user && current_user.level_two_or_three_verified? %>
<%= link_to t("budgets.investments.index.sidebar.create"), <%= link_to t("budgets.investments.index.sidebar.create"),
new_budget_investment_path(budget_id: @budget.id), class: "button budget expanded" %> new_budget_investment_path(budget_id: @budget.id),
class: "button budget expanded" %>
<% else %> <% else %>
<div class="callout warning"> <div class="callout warning">
<%= sanitize(t("budgets.investments.index.sidebar.verified_only", <%= sanitize(t("budgets.investments.index.sidebar.verified_only",

View File

@@ -5,6 +5,7 @@
<p class="topic-info"> <p class="topic-info">
<%= t("communities.poll.take_part", <%= t("communities.poll.take_part",
from: l(poll.starts_at.to_date), to: l(poll.ends_at.to_date)) %> from: l(poll.starts_at.to_date),
to: l(poll.ends_at.to_date)) %>
</p> </p>
</div> </div>

View File

@@ -49,10 +49,10 @@
<tr> <tr>
<td style="padding-bottom: 12px; padding-top: 24px; text-align: center;"> <td style="padding-bottom: 12px; padding-top: 24px; text-align: center;">
<%= link_to progress_proposal_dashboard_url(@proposal), <%= link_to progress_proposal_dashboard_url(@proposal),
style: "font-family: 'Open Sans',arial,sans-serif; background: #3700fd; style: "font-family: 'Open Sans',arial,sans-serif; background: #3700fd;" \
border-radius: 6px; color: #fff !important; font-weight: bold; "border-radius: 6px; color: #fff !important; font-weight: bold;" \
padding: 17px 20px; text-align: center; text-decoration: none; "padding: 17px 20px; text-align: center; text-decoration: none;" \
font-size: 20px; min-width: 200px; display: inline-block;", "font-size: 20px; min-width: 200px; display: inline-block;",
target: "_blank" do %> target: "_blank" do %>
<%= t("mailers.new_actions_notification_on_published.dashboard_button") %> <%= t("mailers.new_actions_notification_on_published.dashboard_button") %>
<% end %> <% end %>

View File

@@ -4,9 +4,15 @@
&nbsp;|&nbsp; &nbsp;|&nbsp;
<% if debate.featured? %> <% if debate.featured? %>
<%= link_to t("admin.actions.unmark_featured").capitalize, unmark_featured_debate_path(debate), <%= link_to t("admin.actions.unmark_featured").capitalize, unmark_featured_debate_path(debate),
method: :put, data: { confirm: t("admin.actions.confirm_action", action: t("admin.actions.unmark_featured"), name: debate.title) } %> method: :put,
data: { confirm: t("admin.actions.confirm_action",
action: t("admin.actions.unmark_featured"),
name: debate.title) } %>
<% else %> <% else %>
<%= link_to t("admin.actions.mark_featured").capitalize, mark_featured_debate_path(debate), <%= link_to t("admin.actions.mark_featured").capitalize, mark_featured_debate_path(debate),
method: :put, data: { confirm: t("admin.actions.confirm_action", action: t("admin.actions.mark_featured"), name: debate.title) } %> method: :put,
data: { confirm: t("admin.actions.confirm_action",
action: t("admin.actions.mark_featured"),
name: debate.title) } %>
<% end %> <% end %>
<% end %> <% end %>

View File

@@ -10,7 +10,8 @@
<div class="callout primary"> <div class="callout primary">
<p> <p>
<%= sanitize(t("users.login_to_continue", <%= sanitize(t("users.login_to_continue",
signin: link_to_signin, signup: link_to_signup)) %> signin: link_to_signin,
signup: link_to_signup)) %>
</p> </p>
</div> </div>
<% elsif not @receiver.email_on_direct_message? %> <% elsif not @receiver.email_on_direct_message? %>

View File

@@ -28,10 +28,14 @@
<h2><%= t("layouts.application.ie_title") %></h2> <h2><%= t("layouts.application.ie_title") %></h2>
<p> <p>
<%= sanitize(t("layouts.application.ie", <%= sanitize(t("layouts.application.ie",
chrome: link_to( chrome: link_to(t("layouts.application.chrome"),
t("layouts.application.chrome"), "https://www.google.com/chrome/browser/desktop/", title: t("shared.target_blank"), target: "_blank"), "https://www.google.com/chrome/browser/desktop/",
firefox: link_to( title: t("shared.target_blank"),
t("layouts.application.firefox"), "https://www.mozilla.org/firefox", title: t("shared.target_blank"), target: "_blank") target: "_blank"),
firefox: link_to(t("layouts.application.firefox"),
"https://www.mozilla.org/firefox",
title: t("shared.target_blank"),
target: "_blank")
)) %> )) %>
</p> </p>
</div> </div>

View File

@@ -3,7 +3,8 @@
<div class="small-12 medium-9 column"> <div class="small-12 medium-9 column">
<% if banner_color? %> <% if banner_color? %>
<%= link_to t("shared.back"), legislation_processes_path, <%= link_to t("shared.back"),
legislation_processes_path,
class: "icon-angle-left", class: "icon-angle-left",
style: "color:#{process.font_color};" %> style: "color:#{process.font_color};" %>
<% else %> <% else %>

View File

@@ -12,7 +12,8 @@
<% else %> <% else %>
<p> <p>
<%= sanitize(t("annotator.help.text", <%= sanitize(t("annotator.help.text",
sign_in: link_to_signin, sign_up: link_to_signup)) %> sign_in: link_to_signin,
sign_up: link_to_signup)) %>
</p> </p>
<% end %> <% end %>

View File

@@ -14,7 +14,8 @@
<% elsif !user_signed_in? %> <% elsif !user_signed_in? %>
<div class="participation-not-allowed"> <div class="participation-not-allowed">
<%= sanitize(t("legislation.questions.participation.unauthenticated", <%= sanitize(t("legislation.questions.participation.unauthenticated",
signin: link_to_signin, signup: link_to_signup)) %> signin: link_to_signin,
signup: link_to_signup)) %>
</div> </div>
<% elsif !@process.debate_phase.open? %> <% elsif !@process.debate_phase.open? %>
<div class="participation-not-allowed"> <div class="participation-not-allowed">

View File

@@ -21,7 +21,8 @@
<p style="<%= css_for_mailer_text %>"> <p style="<%= css_for_mailer_text %>">
<%= sanitize( <%= sanitize(
t("mailers.budget_investment_created.follow", t("mailers.budget_investment_created.follow",
link: link_to(t("mailers.budget_investment_created.follow_link"), budgets_url, link: link_to(t("mailers.budget_investment_created.follow_link"),
budgets_url,
style: css_for_mailer_link) style: css_for_mailer_link)
), ),
attributes: %w[href style] attributes: %w[href style]

View File

@@ -1,12 +1,10 @@
<td style="<%= css_for_mailer_content %>"> <td style="<%= css_for_mailer_content %>">
<h1 style="<%= css_for_mailer_heading %>"> <h1 style="<%= css_for_mailer_heading %>">
<%= t("mailers.user_invite.title", <%= t("mailers.user_invite.title", org: Setting["org_name"]) %>
org: Setting["org_name"]) %>
</h1> </h1>
<p style="<%= css_for_mailer_text %>"> <p style="<%= css_for_mailer_text %>">
<%= t("mailers.user_invite.text", <%= t("mailers.user_invite.text", org: Setting["org_name"]) %>
org: Setting["org_name"]) %>
</p> </p>
<p style="text-align: center;"> <p style="text-align: center;">

View File

@@ -17,12 +17,14 @@
<% if notification.unread? %> <% if notification.unread? %>
<%= link_to t("notifications.notification.mark_as_read"), <%= link_to t("notifications.notification.mark_as_read"),
mark_as_read_notification_path(notification), mark_as_read_notification_path(notification),
method: :put, remote: true, method: :put,
remote: true,
class: "mark-notification small" %> class: "mark-notification small" %>
<% else %> <% else %>
<%= link_to t("notifications.notification.mark_as_unread"), <%= link_to t("notifications.notification.mark_as_unread"),
mark_as_unread_notification_path(notification), mark_as_unread_notification_path(notification),
method: :put, remote: true, method: :put,
remote: true,
class: "mark-notification small" %> class: "mark-notification small" %>
<% end %> <% end %>
</li> </li>

View File

@@ -5,5 +5,6 @@
<p><%= t("devise_views.organizations.registrations.success.instructions_3") %></p> <p><%= t("devise_views.organizations.registrations.success.instructions_3") %></p>
<p> <p>
<%= link_to t("devise_views.organizations.registrations.success.back_to_index"), <%= link_to t("devise_views.organizations.registrations.success.back_to_index"),
root_path, class: "button margin-top expanded" %> root_path,
class: "button margin-top expanded" %>
</p> </p>

View File

@@ -16,7 +16,8 @@
<%= render "shared/errors", resource: @proposal %> <%= render "shared/errors", resource: @proposal %>
<div class="row column"> <div class="row column">
<div class="small-12 medium-6 large-4 column"> <div class="small-12 medium-6 large-4 column">
<%= f.select :retired_reason, retire_proposals_options, <%= f.select :retired_reason,
retire_proposals_options,
include_blank: t("proposals.retire_form.retired_reason_blank") %> include_blank: t("proposals.retire_form.retired_reason_blank") %>
</div> </div>
</div> </div>
@@ -25,7 +26,8 @@
<%= f.translatable_fields do |translations_form| %> <%= f.translatable_fields do |translations_form| %>
<div class="small-12 medium-9 column float-left"> <div class="small-12 medium-9 column float-left">
<%= translations_form.text_area :retired_explanation, <%= translations_form.text_area :retired_explanation,
rows: 4, maxlength: 500, rows: 4,
maxlength: 500,
placeholder: t("proposals.retire_form.retired_explanation_placeholder") %> placeholder: t("proposals.retire_form.retired_explanation_placeholder") %>
</div> </div>
<% end %> <% end %>

View File

@@ -7,6 +7,7 @@
<% else %> <% else %>
<div class="callout primary"> <div class="callout primary">
<%= sanitize(t("community.show.create_first_community_topic.sub_first_theme", <%= sanitize(t("community.show.create_first_community_topic.sub_first_theme",
sign_in: link_to_signin, sign_up: link_to_signup)) %> sign_in: link_to_signin,
sign_up: link_to_signup)) %>
</div> </div>
<% end %> <% end %>

View File

@@ -2,7 +2,8 @@
<div class="row margin-bottom"> <div class="row margin-bottom">
<div class="small-12 medium-9 column"> <div class="small-12 medium-9 column">
<%= back_link_to community_path(@community), t("community.show.back", <%= back_link_to community_path(@community),
t("community.show.back",
community: community_text(@community), community: community_text(@community),
proposal: community_title(@community)) %> proposal: community_title(@community)) %>

View File

@@ -8,7 +8,8 @@
<p> <p>
<%= sanitize(t("devise_views.users.registrations.new.organization_signup", <%= sanitize(t("devise_views.users.registrations.new.organization_signup",
signup_link: link_to(t("devise_views.users.registrations.new.organization_signup_link"), new_organization_registration_path))) %> signup_link: link_to(t("devise_views.users.registrations.new.organization_signup_link"),
new_organization_registration_path))) %>
</p> </p>
<div class="row"> <div class="row">

View File

@@ -5,5 +5,6 @@
<p><%= t("devise_views.users.registrations.success.instructions_2") %></p> <p><%= t("devise_views.users.registrations.success.instructions_2") %></p>
<p> <p>
<%= link_to t("devise_views.users.registrations.success.back_to_index"), <%= link_to t("devise_views.users.registrations.success.back_to_index"),
root_path, class: "button margin-top expanded" %> root_path,
class: "button margin-top expanded" %>
</p> </p>

View File

@@ -21,7 +21,8 @@ RSpec.describe Legislation::Annotation, type: :model do
" ea. Per ne impedit iracundia neglegentur. Consetetur neglegentur eum ut, vis animal legimus inimicus id."\ " ea. Per ne impedit iracundia neglegentur. Consetetur neglegentur eum ut, vis animal legimus inimicus id."\
"\n\n"\ "\n\n"\
"His audiam" "His audiam"
annotation = create(:legislation_annotation, annotation = create(
:legislation_annotation,
draft_version: draft_version, draft_version: draft_version,
quote: quote, quote: quote,
ranges: [{ "start" => "/p[1]", "startOffset" => 6, "end" => "/p[3]", "endOffset" => 11 }] ranges: [{ "start" => "/p[1]", "startOffset" => 6, "end" => "/p[3]", "endOffset" => 11 }]
@@ -46,7 +47,8 @@ RSpec.describe Legislation::Annotation, type: :model do
" facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore"\ " 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"\ " 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" " aeterno interesset at. Usu ea mundi tincidunt, omnium virtute aliquando ius ex. Ea aperiri sententiae duo"
annotation = create(:legislation_annotation, annotation = create(
:legislation_annotation,
draft_version: draft_version, draft_version: draft_version,
quote: quote, quote: quote,
ranges: [{ "start" => "/p[1]", "startOffset" => 273, "end" => "/p[2]", "endOffset" => 190 }] ranges: [{ "start" => "/p[1]", "startOffset" => 273, "end" => "/p[2]", "endOffset" => 190 }]
@@ -92,7 +94,8 @@ RSpec.describe Legislation::Annotation, type: :model do
" freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of"\ " 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)" " free software (and charge for them if you wish)"
annotation = create(:legislation_annotation, annotation = create(
:legislation_annotation,
draft_version: draft_version, draft_version: draft_version,
quote: quote, quote: quote,
ranges: [{ "start" => "/p[2]", "startOffset" => 127, "end" => "/p[3]", "endOffset" => 223 }] ranges: [{ "start" => "/p[2]", "startOffset" => 127, "end" => "/p[3]", "endOffset" => 223 }]

View File

@@ -301,16 +301,20 @@ describe "Admin budget investments", :admin do
end end
scenario "Filtering by under valuation" do scenario "Filtering by under valuation" do
create(:budget_investment, create(
:budget_investment,
:with_administrator, :with_administrator,
:with_valuator, :with_valuator,
:open, :open,
title: "Investment without valuation", title: "Investment without valuation",
budget: budget) budget: budget
create(:budget_investment, )
create(
:budget_investment,
:with_administrator, :with_administrator,
title: "Investment with valuation", title: "Investment with valuation",
budget: budget) budget: budget
)
visit admin_budget_budget_investments_path(budget_id: budget) visit admin_budget_budget_investments_path(budget_id: budget)
expect(page).to have_link("Investment without valuation") expect(page).to have_link("Investment without valuation")

View File

@@ -254,11 +254,13 @@ describe "System Emails" do
describe "#evaluation_comment" do describe "#evaluation_comment" do
scenario "render correctly evaluaton comment mailer with valuator as a sample user" do scenario "render correctly evaluaton comment mailer with valuator as a sample user" do
admin = create(:administrator, user: create(:user, username: "Baby Doe")) admin = create(:administrator, user: create(:user, username: "Baby Doe"))
investment = create(:budget_investment, investment = create(
:budget_investment,
title: "Cleaner city", title: "Cleaner city",
heading: heading, heading: heading,
author: user, author: user,
administrator: admin) administrator: admin
)
comment = create(:comment, :valuation, commentable: investment) comment = create(:comment, :valuation, commentable: investment)
visit admin_system_email_view_path("evaluation_comment") visit admin_system_email_view_path("evaluation_comment")
@@ -270,7 +272,12 @@ describe "System Emails" do
expect(page).to have_content comment.body expect(page).to have_content comment.body
expect(page).to have_link "Cleaner city", expect(page).to have_link "Cleaner city",
href: admin_budget_budget_investment_url(investment.budget, investment, anchor: "comments", host: app_host) href: admin_budget_budget_investment_url(
investment.budget,
investment,
anchor: "comments",
host: app_host
)
end end
scenario "uses a current_user as a sample user for sample regular comments" do scenario "uses a current_user as a sample user for sample regular comments" do

View File

@@ -163,12 +163,14 @@ describe "Ballots" do
scenario "map and content block shoud be visible before and after" do scenario "map and content block shoud be visible before and after" do
stub_const("#{Budgets::InvestmentsController}::PER_PAGE", 1) stub_const("#{Budgets::InvestmentsController}::PER_PAGE", 1)
create(:budget_investment, :selected, :with_map_location, create(
:budget_investment, :selected, :with_map_location,
heading: new_york, heading: new_york,
price: 10000, price: 10000,
title: "More bridges", title: "More bridges",
) )
create(:budget_investment, :selected, :with_map_location, create(
:budget_investment, :selected, :with_map_location,
heading: new_york, heading: new_york,
price: 5000, price: 5000,
title: "Less bridges" title: "Less bridges"

View File

@@ -157,7 +157,8 @@ describe "Home" do
end end
scenario "if there are cards, the 'featured' title will render" do scenario "if there are cards, the 'featured' title will render" do
create(:widget_card, create(
:widget_card,
title: "Card text", title: "Card text",
description: "Card description", description: "Card description",
link_text: "Link text", link_text: "Link text",

View File

@@ -197,21 +197,24 @@ describe "Moderate budget investments" do
end end
scenario "sorting investments" do scenario "sorting investments" do
flagged_investment = create(:budget_investment, flagged_investment = create(
:budget_investment,
heading: heading, heading: heading,
title: "Flagged investment", title: "Flagged investment",
created_at: 1.day.ago, created_at: 1.day.ago,
flags_count: 5 flags_count: 5
) )
flagged_new_investment = create(:budget_investment, flagged_new_investment = create(
:budget_investment,
heading: heading, heading: heading,
title: "Flagged new investment", title: "Flagged new investment",
created_at: 12.hours.ago, created_at: 12.hours.ago,
flags_count: 3 flags_count: 3
) )
latest_investment = create(:budget_investment, latest_investment = create(
:budget_investment,
heading: heading, heading: heading,
title: "Latest investment", title: "Latest investment",
created_at: Time.current created_at: Time.current

View File

@@ -80,14 +80,16 @@ describe "Officing Results", :with_frozen_time do
end end
scenario "Edit result" do scenario "Edit result" do
partial_result = create(:poll_partial_result, partial_result = create(
:poll_partial_result,
officer_assignment: poll_officer.officer_assignments.first, officer_assignment: poll_officer.officer_assignments.first,
booth_assignment: poll_officer.officer_assignments.first.booth_assignment, booth_assignment: poll_officer.officer_assignments.first.booth_assignment,
date: Date.current, date: Date.current,
question: question_1, question: question_1,
answer: question_1.question_answers.first.title, answer: question_1.question_answers.first.title,
author: poll_officer.user, author: poll_officer.user,
amount: 7777) 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)
@@ -129,20 +131,24 @@ describe "Officing Results", :with_frozen_time do
booth_assignment = officer_assignment.booth_assignment booth_assignment = officer_assignment.booth_assignment
booth = booth_assignment.booth booth = booth_assignment.booth
create(:poll_partial_result, create(
:poll_partial_result,
officer_assignment: officer_assignment, officer_assignment: officer_assignment,
booth_assignment: booth_assignment, booth_assignment: booth_assignment,
date: poll.ends_at, date: poll.ends_at,
question: question_1, question: question_1,
amount: 33) amount: 33
)
create(:poll_recount, create(
:poll_recount,
officer_assignment: officer_assignment, officer_assignment: officer_assignment,
booth_assignment: booth_assignment, booth_assignment: booth_assignment,
date: poll.ends_at, date: poll.ends_at,
white_amount: 21, white_amount: 21,
null_amount: 44, null_amount: 44,
total_amount: 66) total_amount: 66
)
visit officing_poll_results_path(poll, visit officing_poll_results_path(poll,
date: I18n.l(poll.ends_at.to_date), date: I18n.l(poll.ends_at.to_date),

View File

@@ -4,7 +4,8 @@ describe "Custom Pages" do
context "New custom page" do context "New custom page" do
context "Published" do context "Published" do
scenario "See page" do scenario "See page" do
custom_page = create(:site_customization_page, :published, custom_page = create(
:site_customization_page, :published,
slug: "other-slug", slug: "other-slug",
title_en: "Custom page", title_en: "Custom page",
content_en: "Text for new custom page", content_en: "Text for new custom page",
@@ -20,7 +21,8 @@ describe "Custom Pages" do
end end
scenario "Show all fields and text with links" do scenario "Show all fields and text with links" do
custom_page = create(:site_customization_page, :published, custom_page = create(
:site_customization_page, :published,
slug: "slug-with-all-fields-filled", slug: "slug-with-all-fields-filled",
title_en: "Custom page", title_en: "Custom page",
subtitle_en: "This is my new custom page", subtitle_en: "This is my new custom page",
@@ -39,7 +41,8 @@ describe "Custom Pages" do
end end
scenario "Don't show subtitle if its blank" do scenario "Don't show subtitle if its blank" do
custom_page = create(:site_customization_page, :published, custom_page = create(
:site_customization_page, :published,
slug: "slug-without-subtitle", slug: "slug-without-subtitle",
title_en: "Custom page", title_en: "Custom page",
subtitle_en: "", subtitle_en: "",
@@ -57,7 +60,8 @@ describe "Custom Pages" do
end end
scenario "Listed in more information page" do scenario "Listed in more information page" do
create(:site_customization_page, :published, create(
:site_customization_page, :published,
slug: "another-slug", slug: "another-slug",
title_en: "Another custom page", title_en: "Another custom page",
subtitle_en: "Subtitle for custom page", subtitle_en: "Subtitle for custom page",
@@ -70,7 +74,8 @@ describe "Custom Pages" do
end end
scenario "Not listed in more information page" do scenario "Not listed in more information page" do
custom_page = create(:site_customization_page, :published, custom_page = create(
:site_customization_page, :published,
slug: "another-slug", title_en: "Another custom page", slug: "another-slug", title_en: "Another custom page",
subtitle_en: "Subtitle for custom page", subtitle_en: "Subtitle for custom page",
more_info_flag: false more_info_flag: false