Feature spec to test that the budget_investment is not been deleted if the user dismisses the confirm dialog

This commit is contained in:
iagirre
2018-01-25 16:44:52 +01:00
parent f2927c8eb2
commit b3dec1897e

View File

@@ -114,6 +114,29 @@ feature 'Users' do
end
end
scenario "Show alert when user wants to delete a budget investment", :js do
user = create(:user, :level_two)
budget = create(:budget, phase: 'accepting')
budget_investment = create(:budget_investment, author_id: user.id, budget: budget)
login_as(user)
visit user_path(user)
expect(page).to have_link budget_investment.title
within("#budget_investment_#{budget_investment.id}") do
page.driver.browser.dismiss_confirm
click_link 'Delete'
end
expect(page).to have_link budget_investment.title
within("#budget_investment_#{budget_investment.id}") do
page.driver.browser.accept_confirm
click_link 'Delete'
end
expect(page).not_to have_link budget_investment.title
end
end
feature 'Public activity' do