mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Updated test to check for Site Setting full_name_required
Added context and new test to check for correct user anonymizing depending on full_name_required Site Setting
This commit is contained in:
parent
d95728dd16
commit
1c7a0cb514
@ -32,6 +32,11 @@ describe UserAnonymizer do
|
|||||||
expect(user.user_option.mailing_list_mode).to eq(false)
|
expect(user.user_option.mailing_list_mode).to eq(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "Site Settings do not require full name" do
|
||||||
|
before do
|
||||||
|
SiteSetting.full_name_required = false
|
||||||
|
end
|
||||||
|
|
||||||
it "resets profile to default values" do
|
it "resets profile to default values" do
|
||||||
user.update_attributes( name: "Bibi", date_of_birth: 19.years.ago, title: "Super Star" )
|
user.update_attributes( name: "Bibi", date_of_birth: 19.years.ago, title: "Super Star" )
|
||||||
|
|
||||||
@ -59,6 +64,22 @@ describe UserAnonymizer do
|
|||||||
expect(profile.bio_cooked_version).to eq(nil)
|
expect(profile.bio_cooked_version).to eq(nil)
|
||||||
expect(profile.card_background).to eq(nil)
|
expect(profile.card_background).to eq(nil)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "Site Settings require full name" do
|
||||||
|
before do
|
||||||
|
SiteSetting.full_name_required = true
|
||||||
|
end
|
||||||
|
|
||||||
|
it "changes name to anonymized username" do
|
||||||
|
user.update_attributes( name: "Bibi", date_of_birth: 19.years.ago, title: "Super Star" )
|
||||||
|
|
||||||
|
make_anonymous
|
||||||
|
user.reload
|
||||||
|
|
||||||
|
expect(user.name).to eq(user.username)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
it "removes the avatar" do
|
it "removes the avatar" do
|
||||||
upload = Fabricate(:upload, user: user)
|
upload = Fabricate(:upload, user: user)
|
||||||
|
Loading…
Reference in New Issue
Block a user