Update investments order when hide_money is active
This commit is contained in:
@@ -190,7 +190,7 @@ class Budget < ApplicationRecord
|
||||
when "accepting", "reviewing", "finished"
|
||||
%w[random]
|
||||
when "publishing_prices", "balloting", "reviewing_ballots"
|
||||
%w[random price]
|
||||
hide_money? ? %w[random] : %w[random price]
|
||||
else
|
||||
%w[random confidence_score]
|
||||
end
|
||||
|
||||
@@ -277,6 +277,16 @@ describe Budget do
|
||||
expect(budget.investments_orders).to eq(["random", "price"])
|
||||
end
|
||||
|
||||
it "is random when ballotting and reviewing ballots if hide money" do
|
||||
budget.update!(voting_style: "approval", hide_money: true)
|
||||
budget.phase = "publishing_prices"
|
||||
expect(budget.investments_orders).to eq(["random"])
|
||||
budget.phase = "balloting"
|
||||
expect(budget.investments_orders).to eq(["random"])
|
||||
budget.phase = "reviewing_ballots"
|
||||
expect(budget.investments_orders).to eq(["random"])
|
||||
end
|
||||
|
||||
it "is random and confidence_score in all other cases" do
|
||||
budget.phase = "selecting"
|
||||
expect(budget.investments_orders).to eq(["random", "confidence_score"])
|
||||
|
||||
Reference in New Issue
Block a user