Add destroy scenario to budget section of admin panel

This commit is contained in:
Bertocq
2018-01-08 17:48:06 +01:00
parent bce0729a61
commit 51e3d75c62

View File

@@ -109,6 +109,33 @@ feature 'Admin budgets' do
end
context 'Destroy' do
let!(:budget) { create(:budget) }
let(:heading) { create(:budget_heading, group: create(:budget_group, budget: budget)) }
scenario 'Destroy a budget without investments' do
visit admin_budgets_path
click_link 'Edit budget'
click_button 'Delete budget'
expect(page).to have_content('Budget deleted successfully')
expect(page).to have_content('participatory budgets cannot be found')
end
scenario 'Try to destroy a budget with investments' do
create(:budget_investment, heading: heading)
visit admin_budgets_path
click_link 'Edit budget'
click_button 'Delete budget'
expect(page).to have_content('You cannot destroy a Budget that has associated investments')
expect(page).to have_content('There is 1 participatory budget')
end
end
context "Calculate Budget's Winner Investments" do
scenario 'For a Budget in reviewing balloting' do