FIX: Delete associated channel upon category deletion

Currently when a category is deleted, if it has an associated chat
channel, the latter won’t be deleted automatically.

The fix is quite simple as we were simply missing a `dependent:
:destroy` option on the existing relation.
This commit is contained in:
Loïc Guitaut
2022-11-17 15:16:14 +01:00
committed by Loïc Guitaut
parent e9863b145c
commit 01392ab90c
5 changed files with 22 additions and 5 deletions

View File

@ -8,7 +8,7 @@ RSpec.describe Category do
let(:channel_class) { CategoryChannel }
end
it { is_expected.to have_one(:category_channel) }
it { is_expected.to have_one(:category_channel).dependent(:destroy) }
describe "#cannot_delete_reason" do
subject(:reason) { category.cannot_delete_reason }