Add and apply MultilineMethodCallIndentation rule

This commit is contained in:
Javi Martín
2023-07-01 18:08:54 +02:00
parent 629e208e9d
commit 5b6de96241
35 changed files with 131 additions and 110 deletions

View File

@@ -108,6 +108,9 @@ Layout/MultilineHashBraceLayout:
Layout/MultilineHashKeyLineBreaks: Layout/MultilineHashKeyLineBreaks:
Enabled: true Enabled: true
Layout/MultilineMethodCallIndentation:
Enabled: true
Layout/MultilineOperationIndentation: Layout/MultilineOperationIndentation:
Enabled: true Enabled: true

View File

@@ -9,7 +9,9 @@ class Budgets::Executions::ImageComponent < ApplicationComponent
private private
def milestone def milestone
investment.milestones.order_by_publication_date investment.milestones
.select { |milestone| milestone.image.present? }.last .order_by_publication_date
.select { |milestone| milestone.image.present? }
.last
end end
end end

View File

@@ -8,8 +8,9 @@ class Admin::Legislation::ProcessesController < Admin::Legislation::BaseControll
load_and_authorize_resource :process, class: "Legislation::Process" load_and_authorize_resource :process, class: "Legislation::Process"
def index def index
@processes = ::Legislation::Process.send(@current_filter).order(start_date: :desc) @processes = ::Legislation::Process.send(@current_filter)
.page(params[:page]) .order(start_date: :desc)
.page(params[:page])
end end
def create def create

View File

@@ -5,11 +5,11 @@ class Admin::Poll::OfficerAssignmentsController < Admin::Poll::BaseController
def index def index
@officers = ::Poll::Officer @officers = ::Poll::Officer
.includes(:user) .includes(:user)
.order("users.username") .order("users.username")
.where( .where(id: @poll.officer_assignments.select(:officer_id).distinct.map(&:officer_id))
id: @poll.officer_assignments.select(:officer_id).distinct.map(&:officer_id) .page(params[:page])
).page(params[:page]).per(50) .per(50)
end end
def by_officer def by_officer

View File

@@ -4,9 +4,10 @@ class Admin::VerificationsController < Admin::BaseController
end end
def search def search
@users = User.incomplete_verification.search(params[:search]) @users = User.incomplete_verification
.page(params[:page]) .search(params[:search])
.for_render .page(params[:page])
.for_render
render :index render :index
end end
end end

View File

@@ -37,11 +37,11 @@ class Dashboard::AchievementsController < Dashboard::BaseController
def executed_proposed_actions def executed_proposed_actions
@executed_proposed_actions ||= @executed_proposed_actions ||=
Dashboard::ExecutedAction Dashboard::ExecutedAction
.joins(:action) .joins(:action)
.includes(:action) .includes(:action)
.where(proposal: proposal) .where(proposal: proposal)
.where(executed_at: start_date.beginning_of_day..end_date.end_of_day) .where(executed_at: start_date.beginning_of_day..end_date.end_of_day)
.where(dashboard_actions: { action_type: 0 }) .where(dashboard_actions: { action_type: 0 })
.order(executed_at: :asc) .order(executed_at: :asc)
end end
end end

View File

@@ -10,8 +10,11 @@ class Legislation::ProcessesController < Legislation::BaseController
def index def index
@current_filter ||= "open" @current_filter ||= "open"
@processes = ::Legislation::Process.send(@current_filter).published @processes = ::Legislation::Process.send(@current_filter)
.not_in_draft.order(start_date: :desc).page(params[:page]) .published
.not_in_draft
.order(start_date: :desc)
.page(params[:page])
end end
def show def show

View File

@@ -43,12 +43,12 @@ class Officing::BallotSheetsController < Officing::BaseController
def load_officer_assignments def load_officer_assignments
@officer_assignments = ::Poll::OfficerAssignment @officer_assignments = ::Poll::OfficerAssignment
.includes(booth_assignment: [:booth]) .includes(booth_assignment: [:booth])
.joins(:booth_assignment) .joins(:booth_assignment)
.final .final
.where(id: current_user.poll_officer.officer_assignment_ids) .where(id: current_user.poll_officer.officer_assignment_ids)
.where(poll_booth_assignments: { poll_id: @poll.id }) .where(poll_booth_assignments: { poll_id: @poll.id })
.where(date: Date.current) .where(date: Date.current)
end end
def load_officer_assignment def load_officer_assignment

View File

