From 29d6a81a16620f938d2773fa7f34208bea3bb1aa Mon Sep 17 00:00:00 2001 From: Toni Butkovic Date: Fri, 29 Dec 2023 17:57:21 +0100 Subject: [PATCH] Fix property destroy - use destroy instead of discard --- .../controllers/solidus_admin/properties_controller.rb | 2 +- admin/spec/features/properties.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/admin/app/controllers/solidus_admin/properties_controller.rb b/admin/app/controllers/solidus_admin/properties_controller.rb index 71a3eaf9871..666451459d4 100644 --- a/admin/app/controllers/solidus_admin/properties_controller.rb +++ b/admin/app/controllers/solidus_admin/properties_controller.rb @@ -23,7 +23,7 @@ def destroy @properties = Spree::Property.where(id: params[:id]) Spree::Property.transaction do - @properties.discard_all + @properties.destroy_all end flash[:notice] = t('.success') diff --git a/admin/spec/features/properties.rb b/admin/spec/features/properties.rb index 2edd87c3f7a..7c2025e5bfe 100644 --- a/admin/spec/features/properties.rb +++ b/admin/spec/features/properties.rb @@ -6,19 +6,19 @@ before { sign_in create(:admin_user, email: 'admin@example.com') } it "lists properties and allows deleting them" do - create(:property, name: "Type", presentation: "Type") + create(:property, name: "Type prop", presentation: "Type prop") create(:property, name: "Size", presentation: "Size") visit "/admin/properties" - expect(page).to have_content("Type") + expect(page).to have_content("Type prop") expect(page).to have_content("Size") expect(page).to be_axe_clean - select_row("Type") + select_row("Type prop") click_on "Delete" expect(page).to have_content("Properties were successfully removed.") - expect(page).not_to have_content("Type") + expect(page).not_to have_content("Type prop") expect(Spree::Property.count).to eq(1) end end