Use JavaScript in tests opening modal dialogs
This way we reproduce the user experience in the tests, and we can make sure modal dialogs open when we expect it.
This commit is contained in:
@@ -55,22 +55,22 @@ describe "Admin budget groups", :admin do
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Delete a group without headings" do
|
||||
scenario "Delete a group without headings", :js do
|
||||
group = create(:budget_group, budget: budget)
|
||||
|
||||
visit admin_budget_groups_path(budget)
|
||||
within("#budget_group_#{group.id}") { click_link "Delete" }
|
||||
within("#budget_group_#{group.id}") { accept_confirm { click_link "Delete" } }
|
||||
|
||||
expect(page).to have_content "Group deleted successfully"
|
||||
expect(page).not_to have_selector "#budget_group_#{group.id}"
|
||||
end
|
||||
|
||||
scenario "Try to delete a group with headings" do
|
||||
scenario "Try to delete a group with headings", :js do
|
||||
group = create(:budget_group, budget: budget)
|
||||
create(:budget_heading, group: group)
|
||||
|
||||
visit admin_budget_groups_path(budget)
|
||||
within("#budget_group_#{group.id}") { click_link "Delete" }
|
||||
within("#budget_group_#{group.id}") { accept_confirm { click_link "Delete" } }
|
||||
|
||||
expect(page).to have_content "You cannot delete a Group that has associated headings"
|
||||
expect(page).to have_selector "#budget_group_#{group.id}"
|
||||
|
||||
Reference in New Issue
Block a user