@@ -22,11 +22,11 @@ class Officing::ResultsController < Officing::BaseController
def index def index
@booth_assignment = ::Poll::BoothAssignment.includes(:booth).find(index_params[:booth_assignment_id]) @booth_assignment = ::Poll::BoothAssignment.includes(:booth).find(index_params[:booth_assignment_id])
if current_user.poll_officer.officer_assignments.final if current_user.poll_officer.officer_assignments.final
.where(booth_assignment_id: @booth_assignment.id).exists? .where(booth_assignment_id: @booth_assignment.id).exists?
@partial_results = ::Poll::PartialResult.includes(:question) @partial_results = ::Poll::PartialResult.includes(:question)
.where(booth_assignment_id: index_params[:booth_assignment_id]) .where(booth_assignment_id: index_params[:booth_assignment_id])
.where(date: index_params[:date]) .where(date: index_params[:date])
@recounts = ::Poll::Recount.where(booth_assignment_id: @booth_assignment.id, date: index_params[:date]) @recounts = ::Poll::Recount.where(booth_assignment_id: @booth_assignment.id, date: index_params[:date])
end end
end end
@@ -90,17 +90,17 @@ class Officing::ResultsController < Officing::BaseController
def load_officer_assignment def load_officer_assignment
@officer_assignment = current_user.poll_officer @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 end
def load_officer_assignments def load_officer_assignments
@officer_assignments = ::Poll::OfficerAssignment @officer_assignments = ::Poll::OfficerAssignment
.includes(booth_assignment: [:booth]) .includes(booth_assignment: [:booth])
.joins(:booth_assignment) .joins(:booth_assignment)
.final .final
.where(id: current_user.poll_officer.officer_assignment_ids) .where(id: current_user.poll_officer.officer_assignment_ids)
.where(poll_booth_assignments: { poll_id: @poll.id }) .where(poll_booth_assignments: { poll_id: @poll.id })
.where(date: Date.current) .where(date: Date.current)
end end
def load_partial_results def load_partial_results

View File

@@ -155,8 +155,10 @@ class ProposalsController < ApplicationController
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"] if Setting["feature.featured_proposals"]
@featured_proposals = Proposal.not_archived.unsuccessful @featured_proposals = Proposal.not_archived
.sort_by_confidence_score.limit(Setting["featured_proposals_number"]) .unsuccessful
.sort_by_confidence_score
.limit(Setting["featured_proposals_number"])
if @featured_proposals.present? if @featured_proposals.present?
@resources = @resources.where.not(id: @featured_proposals) @resources = @resources.where.not(id: @featured_proposals)
end end

View File

@@ -23,7 +23,7 @@ module AdminBudgetInvestmentsHelper
def valuator_select_options(budget) def valuator_select_options(budget)
budget.valuators.order("description ASC").order("users.email ASC").includes(:user) budget.valuators.order("description ASC").order("users.email ASC").includes(:user)
.map { |v| [v.description_or_email, "valuator_#{v.id}"] } .map { |v| [v.description_or_email, "valuator_#{v.id}"] }
end end
def valuator_group_select_options def valuator_group_select_options

View File

@@ -48,7 +48,7 @@ module ApplicationHelper
def self.asset_data_base64(path) def self.asset_data_base64(path)
asset = (Rails.application.assets || ::Sprockets::Railtie.build_environment(Rails.application)) asset = (Rails.application.assets || ::Sprockets::Railtie.build_environment(Rails.application))
.find_asset(path) .find_asset(path)
throw "Could not find asset '#{path}'" if asset.nil? throw "Could not find asset '#{path}'" if asset.nil?
base64 = Base64.encode64(asset.to_s).gsub(/\s+/, "") base64 = Base64.encode64(asset.to_s).gsub(/\s+/, "")
"data:#{asset.content_type};base64,#{Rack::Utils.escape(base64)}" "data:#{asset.content_type};base64,#{Rack::Utils.escape(base64)}"

View File

@@ -11,8 +11,8 @@ class Budget
def name_uniqueness_by_budget def name_uniqueness_by_budget
if budget.groups.joins(:translations) if budget.groups.joins(:translations)
.where(name: name) .where(name: name)
.where.not("budget_group_translations.budget_group_id": budget_group_id).any? .where.not("budget_group_translations.budget_group_id": budget_group_id).any?
errors.add(:name, I18n.t("errors.messages.taken")) errors.add(:name, I18n.t("errors.messages.taken"))
end end
end end

View File

