Delete needs confirmations in the specs

This commit is contained in:
Brenda Wallace
2019-06-14 18:12:33 +12:00
parent f73b260212
commit 40c75e0109
2 changed files with 6 additions and 1 deletions

View File

@@ -46,7 +46,8 @@ describe "Alternate names", js: true do
expect(page).to have_link "Delete",
href: alternate_name_path(alternate_eggplant)
within('.alternate_names') { click_on "Delete" }
expect(page.status_code).to equal 200
dismiss_confirm {click_link 'OK'}
expect(pending_alt_name.status_code).to equal 200
expect(page).not_to have_content alternate_eggplant.name
expect(page).to have_content 'Alternate name was successfully deleted'
end

View File

@@ -10,13 +10,17 @@ describe "Delete crop spec" do
it "Delete approved crop" do
visit crop_path(approved_crop)
click_link 'Actions'
click_link 'Delete'
dismiss_confirm {click_link 'OK'}
expect(page).to have_content "crop was successfully destroyed"
end
it "Delete pending crop" do
visit crop_path(pending_crop)
click_link 'Actions'
click_link 'Delete'
dismiss_confirm {click_link 'OK'}
expect(page).to have_content "crop was successfully destroyed"
end
end