Add and apply Layout/ExtraSpacing rubocop rule
This commit is contained in:
@@ -52,6 +52,9 @@ Layout/EmptyLinesAroundMethodBody:
|
|||||||
Layout/EmptyLinesAroundModuleBody:
|
Layout/EmptyLinesAroundModuleBody:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
Layout/ExtraSpacing:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
Layout/SpaceAroundEqualsInParameterDefault:
|
Layout/SpaceAroundEqualsInParameterDefault:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ module Ahoy
|
|||||||
# Name is the name of the collection and will be showed in the
|
# Name is the name of the collection and will be showed in the
|
||||||
# chart
|
# chart
|
||||||
def add(name, collection)
|
def add(name, collection)
|
||||||
collections.push data: collection, name: name
|
collections.push data: collection, name: name
|
||||||
collection.each_key { |key| add_key key }
|
collection.each_key { |key| add_key key }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ class Budget
|
|||||||
results = results.search_by_title_or_id(params[:title_or_id].strip) if params[:title_or_id]
|
results = results.search_by_title_or_id(params[:title_or_id].strip) if params[:title_or_id]
|
||||||
results = advanced_filters(params, results) if params[:advanced_filters].present?
|
results = advanced_filters(params, results) if params[:advanced_filters].present?
|
||||||
|
|
||||||
results = results.send(current_filter) if current_filter.present?
|
results = results.send(current_filter) if current_filter.present?
|
||||||
results.includes(:heading, :group, :budget, administrator: :user, valuators: :user)
|
results.includes(:heading, :group, :budget, administrator: :user, valuators: :user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -5,5 +5,5 @@ class Budget::Investment::ChangeLog < ApplicationRecord
|
|||||||
validates :new_value, presence: true
|
validates :new_value, presence: true
|
||||||
validates :field, presence: true
|
validates :field, presence: true
|
||||||
|
|
||||||
scope :by_investment, ->(investment_id) { where(investment_id: investment_id) }
|
scope :by_investment, ->(investment_id) { where(investment_id: investment_id) }
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ class LocalCensusRecord < ApplicationRecord
|
|||||||
validates :postal_code, presence: true
|
validates :postal_code, presence: true
|
||||||
validates :document_number, uniqueness: { scope: :document_type }
|
validates :document_number, uniqueness: { scope: :document_type }
|
||||||
|
|
||||||
scope :search, -> (terms) { where("document_number ILIKE ?", "%#{terms}%") }
|
scope :search, -> (terms) { where("document_number ILIKE ?", "%#{terms}%") }
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class Poll < ApplicationRecord
|
|||||||
scope :published, -> { where("published = ?", true) }
|
scope :published, -> { where("published = ?", true) }
|
||||||
scope :by_geozone_id, ->(geozone_id) { where(geozones: { id: geozone_id }.joins(:geozones)) }
|
scope :by_geozone_id, ->(geozone_id) { where(geozones: { id: geozone_id }.joins(:geozones)) }
|
||||||
scope :public_for_api, -> { all }
|
scope :public_for_api, -> { all }
|
||||||
scope :not_budget, -> { where(budget_id: nil) }
|
scope :not_budget, -> { where(budget_id: nil) }
|
||||||
scope :created_by_admin, -> { where(related_type: nil) }
|
scope :created_by_admin, -> { where(related_type: nil) }
|
||||||
|
|
||||||
def self.sort_for_list
|
def self.sort_for_list
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ class ProposalNotification < ApplicationRecord
|
|||||||
validates :proposal, presence: true
|
validates :proposal, presence: true
|
||||||
validate :minimum_interval
|
validate :minimum_interval
|
||||||
|
|
||||||
scope :public_for_api, -> { where(proposal_id: Proposal.public_for_api.pluck(:id)) }
|
scope :public_for_api, -> { where(proposal_id: Proposal.public_for_api.pluck(:id)) }
|
||||||
scope :sort_by_created_at, -> { reorder(created_at: :desc) }
|
scope :sort_by_created_at, -> { reorder(created_at: :desc) }
|
||||||
scope :sort_by_moderated, -> { reorder(moderated: :desc) }
|
scope :sort_by_moderated, -> { reorder(moderated: :desc) }
|
||||||
|
|
||||||
scope :moderated, -> { where(moderated: true) }
|
scope :moderated, -> { where(moderated: true) }
|
||||||
scope :not_moderated, -> { where(moderated: false) }
|
scope :not_moderated, -> { where(moderated: false) }
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class SiteCustomization::Page < ApplicationRecord
|
|||||||
scope :sort_desc, -> { order("id DESC") }
|
scope :sort_desc, -> { order("id DESC") }
|
||||||
scope :with_more_info_flag, -> { where(status: "published", more_info_flag: true).sort_asc }
|
scope :with_more_info_flag, -> { where(status: "published", more_info_flag: true).sort_asc }
|
||||||
scope :with_same_locale, -> { joins(:translations).locale }
|
scope :with_same_locale, -> { joins(:translations).locale }
|
||||||
scope :locale, -> { where("site_customization_page_translations.locale": I18n.locale) }
|
scope :locale, -> { where("site_customization_page_translations.locale": I18n.locale) }
|
||||||
|
|
||||||
def url
|
def url
|
||||||
"/#{slug}"
|
"/#{slug}"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class VotationSetAnswer < ApplicationRecord
|
class VotationSetAnswer < ApplicationRecord
|
||||||
belongs_to :votation_type
|
belongs_to :votation_type
|
||||||
belongs_to :author, -> { with_hidden }, class_name: "User", foreign_key: "author_id"
|
belongs_to :author, -> { with_hidden }, class_name: "User", foreign_key: "author_id"
|
||||||
|
|
||||||
scope :by_author, -> (author) { where(author: author) }
|
scope :by_author, -> (author) { where(author: author) }
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ FactoryBot.define do
|
|||||||
unfeasibility_explanation { "" }
|
unfeasibility_explanation { "" }
|
||||||
skip_map { "1" }
|
skip_map { "1" }
|
||||||
terms_of_service { "1" }
|
terms_of_service { "1" }
|
||||||
incompatible { false }
|
incompatible { false }
|
||||||
|
|
||||||
trait :with_confidence_score do
|
trait :with_confidence_score do
|
||||||
before(:save) { |i| i.calculate_confidence_score }
|
before(:save) { |i| i.calculate_confidence_score }
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ describe "Admin download settings" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "Download budgets" do
|
context "Download budgets" do
|
||||||
let(:budget_finished) { create(:budget, :finished) }
|
let(:budget_finished) { create(:budget, :finished) }
|
||||||
let(:heading) { create(:budget_heading, budget: budget_finished, price: 1000) }
|
let(:heading) { create(:budget_heading, budget: budget_finished, price: 1000) }
|
||||||
|
|
||||||
let(:investment1) do
|
let(:investment1) do
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ describe "Admin polls" do
|
|||||||
expect(Poll::Question::Answer.count). to eq(0)
|
expect(Poll::Question::Answer.count). to eq(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Can't destroy poll with votes", :js do
|
scenario "Can't destroy poll with votes", :js do
|
||||||
poll = create(:poll)
|
poll = create(:poll)
|
||||||
create(:poll_question, poll: poll)
|
create(:poll_question, poll: poll)
|
||||||
create(:poll_voter, :from_booth, :valid_document, poll: poll)
|
create(:poll_voter, :from_booth, :valid_document, poll: poll)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ require "rails_helper"
|
|||||||
|
|
||||||
describe "Budget Groups" do
|
describe "Budget Groups" do
|
||||||
let(:budget) { create(:budget, slug: "budget_slug") }
|
let(:budget) { create(:budget, slug: "budget_slug") }
|
||||||
let!(:group) { create(:budget_group, slug: "group_slug", budget: budget) }
|
let!(:group) { create(:budget_group, slug: "group_slug", budget: budget) }
|
||||||
|
|
||||||
context "Load" do
|
context "Load" do
|
||||||
scenario "finds group using budget slug and group slug" do
|
scenario "finds group using budget slug and group slug" do
|
||||||
|
|||||||
@@ -1899,7 +1899,7 @@ describe "Budget Investments" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario "Display only investment's related to the current heading", :js do
|
scenario "Display only investment's related to the current heading", :js do
|
||||||
heading_2 = create(:budget_heading, name: "Madrid", group: group)
|
heading_2 = create(:budget_heading, name: "Madrid", group: group)
|
||||||
|
|
||||||
investment1 = create(:budget_investment, heading: heading)
|
investment1 = create(:budget_investment, heading: heading)
|
||||||
investment2 = create(:budget_investment, heading: heading)
|
investment2 = create(:budget_investment, heading: heading)
|
||||||
@@ -1923,7 +1923,7 @@ describe "Budget Investments" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario "Do not display investment's, since they're all related to other heading", :js do
|
scenario "Do not display investment's, since they're all related to other heading", :js do
|
||||||
heading_2 = create(:budget_heading, name: "Madrid", group: group)
|
heading_2 = create(:budget_heading, name: "Madrid", group: group)
|
||||||
|
|
||||||
investment1 = create(:budget_investment, heading: heading_2)
|
investment1 = create(:budget_investment, heading: heading_2)
|
||||||
investment2 = create(:budget_investment, heading: heading_2)
|
investment2 = create(:budget_investment, heading: heading_2)
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ describe "Polls" do
|
|||||||
expect(page).not_to have_content(poll.name)
|
expect(page).not_to have_content(poll.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Can't destroy poll with responses", :js do
|
scenario "Can't destroy poll with responses", :js do
|
||||||
poll = create(:poll, related: proposal)
|
poll = create(:poll, related: proposal)
|
||||||
create(:poll_question, poll: poll)
|
create(:poll_question, poll: poll)
|
||||||
create(:poll_voter, poll: poll)
|
create(:poll_voter, poll: poll)
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ describe "I18n" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "returns a String to avoid exception 'undefined method for Fixnum'" do
|
it "returns a String to avoid exception 'undefined method for Fixnum'" do
|
||||||
keys = { zero: "No comments" }
|
keys = { zero: "No comments" }
|
||||||
I18n.backend.store_translations(:en, { test_plural: keys })
|
I18n.backend.store_translations(:en, { test_plural: keys })
|
||||||
|
|
||||||
result = I18n.t("test_plural", count: 1)
|
result = I18n.t("test_plural", count: 1)
|
||||||
@@ -69,7 +69,7 @@ describe "I18n" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "returns the number not pluralized for missing translations" do
|
it "returns the number not pluralized for missing translations" do
|
||||||
keys = { zero: "No comments" }
|
keys = { zero: "No comments" }
|
||||||
I18n.backend.store_translations(:en, { test_plural: keys })
|
I18n.backend.store_translations(:en, { test_plural: keys })
|
||||||
|
|
||||||
expect(I18n.t("test_plural", count: 1).pluralize).to eq "1"
|
expect(I18n.t("test_plural", count: 1).pluralize).to eq "1"
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ describe Abilities::Administrator do
|
|||||||
it { should be_able_to(:create, Budget::ValuatorAssignment) }
|
it { should be_able_to(:create, Budget::ValuatorAssignment) }
|
||||||
|
|
||||||
it { should be_able_to(:admin_update, Budget::Investment) }
|
it { should be_able_to(:admin_update, Budget::Investment) }
|
||||||
it { should be_able_to(:hide, Budget::Investment) }
|
it { should be_able_to(:hide, Budget::Investment) }
|
||||||
|
|
||||||
it { should be_able_to(:valuate, create(:budget_investment, budget: create(:budget, :valuating))) }
|
it { should be_able_to(:valuate, create(:budget_investment, budget: create(:budget, :valuating))) }
|
||||||
it { should be_able_to(:valuate, create(:budget_investment, budget: create(:budget, :finished))) }
|
it { should be_able_to(:valuate, create(:budget_investment, budget: create(:budget, :finished))) }
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ describe Abilities::Common do
|
|||||||
let(:ballot_in_selecting_budget) { create(:budget_ballot, budget: selecting_budget) }
|
let(:ballot_in_selecting_budget) { create(:budget_ballot, budget: selecting_budget) }
|
||||||
let(:ballot_in_balloting_budget) { create(:budget_ballot, budget: balloting_budget) }
|
let(:ballot_in_balloting_budget) { create(:budget_ballot, budget: balloting_budget) }
|
||||||
|
|
||||||
let(:current_poll) { create(:poll) }
|
let(:current_poll) { create(:poll) }
|
||||||
let(:expired_poll) { create(:poll, :expired) }
|
let(:expired_poll) { create(:poll, :expired) }
|
||||||
let(:expired_poll_from_own_geozone) { create(:poll, :expired, geozone_restricted: true, geozones: [geozone]) }
|
let(:expired_poll_from_own_geozone) { create(:poll, :expired, geozone_restricted: true, geozones: [geozone]) }
|
||||||
let(:expired_poll_from_other_geozone) { create(:poll, :expired, geozone_restricted: true, geozones: [create(:geozone)]) }
|
let(:expired_poll_from_other_geozone) { create(:poll, :expired, geozone_restricted: true, geozones: [create(:geozone)]) }
|
||||||
|
|||||||
@@ -1206,7 +1206,7 @@ describe Budget::Investment do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "scoped_filter" do
|
describe "scoped_filter" do
|
||||||
let(:budget) { create(:budget, :balloting) }
|
let(:budget) { create(:budget, :balloting) }
|
||||||
let(:investment) { create(:budget_investment, budget: budget) }
|
let(:investment) { create(:budget_investment, budget: budget) }
|
||||||
|
|
||||||
describe "with without_admin filter" do
|
describe "with without_admin filter" do
|
||||||
|
|||||||
@@ -858,7 +858,7 @@ describe Proposal do
|
|||||||
|
|
||||||
describe "selected" do
|
describe "selected" do
|
||||||
let!(:not_selected_proposal) { create(:proposal) }
|
let!(:not_selected_proposal) { create(:proposal) }
|
||||||
let!(:selected_proposal) { create(:proposal, :selected) }
|
let!(:selected_proposal) { create(:proposal, :selected) }
|
||||||
|
|
||||||
it "selected? is true" do
|
it "selected? is true" do
|
||||||
expect(not_selected_proposal.selected?).to be false
|
expect(not_selected_proposal.selected?).to be false
|
||||||
@@ -916,7 +916,7 @@ describe Proposal do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "#recommendations" do
|
describe "#recommendations" do
|
||||||
let(:user) { create(:user) }
|
let(:user) { create(:user) }
|
||||||
|
|
||||||
it "does not return any proposals when user has not interests" do
|
it "does not return any proposals when user has not interests" do
|
||||||
create(:proposal)
|
create(:proposal)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
|||||||
else
|
else
|
||||||
let!(:documentable) { create(documentable_factory_name, author: user) }
|
let!(:documentable) { create(documentable_factory_name, author: user) }
|
||||||
end
|
end
|
||||||
let!(:user_to_login) { send(login_as_name) }
|
let!(:user_to_login) { send(login_as_name) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
create(:administrator, user: administrator)
|
create(:administrator, user: administrator)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
shared_examples "sanitizable" do
|
shared_examples "sanitizable" do
|
||||||
let(:sanitizable) { build(model_name(described_class)) }
|
let(:sanitizable) { build(model_name(described_class)) }
|
||||||
|
|
||||||
describe "#tag_list" do
|
describe "#tag_list" do
|
||||||
before do
|
before do
|
||||||
|
|||||||
Reference in New Issue
Block a user