@@ -199,7 +199,7 @@ class Budget
with_joins = with_translations(Globalize.fallbacks(I18n.locale)) with_joins = with_translations(Globalize.fallbacks(I18n.locale))
with_joins.where(id: title_or_id) with_joins.where(id: title_or_id)
.or(with_joins.where("budget_investment_translations.title ILIKE ?", "%#{title_or_id}%")) .or(with_joins.where("budget_investment_translations.title ILIKE ?", "%#{title_or_id}%"))
end end
def searchable_values def searchable_values

View File

@@ -129,8 +129,8 @@ class Budget::Stats
def balloters_by_heading(heading_id) def balloters_by_heading(heading_id)
stats_cache("balloters_by_heading_#{heading_id}") do stats_cache("balloters_by_heading_#{heading_id}") do
budget.ballots.joins(:lines) budget.ballots.joins(:lines)
.where(budget_ballot_lines: { heading_id: heading_id }) .where(budget_ballot_lines: { heading_id: heading_id })
.distinct.pluck(:user_id) .distinct.pluck(:user_id)
end end
end end

View File

@@ -110,10 +110,10 @@ module Globalizable
end.join(", ") end.join(", ")
translations_ids = translation_class translations_ids = translation_class
.select("DISTINCT ON (#{translations_foreign_key}) id") .select("DISTINCT ON (#{translations_foreign_key}) id")
.where(locale: fallbacks) .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") .order(translations_foreign_key, "locales.ordering")
with_translations(fallbacks).where("#{translations_table_name}.id": translations_ids) with_translations(fallbacks).where("#{translations_table_name}.id": translations_ids)
end end

View File

@@ -108,9 +108,10 @@ class Dashboard::Action < ApplicationRecord
end end
def self.calculate_actions(proposal_votes, day_offset, proposal) def self.calculate_actions(proposal_votes, day_offset, proposal)
Dashboard::Action.active.where("required_supports <= ?", proposal_votes) Dashboard::Action.active
.where("day_offset <= ?", day_offset) .where("required_supports <= ?", proposal_votes)
.by_published_proposal(proposal.published?) .where("day_offset <= ?", day_offset)
.by_published_proposal(proposal.published?)
end end
def self.calculate_votes(proposal, date) def self.calculate_votes(proposal, date)

View File

@@ -104,7 +104,7 @@ class Poll < ApplicationRecord
return none if user.nil? || user.unverified? return none if user.nil? || user.unverified?
current.left_joins(:geozones) current.left_joins(:geozones)
.where("geozone_restricted = ? OR geozones.id = ?", false, user.geozone_id) .where("geozone_restricted = ? OR geozones.id = ?", false, user.geozone_id)
end end
def self.votable_by(user) def self.votable_by(user)

View File

@@ -16,17 +16,19 @@ class Poll
end end
def voting_days_assigned_polls def voting_days_assigned_polls
officer_assignments.voting_days.includes(booth_assignment: :poll) officer_assignments.voting_days
.map(&:booth_assignment) .includes(booth_assignment: :poll)
.map(&:poll).uniq.compact .map(&:booth_assignment)
.sort { |x, y| y.ends_at <=> x.ends_at } .map(&:poll).uniq.compact
.sort { |x, y| y.ends_at <=> x.ends_at }
end end
def final_days_assigned_polls def final_days_assigned_polls
officer_assignments.final.includes(booth_assignment: :poll) officer_assignments.final
.map(&:booth_assignment) .includes(booth_assignment: :poll)
.map(&:poll).uniq.compact .map(&:booth_assignment)
.sort { |x, y| y.ends_at <=> x.ends_at } .map(&:poll).uniq.compact
.sort { |x, y| y.ends_at <=> x.ends_at }
end end
def todays_booths def todays_booths

View File

@@ -8,10 +8,10 @@ class TagCloud
def tags def tags
resource_model_scoped resource_model_scoped
.last_week.send(counts) .last_week.send(counts)
.where("lower(name) NOT IN (?)", category_names + geozone_names + default_blacklist) .where("lower(name) NOT IN (?)", category_names + geozone_names + default_blacklist)
.order("#{table_name}_count": :desc, name: :asc) .order("#{table_name}_count": :desc, name: :asc)
.limit(10) .limit(10)
end end
def counts def counts

View File

@@ -3,7 +3,7 @@ class Verification::Management::ManagedUser
def self.find(document_type, document_number) def self.find(document_type, document_number)
User.where.not(document_number: nil) User.where.not(document_number: nil)
.find_or_initialize_by(document_type: document_type, .find_or_initialize_by(document_type: document_type,
document_number: document_number) document_number: document_number)
end end
end end

