Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix property destroy - use destroy instead of discard #5577

Merged
merged 1 commit into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
8 changes: 4 additions & 4 deletions admin/spec/features/properties.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
before { sign_in create(:admin_user, email: '[email protected]') }

it "lists properties and allows deleting them" do
create(:property, name: "Type", presentation: "Type")
create(:property, name: "Type prop", presentation: "Type prop")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed "Type" to "Type prop" because of text Option types" used for the menu item which test recognizes as non deleted.

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