User discard_and_anonymize!

This commit is contained in:
Paul Chavard 2020-09-16 13:37:44 +02:00
parent 337b20661a
commit a0dd3604a4
3 changed files with 56 additions and 4 deletions

View file

@ -293,4 +293,16 @@ describe User, type: :model do
end
end
end
describe '#discard_and_anonymize!' do
let(:user) { create(:user) }
before { user.discard_and_anonymize!('HS1234') }
it 'should discard user and make it anonymous' do
expect(user.discarded?).to be_truthy
expect(user.email).to end_with '@anonymous.org'
expect(user.discard_reason).to eq('HS1234')
end
end
end