View File

@@ -1,5 +1,8 @@
<% annotation.comments.roots.sort_by_most_voted <% annotation.comments
.limit(Legislation::Annotation::COMMENTS_PAGE_SIZE).each do |comment| %> .roots
.sort_by_most_voted
.limit(Legislation::Annotation::COMMENTS_PAGE_SIZE)
.each do |comment| %>
<div class="comment"> <div class="comment">
<div class="comment-text"> <div class="comment-text">
<p><%= truncate comment.body, length: 250 %></p> <p><%= truncate comment.body, length: 250 %></p>

View File

@@ -22,7 +22,7 @@ FactoryBot.define do
factory :sdg_review, class: "SDG::Review" do factory :sdg_review, class: "SDG::Review" do
SDG::Related::RELATABLE_TYPES.map { |relatable_type| relatable_type.downcase.gsub("::", "_") } SDG::Related::RELATABLE_TYPES.map { |relatable_type| relatable_type.downcase.gsub("::", "_") }
.each do |relatable| .each do |relatable|
trait :"#{relatable}_review" do trait :"#{relatable}_review" do
association :relatable, factory: relatable association :relatable, factory: relatable
end end

View File

@@ -221,7 +221,7 @@ describe RemoteTranslations::Caller, :remote_translations do
fake_response = ["translated title", "translated description", "translated summary", nil] fake_response = ["translated title", "translated description", "translated summary", nil]
expect_any_instance_of(client).to receive(:call).with(field_values_sanitized, locale) expect_any_instance_of(client).to receive(:call).with(field_values_sanitized, locale)
.and_return(fake_response) .and_return(fake_response)
caller.call caller.call
end end

View File

@@ -62,13 +62,13 @@ describe RemoteTranslations::Microsoft::Client do
response_end_text = [end_translated_text_es] response_end_text = [end_translated_text_es]
expect_any_instance_of(BingTranslator).to receive(:translate_array).with([start_text_en], to: :es) expect_any_instance_of(BingTranslator).to receive(:translate_array).with([start_text_en], to: :es)
.exactly(1) .exactly(1)
.times .times
.and_return(response_start_text) .and_return(response_start_text)
expect_any_instance_of(BingTranslator).to receive(:translate_array).with([end_text_en], to: :es) expect_any_instance_of(BingTranslator).to receive(:translate_array).with([end_text_en], to: :es)
.exactly(1) .exactly(1)
.times .times
.and_return(response_end_text) .and_return(response_end_text)
start_another_text_en = Faker::Lorem.characters(number: 12) + "." start_another_text_en = Faker::Lorem.characters(number: 12) + "."
end_another_text_en = Faker::Lorem.characters(number: 12) end_another_text_en = Faker::Lorem.characters(number: 12)
@@ -81,13 +81,13 @@ describe RemoteTranslations::Microsoft::Client do
response_another_end_text = [another_end_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) expect_any_instance_of(BingTranslator).to receive(:translate_array).with([start_another_text_en], to: :es)
.exactly(1) .exactly(1)
.times .times
.and_return(response_another_start_text) .and_return(response_another_start_text)
expect_any_instance_of(BingTranslator).to receive(:translate_array).with([end_another_text_en], to: :es) expect_any_instance_of(BingTranslator).to receive(:translate_array).with([end_another_text_en], to: :es)
.exactly(1) .exactly(1)
.times .times
.and_return(response_another_end_text) .and_return(response_another_end_text)
result = client.call([text_en, another_text_en], :es) result = client.call([text_en, another_text_en], :es)

View File

@@ -101,23 +101,23 @@ describe Comment do
it "expires cache when the author is hidden" do it "expires cache when the author is hidden" do
expect { comment.user.hide } expect { comment.user.hide }
.to change { [comment.reload.cache_version, comment.author.cache_version] } .to change { [comment.reload.cache_version, comment.author.cache_version] }
end end
it "expires cache when the author is erased" do it "expires cache when the author is erased" do
expect { comment.user.erase } expect { comment.user.erase }
.to change { [comment.reload.cache_version, comment.author.cache_version] } .to change { [comment.reload.cache_version, comment.author.cache_version] }
end end
it "expires cache when the author changes" do it "expires cache when the author changes" do
expect { comment.user.update(username: "Isabel") } expect { comment.user.update(username: "Isabel") }
.to change { [comment.reload.cache_version, comment.author.cache_version] } .to change { [comment.reload.cache_version, comment.author.cache_version] }
end end
it "expires cache when the author's organization get verified" do it "expires cache when the author's organization get verified" do
create(:organization, user: comment.user) create(:organization, user: comment.user)
expect { comment.user.organization.verify } expect { comment.user.organization.verify }
.to change { [comment.reload.cache_version, comment.author.cache_version] } .to change { [comment.reload.cache_version, comment.author.cache_version] }
end end
end end

