implements first version of user.erase

This commit is contained in:
kikito
2015-10-16 14:25:05 +02:00
parent dacab15288
commit 1511f811fd
2 changed files with 48 additions and 0 deletions

View File

@@ -302,4 +302,35 @@ describe User do
end
describe "#erase" do
it "anonymizes a user and marks him as hidden" do
user = create(:user,
username: "manolo",
unconfirmed_email: "a@a.com",
document_number: "1234",
phone_number: "5678",
encrypted_password: "foobar",
confirmation_token: "token1",
reset_password_token: "token2",
email_verification_token: "token3")
user.erase('a test')
user.reload
expect(user.erase_reason).to eq('a test')
expect(user.username).to be_nil
expect(user.email).to be_empty
expect(user.unconfirmed_email).to be_nil
expect(user.document_number).to be_nil
expect(user.phone_number).to be_nil
expect(user.encrypted_password).to be_empty
expect(user.confirmation_token).to be_nil
expect(user.reset_password_token).to be_nil
expect(user.email_verification_token).to be_nil
end
end
end