diff --git a/app/views/shared/_errors.html.erb b/app/views/shared/_errors.html.erb index fff7801f8..80f49048c 100644 --- a/app/views/shared/_errors.html.erb +++ b/app/views/shared/_errors.html.erb @@ -5,7 +5,7 @@ - <% errors_count = resource.errors.messages.reject { |attribute| attribute == :base }.count %> + <% errors_count = resource.errors.messages.excluding(:base).count %> <%= pluralize errors_count, t("form.error"), t("form.errors") %> diff --git a/spec/models/budget/investment_spec.rb b/spec/models/budget/investment_spec.rb index fa8bb73f8..a0d4e2ef4 100644 --- a/spec/models/budget/investment_spec.rb +++ b/spec/models/budget/investment_spec.rb @@ -160,7 +160,7 @@ describe Budget::Investment do end it "returns false in any other phase" do - Budget::Phase::PHASE_KINDS.reject { |phase| phase == "selecting" }.each do |phase| + Budget::Phase::PHASE_KINDS.excluding("selecting").each do |phase| budget = create(:budget, phase: phase) investment = create(:budget_investment, budget: budget) @@ -178,7 +178,7 @@ describe Budget::Investment do end it "returns false in any other phase" do - Budget::Phase::PHASE_KINDS.reject { |phase| phase == "valuating" }.each do |phase| + Budget::Phase::PHASE_KINDS.excluding("valuating").each do |phase| budget = create(:budget, phase: phase) investment = create(:budget_investment, budget: budget) @@ -203,7 +203,7 @@ describe Budget::Investment do end it "returns false in any other phase" do - Budget::Phase::PHASE_KINDS.reject { |phase| phase == "balloting" }.each do |phase| + Budget::Phase::PHASE_KINDS.excluding("balloting").each do |phase| budget = create(:budget, phase: phase) investment = create(:budget_investment, :selected, budget: budget) @@ -1198,7 +1198,7 @@ describe Budget::Investment do end it "returns false if budget is not balloting phase" do - Budget::Phase::PHASE_KINDS.reject { |phase| phase == "balloting" }.each do |phase| + Budget::Phase::PHASE_KINDS.excluding("balloting").each do |phase| budget.update!(phase: phase) investment = create(:budget_investment, heading: heading1) diff --git a/spec/system/admin/poll/shifts_spec.rb b/spec/system/admin/poll/shifts_spec.rb index 683906622..a5a475092 100644 --- a/spec/system/admin/poll/shifts_spec.rb +++ b/spec/system/admin/poll/shifts_spec.rb @@ -96,11 +96,9 @@ describe "Admin shifts", :admin do create(:poll_shift, :vote_collection_task, officer: officer, booth: booth, date: Date.current) create(:poll_shift, :recount_scrutiny_task, officer: officer, booth: booth, date: Time.zone.tomorrow) - vote_collection_dates = (Date.current..poll.ends_at.to_date).to_a - .reject { |date| date == Date.current } + 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).to_a - .reject { |date| date == Time.zone.tomorrow } + 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) } visit available_admin_booths_path