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