From d866305fe229a572a97848bfa9557dc9af2bed8c Mon Sep 17 00:00:00 2001 From: blacksmith-welder Date: Thu, 6 Mar 2025 18:48:38 +0200 Subject: [PATCH] Container profile delete --- .../container_profile_delete.feature | 7 ++--- .../container_profile_delete.rb | 29 +++++++++++++++++++ 2 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 staff_features/container_profiles/step_definitions/container_profile_delete.rb diff --git a/staff_features/container_profiles/container_profile_delete.feature b/staff_features/container_profiles/container_profile_delete.feature index b78ec6a..393446d 100644 --- a/staff_features/container_profiles/container_profile_delete.feature +++ b/staff_features/container_profiles/container_profile_delete.feature @@ -9,14 +9,12 @@ Feature: Container Profile Delete And the user checks the checkbox of the Container Profile And the user clicks on 'Delete' And the user clicks on 'Delete Records' - Then the 'Records' deleted message is displayed - And the Container Profile is deleted + Then the Container Profile is deleted Scenario: Container Profile is deleted from the view page Given the user is on the Container Profile view page When the user clicks on 'Delete' And the user clicks on 'Delete' in the modal Then the Container Profiles page is displayed - And the 'Container Pfodile' deleted message is displayed And the Container Profile is deleted Scenario: Cancel Container Profile delete from the view page Given the user is on the Container Profile view page @@ -28,5 +26,4 @@ Feature: Container Profile Delete When the user clicks on 'Delete' And the user clicks on 'Delete' in the modal Then the Container Profiles page is displayed - And the 'Containe Profile' deleted message is displayed - And the Container Profile is deleted \ No newline at end of file + And the Container Profile is deleted diff --git a/staff_features/container_profiles/step_definitions/container_profile_delete.rb b/staff_features/container_profiles/step_definitions/container_profile_delete.rb new file mode 100644 index 0000000..685f0de --- /dev/null +++ b/staff_features/container_profiles/step_definitions/container_profile_delete.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +When 'the user checks the checkbox of the Container Profile' do + find('#multiselect-item').check +end + +Then 'the Container Profile is deleted' do + visit "#{STAFF_URL}/container_profiles/#{@container_profile_id}/edit" + + expect(find('h2').text).to eq 'Record Not Found' + expected_text = "The record you've tried to access may no longer exist or you may not have permission to view it." + expect(page).to have_text expected_text +end + +Given 'the user is on the Container Profile view page' do + visit "#{STAFF_URL}/container_profiles/#{@container_profile_id}" +end + +Then 'the Container Profiles page is displayed' do + expect(current_url).to include "#{STAFF_URL}/container_profiles" +end + +Then 'the user is still on the Container Profile view page' do + expect(current_url).to eq "#{STAFF_URL}/container_profiles/#{@container_profile_id}" +end + +Given 'the user is on the Container Profile edit page' do + visit "#{STAFF_URL}/container_profiles/#{@container_profile_id}/edit" +end