View File

@@ -376,23 +376,23 @@ describe Debate do
it "expires cache when the author is hidden" do it "expires cache when the author is hidden" do
expect { debate.author.hide } expect { debate.author.hide }
.to change { [debate.reload.cache_version, debate.author.cache_version] } .to change { [debate.reload.cache_version, debate.author.cache_version] }
end end
it "expires cache when the author is erased" do it "expires cache when the author is erased" do
expect { debate.author.erase } expect { debate.author.erase }
.to change { [debate.reload.cache_version, debate.author.cache_version] } .to change { [debate.reload.cache_version, debate.author.cache_version] }
end end
it "expires cache when its author changes" do it "expires cache when its author changes" do
expect { debate.author.update(username: "Eva") } expect { debate.author.update(username: "Eva") }
.to change { [debate.reload.cache_version, debate.author.cache_version] } .to change { [debate.reload.cache_version, debate.author.cache_version] }
end end
it "expires cache when the author's organization get verified" do it "expires cache when the author's organization get verified" do
create(:organization, user: debate.author) create(:organization, user: debate.author)
expect { debate.author.organization.verify } expect { debate.author.organization.verify }
.to change { [debate.reload.cache_version, debate.author.cache_version] } .to change { [debate.reload.cache_version, debate.author.cache_version] }
end end
end end

View File

@@ -181,7 +181,7 @@ describe Legislation::Process do
debate_end_date: Date.current - 1.day) debate_end_date: Date.current - 1.day)
expect(process).to be_invalid expect(process).to be_invalid
expect(process.errors.messages[:debate_end_date]) expect(process.errors.messages[:debate_end_date])
.to include("must be on or after the debate start date") .to include("must be on or after the debate start date")
end end
it "is valid if draft_end_date is the same as draft_start_date" do it "is valid if draft_end_date is the same as draft_start_date" do
@@ -195,7 +195,7 @@ describe Legislation::Process do
draft_end_date: Date.current - 1.day) draft_end_date: Date.current - 1.day)
expect(process).to be_invalid expect(process).to be_invalid
expect(process.errors.messages[:draft_end_date]) expect(process.errors.messages[:draft_end_date])
.to include("must be on or after the draft start date") .to include("must be on or after the draft start date")
end end
it "is invalid if allegations_end_date is before allegations_start_date" do it "is invalid if allegations_end_date is before allegations_start_date" do
@@ -203,7 +203,7 @@ describe Legislation::Process do
allegations_end_date: Date.current - 1.day) allegations_end_date: Date.current - 1.day)
expect(process).to be_invalid expect(process).to be_invalid
expect(process.errors.messages[:allegations_end_date]) expect(process.errors.messages[:allegations_end_date])
.to include("must be on or after the comments start date") .to include("must be on or after the comments start date")
end end
it "is valid if allegations_end_date is the same as allegations_start_date" do it "is valid if allegations_end_date is the same as allegations_start_date" do

View File

@@ -81,7 +81,7 @@ describe LocalCensusRecords::Import do
expect(import.invalid_records.map(&:date_of_birth)) expect(import.invalid_records.map(&:date_of_birth))
.to eq(invalid_records_date_of_births) .to eq(invalid_records_date_of_births)
expect(import.invalid_records.map(&:postal_code)) expect(import.invalid_records.map(&:postal_code))
.to eq(invalid_records_postal_codes) .to eq(invalid_records_postal_codes)
end end
end end
end end

View File

