Do not delete users when deleting legislation answers

When a legislation process is deleted, everything related will be
deleted, including the answers. This `dependent: :destroy` was causing
that users accounts were being accidentally deleted.
This commit is contained in:
Julian Herrero
2020-07-27 16:47:52 +07:00
committed by Javi Martín
parent c03ada579d
commit 46c78fc3ef
2 changed files with 9 additions and 1 deletions

View File

@@ -36,4 +36,12 @@ RSpec.describe Legislation::Answer, type: :model do
expect(option_2.answers_count).to eq 1
expect(option_1.answers_count).to eq 0
end
it "does not delete users that created the answer" do
user = legislation_answer.user
legislation_answer.destroy!
expect(user).not_to be_hidden
end
end