Added test to bugets/index to ensure the correcto showing of the investment links over ths changes of the buget's phase

This commit is contained in:
Raúl Fuentes
2018-01-25 17:12:07 +01:00
committed by Bertocq
parent 5b16d395e7
commit 6871193cbc

View File

@@ -77,6 +77,46 @@ feature 'Budgets' do
expect(page).not_to have_css('div#map')
end
end
scenario 'Show investment links only on balloting or later' do
budget = create(:budget)
group = create(:budget_group, budget: budget)
heading = create(:budget_heading, group: group)
['reviewing_ballots', 'finished'].each do |phase|
budget.update(phase: phase)
visit budgets_path
expect(page).to have_content(I18n.t("budgets.index.investment_proyects"))
expect(page).to have_content(I18n.t("budgets.index.unfeasible_investment_proyects"))
expect(page).to have_content(I18n.t("budgets.index.not_selected_investment_proyects"))
end
end
scenario 'Not show investment links earlier of balloting ' do
budget = create(:budget)
group = create(:budget_group, budget: budget)
heading = create(:budget_heading, group: group)
phases_without_links = ['drafting','informing']
allowed_phase_list = ['reviewing_ballots', 'finished']
not_allowed_phase_list = Budget::Phase::PHASE_KINDS -
phases_without_links -
allowed_phase_list
not_allowed_phase_list.each do |phase|
budget.update(phase: phase)
visit budgets_path
expect(page).not_to have_content(I18n.t("budgets.index.investment_proyects"))
expect(page).to have_content(I18n.t("budgets.index.unfeasible_investment_proyects"))
expect(page).not_to have_content(I18n.t("budgets.index.not_selected_investment_proyects"))
end
end
end
scenario 'Index shows only published phases' do