From 6871193cbc6f17d6ee8f63b9d9c2ccc04304f1da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Fuentes?= Date: Thu, 25 Jan 2018 17:12:07 +0100 Subject: [PATCH] Added test to bugets/index to ensure the correcto showing of the investment links over ths changes of the buget's phase --- spec/features/budgets/budgets_spec.rb | 40 +++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/spec/features/budgets/budgets_spec.rb b/spec/features/budgets/budgets_spec.rb index 71ae6805a..00db07feb 100644 --- a/spec/features/budgets/budgets_spec.rb +++ b/spec/features/budgets/budgets_spec.rb @@ -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