adds spec for edge case

This commit is contained in:
Juanjo Bazán
2017-05-17 13:03:46 +02:00
parent 86c37d4952
commit da43e9e2e4

View File

@@ -592,7 +592,7 @@ feature 'Ballots' do
end end
end end
scenario 'Insufficient functs (removed after destroying from sidebar)', :js do scenario 'Insufficient funds (removed after destroying from sidebar)', :js do
bi1 = create(:budget_investment, :selected, heading: california, price: 600) bi1 = create(:budget_investment, :selected, heading: california, price: 600)
bi2 = create(:budget_investment, :selected, heading: california, price: 500) bi2 = create(:budget_investment, :selected, heading: california, price: 500)
@@ -621,6 +621,29 @@ feature 'Ballots' do
end end
end end
scenario "Edge case voting a non-elegible investment", :js do
investment1 = create(:budget_investment, :selected, heading: new_york, price: 10000)
login_as(user)
visit budget_path(budget)
click_link "States"
click_link "New York"
new_york.update(price: 10)
within("#budget_investment_#{investment1.id}") do
expect(page).to have_selector('.in-favor a', visible: true)
find('.add a').trigger('click')
expect(page.status_code).to eq(200)
expect(page).to_not have_content "Remove"
expect(page).to have_selector('.participation-not-allowed', visible: false)
find("div.ballot").hover
expect(page).to have_selector('.participation-not-allowed', visible: true)
expect(page).to have_selector('.in-favor a', visible: false)
end
end
scenario "Balloting is disabled when budget isn't in the balotting phase", :js do scenario "Balloting is disabled when budget isn't in the balotting phase", :js do
budget.update(phase: 'accepting') budget.update(phase: 'accepting')