Modified feature spec to pass with the new UI

Add feature spec to test if the 'Calculate winners'
button is enabled or not, depending on the phase.
It also checks the message that clarifies why the
button is disabled.
This commit is contained in:
iagirre
2018-01-23 16:50:44 +01:00
parent 2821985552
commit 73b0fe5162
2 changed files with 19 additions and 1 deletions

View File

@@ -366,6 +366,23 @@ feature 'Admin budget investments' do
expect(page).not_to have_select("tag_name", options: ["All tags", "Accessibility"]) expect(page).not_to have_select("tag_name", options: ["All tags", "Accessibility"])
end end
scenario "Disable 'Calculate winner' button if incorrect phase" do
budget.update(phase: 'reviewing_ballots')
visit admin_budget_budget_investments_path(budget)
click_link 'Winners'
expect(page).to have_link "Calculate Winner Investments"
budget.update(phase: 'accepting')
visit admin_budget_budget_investments_path(budget)
click_link 'Winners'
expect(page).not_to have_link "Calculate Winner Investments"
expect(page).to have_content 'The budget has to stay on phase "Balloting projects", "Reviewing Ballots" or "Finished budget" in order to calculate winners projects'
end
scenario "Limiting by max number of investments per heading", :js do scenario "Limiting by max number of investments per heading", :js do
group_1 = create(:budget_group, budget: budget) group_1 = create(:budget_group, budget: budget)
group_2 = create(:budget_group, budget: budget) group_2 = create(:budget_group, budget: budget)

View File

@@ -186,7 +186,8 @@ feature 'Admin budgets' do
end end
context "Calculate Budget's Winner Investments" do context "Calculate Budget's Winner Investments" do
scenario 'For a Budget in reviewing balloting' do
scenario 'For a Budget in reviewing balloting', :js do
budget = create(:budget, phase: 'reviewing_ballots') budget = create(:budget, phase: 'reviewing_ballots')
group = create(:budget_group, budget: budget) group = create(:budget_group, budget: budget)
heading = create(:budget_heading, group: group, price: 4) heading = create(:budget_heading, group: group, price: 4)