From 02b312ea810ea69421f15bdb598f8a5690a22549 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 17 Jun 2019 10:39:51 +1200 Subject: [PATCH] Gardens actions in the actions menu, and needing the confirm --- spec/features/gardens/gardens_spec.rb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/spec/features/gardens/gardens_spec.rb b/spec/features/gardens/gardens_spec.rb index 6e99f4f54..f1d449bf1 100644 --- a/spec/features/gardens/gardens_spec.rb +++ b/spec/features/gardens/gardens_spec.rb @@ -26,16 +26,24 @@ describe "Planting a crop", js: true do it "Marking a garden as inactive" do visit garden_path(garden) - click_link "Mark as inactive" + click_link 'Actions' + accept_confirm do + click_link "Mark as inactive" + end expect(page).to have_content "Garden was successfully updated" expect(page).to have_content "This garden is inactive" + + click_link 'Actions' expect(page).to have_content "Mark as active" expect(page).not_to have_content "Mark as inactive" end it "List only active gardens" do visit garden_path(garden) - click_link "Mark as inactive" + click_link 'Actions' + accept_confirm do + click_link "Mark as inactive" + end visit gardens_path expect(page).not_to have_link garden_path(garden) end @@ -63,6 +71,7 @@ describe "Planting a crop", js: true do end it "button on index to edit garden" do + click_link 'Actions' click_link href: edit_garden_path(garden) expect(page).to have_content 'Edit garden' end @@ -72,6 +81,7 @@ describe "Planting a crop", js: true do visit new_garden_path fill_in "Name", with: "New garden" click_button "Save" + click_link 'Actions' within '.garden-actions' do click_link 'Edit' end @@ -86,6 +96,7 @@ describe "Planting a crop", js: true do fill_in "Name", with: "New garden" click_button "Save" visit garden_path(Garden.last) + click_link 'Actions' accept_confirm do click_link 'Delete' end