Investment projects statistics by participatory budget

The more recent budgets show first.

The current budget will only show the amount of sent investments
until the winner's phase.
This commit is contained in:
Senén Rodero Rodríguez
2021-02-16 12:10:45 +01:00
committed by taitus
parent 205cbd7d82
commit ebe8903c75
5 changed files with 52 additions and 12 deletions

View File

@@ -8,16 +8,22 @@ describe Admin::Stats::SDG::GoalComponent, type: :component do
create_list(:poll, 2, sdg_goals: [goal])
create_list(:proposal, 3, sdg_goals: [goal])
create_list(:debate, 1, sdg_goals: [goal])
create_list(:budget_investment, 2, :winner, sdg_goals: [goal], price: 1000)
create_list(:budget_investment, 2, sdg_goals: [goal], price: 1000)
past = create(:budget, name: "Past year budget")
create_list(:budget_investment, 1, :winner, sdg_goals: [goal], price: 1000, budget: past)
current = create(:budget, name: "Current budget")
create_list(:budget_investment, 2, sdg_goals: [goal], price: 1000, budget: current)
render_inline component
expect(page).to have_text "Proposals 3"
expect(page).to have_text "Polls 2"
expect(page).to have_text "Debates 1"
expect(page).to have_text "Investment projects sent 4"
expect(page).to have_text "Winner investment projects 2"
expect(page).to have_text "Approved amount $2,000"
expect("Current budget").to appear_before("Past year budget")
expect(page).to have_text "Investment projects sent 2"
expect(page).to have_text "Winner investment projects 0"
expect(page).to have_text "Approved amount $0"
expect(page).to have_text "Investment projects sent 1"
expect(page).to have_text "Winner investment projects 1"
expect(page).to have_text "Approved amount $1,000"
end
end