shows links to unfeasible/selected only after budget is balloting

This commit is contained in:
Juanjo Bazán
2017-05-09 17:36:42 +02:00
parent 33e8ebf043
commit 81c4a13305
3 changed files with 87 additions and 40 deletions

View File

@@ -8,14 +8,57 @@ feature 'Budgets' do
budgets.each {|budget| expect(page).to have_link(budget.name)}
end
scenario 'Show' do
budget = create(:budget)
group1 = create(:budget_group, budget: budget)
group2 = create(:budget_group, budget: budget)
context 'Show' do
visit budget_path(budget)
scenario "List all groups" do
budget = create(:budget)
group1 = create(:budget_group, budget: budget)
group2 = create(:budget_group, budget: budget)
visit budget_path(budget)
budget.groups.each {|group| expect(page).to have_link(group.name)}
end
scenario "Links to unfeasible and selected if balloting or later" do
budget = create(:budget, :selecting)
group = create(:budget_group, budget: budget)
visit budget_path(budget)
expect(page).to_not have_link "See unfeasible investments"
expect(page).to_not have_link "See investments not selected for balloting phase"
click_link group.name
expect(page).to_not have_link "See unfeasible investments"
expect(page).to_not have_link "See investments not selected for balloting phase"
budget.update(phase: :balloting)
visit budget_path(budget)
expect(page).to have_link "See unfeasible investments"
expect(page).to have_link "See investments not selected for balloting phase"
click_link group.name
expect(page).to have_link "See unfeasible investments"
expect(page).to have_link "See investments not selected for balloting phase"
budget.update(phase: :finished)
visit budget_path(budget)
expect(page).to have_link "See unfeasible investments"
expect(page).to have_link "See investments not selected for balloting phase"
click_link group.name
expect(page).to have_link "See unfeasible investments"
expect(page).to have_link "See investments not selected for balloting phase"
end
budget.groups.each {|group| expect(page).to have_link(group.name)}
end
context 'Accepting' do