Use "excluding" instead of "reject"
This method was already available as #without, but we didn't know about it.
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
</button>
|
</button>
|
||||||
|
|
||||||
<strong>
|
<strong>
|
||||||
<% 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") %>
|
<%= pluralize errors_count, t("form.error"), t("form.errors") %>
|
||||||
|
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ describe Budget::Investment do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "returns false in any other phase" do
|
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)
|
budget = create(:budget, phase: phase)
|
||||||
investment = create(:budget_investment, budget: budget)
|
investment = create(:budget_investment, budget: budget)
|
||||||
|
|
||||||
@@ -178,7 +178,7 @@ describe Budget::Investment do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "returns false in any other phase" do
|
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)
|
budget = create(:budget, phase: phase)
|
||||||
investment = create(:budget_investment, budget: budget)
|
investment = create(:budget_investment, budget: budget)
|
||||||
|
|
||||||
@@ -203,7 +203,7 @@ describe Budget::Investment do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "returns false in any other phase" do
|
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)
|
budget = create(:budget, phase: phase)
|
||||||
investment = create(:budget_investment, :selected, budget: budget)
|
investment = create(:budget_investment, :selected, budget: budget)
|
||||||
|
|
||||||
@@ -1198,7 +1198,7 @@ describe Budget::Investment do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "returns false if budget is not balloting phase" do
|
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)
|
budget.update!(phase: phase)
|
||||||
investment = create(:budget_investment, heading: heading1)
|
investment = create(:budget_investment, heading: heading1)
|
||||||
|
|
||||||
|
|||||||
@@ -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, :vote_collection_task, officer: officer, booth: booth, date: Date.current)
|
||||||
create(:poll_shift, :recount_scrutiny_task, officer: officer, booth: booth, date: Time.zone.tomorrow)
|
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
|
vote_collection_dates = (Date.current..poll.ends_at.to_date).excluding(Date.current)
|
||||||
.reject { |date| date == Date.current }
|
|
||||||
.map { |date| I18n.l(date, format: :long) }
|
.map { |date| I18n.l(date, format: :long) }
|
||||||
recount_scrutiny_dates = (poll.ends_at.to_date..poll.ends_at.to_date + 1.week).to_a
|
recount_scrutiny_dates = (poll.ends_at.to_date..poll.ends_at.to_date + 1.week).excluding(Time.zone.tomorrow)
|
||||||
.reject { |date| date == Time.zone.tomorrow }
|
|
||||||
.map { |date| I18n.l(date, format: :long) }
|
.map { |date| I18n.l(date, format: :long) }
|
||||||
|
|
||||||
visit available_admin_booths_path
|
visit available_admin_booths_path
|
||||||
|
|||||||
Reference in New Issue
Block a user