From 40c75e01098833bada575bc4848746ba695fca3e Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Fri, 14 Jun 2019 18:12:33 +1200 Subject: [PATCH] Delete needs confirmations in the specs --- spec/features/crops/alternate_name_spec.rb | 3 ++- spec/features/crops/delete_crop_spec.rb | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/spec/features/crops/alternate_name_spec.rb b/spec/features/crops/alternate_name_spec.rb index e6cc3057a..2656517eb 100644 --- a/spec/features/crops/alternate_name_spec.rb +++ b/spec/features/crops/alternate_name_spec.rb @@ -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 diff --git a/spec/features/crops/delete_crop_spec.rb b/spec/features/crops/delete_crop_spec.rb index 8a25b629a..1bdab7272 100644 --- a/spec/features/crops/delete_crop_spec.rb +++ b/spec/features/crops/delete_crop_spec.rb @@ -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