@@ -427,23 +427,23 @@ describe Proposal do
it "expires cache when the author is hidden" do it "expires cache when the author is hidden" do
expect { proposal.author.hide } expect { proposal.author.hide }
.to change { [proposal.reload.cache_version, proposal.author.cache_version] } .to change { [proposal.reload.cache_version, proposal.author.cache_version] }
end end
it "expires cache when the author is erased" do it "expires cache when the author is erased" do
expect { proposal.author.erase } expect { proposal.author.erase }
.to change { [proposal.reload.cache_version, proposal.author.cache_version] } .to change { [proposal.reload.cache_version, proposal.author.cache_version] }
end end
it "expires cache when its author changes" do it "expires cache when its author changes" do
expect { proposal.author.update(username: "Eva") } expect { proposal.author.update(username: "Eva") }
.to change { [proposal.reload.cache_version, proposal.author.cache_version] } .to change { [proposal.reload.cache_version, proposal.author.cache_version] }
end end
it "expires cache when the author's organization get verified" do it "expires cache when the author's organization get verified" do
create(:organization, user: proposal.author) create(:organization, user: proposal.author)
expect { proposal.author.organization.verify } expect { proposal.author.organization.verify }
.to change { [proposal.reload.cache_version, proposal.author.cache_version] } .to change { [proposal.reload.cache_version, proposal.author.cache_version] }
end end
end end

View File

@@ -10,8 +10,9 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume
before do before do
Setting["feature.remote_translations"] = true Setting["feature.remote_translations"] = true
available_locales_response = %w[de en es fr pt zh-Hans] available_locales_response = %w[de en es fr pt zh-Hans]
expect(RemoteTranslations::Microsoft::AvailableLocales).to receive(:available_locales).at_most(4).times expect(RemoteTranslations::Microsoft::AvailableLocales)
.and_return(available_locales_response) .to receive(:available_locales).at_most(4).times
.and_return(available_locales_response)
allow(Rails.application.secrets).to receive(:microsoft_api_key).and_return("123") allow(Rails.application.secrets).to receive(:microsoft_api_key).and_return("123")
end end

View File

@@ -36,7 +36,7 @@ module CommonActions
def validate_officer def validate_officer
allow_any_instance_of(Officing::BaseController) allow_any_instance_of(Officing::BaseController)
.to receive(:verify_officer_assignment).and_return(true) .to receive(:verify_officer_assignment).and_return(true)
end end
def fill_in_proposal def fill_in_proposal
@@ -70,7 +70,7 @@ module CommonActions
booth = create(:poll_booth) if booth.blank? booth = create(:poll_booth) if booth.blank?
allow_any_instance_of(Officing::BaseController) allow_any_instance_of(Officing::BaseController)
.to receive(:current_booth).and_return(booth) .to receive(:current_booth).and_return(booth)
end end
def click_sdg_goal(code) def click_sdg_goal(code)

View File

@@ -56,7 +56,7 @@ describe "Admin custom information texts", :admin do
within("#information-texts-tabs") { click_link "Proposals" } within("#information-texts-tabs") { click_link "Proposals" }
expect(find("a[href=\"/admin/site_customization/information_texts?tab=proposals\"].is-active")) expect(find("a[href=\"/admin/site_customization/information_texts?tab=proposals\"].is-active"))
.to have_content "Proposals" .to have_content "Proposals"
end end
context "Globalization" do context "Globalization" do

View File

@@ -149,7 +149,7 @@ describe "Votes" do
participation = find(".participation-not-allowed") participation = find(".participation-not-allowed")
headings = participation.text 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] expect(headings).to match_array [new_york.name, san_francisco.name]
@@ -183,7 +183,7 @@ describe "Votes" do
participation = find(".participation-not-allowed") participation = find(".participation-not-allowed")
headings = participation.text 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] expect(headings).to match_array [new_york.name, san_francisco.name]

View File

@@ -32,8 +32,9 @@ describe "DocumentVerifications" do
describe "Verifying througth Census" do describe "Verifying througth Census" do
context "Census API" do context "Census API" do
scenario "Verifying a user which does not exist and is not in the census shows an error" do scenario "Verifying a user which does not exist and is not in the census shows an error" do
expect_any_instance_of(Verification::Management::Document).to receive(:in_census?) expect_any_instance_of(Verification::Management::Document)
.and_return(false) .to receive(:in_census?)
.and_return(false)
login_as_manager login_as_manager
visit management_document_verifications_path visit management_document_verifications_path
@@ -55,8 +56,9 @@ describe "DocumentVerifications" do
context "Remote Census API", :remote_census do context "Remote Census API", :remote_census do
scenario "Verifying a user which does not exist and is not in the census shows an error" do scenario "Verifying a user which does not exist and is not in the census shows an error" do
expect_any_instance_of(Verification::Management::Document).to receive(:in_census?) expect_any_instance_of(Verification::Management::Document)
.and_return(false) .to receive(:in_census?)
.and_return(false)
login_as_manager login_as_manager
visit management_document_verifications_path visit management_document_verifications_path