mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 06:09:15 +08:00
Convert specs to RSpec 2.99.2 syntax with Transpec
This conversion is done by Transpec 3.1.0 with the following command: transpec * 424 conversions from: obj.should to: expect(obj).to * 325 conversions from: == expected to: eq(expected) * 38 conversions from: obj.should_not to: expect(obj).not_to * 15 conversions from: =~ /pattern/ to: match(/pattern/) * 9 conversions from: it { should ... } to: it { is_expected.to ... } * 5 conversions from: lambda { }.should_not to: expect { }.not_to * 4 conversions from: lambda { }.should to: expect { }.to * 2 conversions from: -> { }.should to: expect { }.to * 2 conversions from: -> { }.should_not to: expect { }.not_to * 1 conversion from: === expected to: be === expected * 1 conversion from: =~ [1, 2] to: match_array([1, 2]) For more details: https://github.com/yujinakayama/transpec#supported-conversions
This commit is contained in:
@ -10,22 +10,22 @@ describe UserAnonymizer do
|
||||
|
||||
it "changes username" do
|
||||
make_anonymous
|
||||
user.reload.username.should =~ /^anon\d{3,}$/
|
||||
expect(user.reload.username).to match(/^anon\d{3,}$/)
|
||||
end
|
||||
|
||||
it "changes email address" do
|
||||
make_anonymous
|
||||
user.reload.email.should == "#{user.username}@example.com"
|
||||
expect(user.reload.email).to eq("#{user.username}@example.com")
|
||||
end
|
||||
|
||||
it "turns off all notifications" do
|
||||
make_anonymous
|
||||
user.reload
|
||||
user.email_digests.should == false
|
||||
user.email_private_messages.should == false
|
||||
user.email_direct.should == false
|
||||
user.email_always.should == false
|
||||
user.mailing_list_mode.should == false
|
||||
expect(user.email_digests).to eq(false)
|
||||
expect(user.email_private_messages).to eq(false)
|
||||
expect(user.email_direct).to eq(false)
|
||||
expect(user.email_always).to eq(false)
|
||||
expect(user.mailing_list_mode).to eq(false)
|
||||
end
|
||||
|
||||
it "resets profile to default values" do
|
||||
@ -42,17 +42,17 @@ describe UserAnonymizer do
|
||||
make_anonymous
|
||||
user.reload
|
||||
|
||||
user.name.should_not be_present
|
||||
user.date_of_birth.should == nil
|
||||
user.title.should_not be_present
|
||||
expect(user.name).not_to be_present
|
||||
expect(user.date_of_birth).to eq(nil)
|
||||
expect(user.title).not_to be_present
|
||||
|
||||
profile = user.user_profile(true)
|
||||
profile.location.should == nil
|
||||
profile.website.should == nil
|
||||
profile.bio_cooked.should == nil
|
||||
profile.profile_background.should == nil
|
||||
profile.bio_cooked_version.should == nil
|
||||
profile.card_background.should == nil
|
||||
expect(profile.location).to eq(nil)
|
||||
expect(profile.website).to eq(nil)
|
||||
expect(profile.bio_cooked).to eq(nil)
|
||||
expect(profile.profile_background).to eq(nil)
|
||||
expect(profile.bio_cooked_version).to eq(nil)
|
||||
expect(profile.card_background).to eq(nil)
|
||||
end
|
||||
|
||||
it "removes the avatar" do
|
||||
@ -61,7 +61,7 @@ describe UserAnonymizer do
|
||||
user.save!
|
||||
expect { make_anonymous }.to change { Upload.count }.by(-1)
|
||||
user.reload
|
||||
user.user_avatar.should == nil
|
||||
expect(user.user_avatar).to eq(nil)
|
||||
end
|
||||
|
||||
it "logs the action" do
|
||||
@ -78,20 +78,20 @@ describe UserAnonymizer do
|
||||
UserOpenId.create(user_id: user.id, email: user.email, url: "http://example.com/openid", active: true)
|
||||
make_anonymous
|
||||
user.reload
|
||||
user.twitter_user_info.should == nil
|
||||
user.google_user_info.should == nil
|
||||
user.github_user_info.should == nil
|
||||
user.facebook_user_info.should == nil
|
||||
user.single_sign_on_record.should == nil
|
||||
user.oauth2_user_info.should == nil
|
||||
user.user_open_ids.count.should == 0
|
||||
expect(user.twitter_user_info).to eq(nil)
|
||||
expect(user.google_user_info).to eq(nil)
|
||||
expect(user.github_user_info).to eq(nil)
|
||||
expect(user.facebook_user_info).to eq(nil)
|
||||
expect(user.single_sign_on_record).to eq(nil)
|
||||
expect(user.oauth2_user_info).to eq(nil)
|
||||
expect(user.user_open_ids.count).to eq(0)
|
||||
end
|
||||
|
||||
it "removes api key" do
|
||||
ApiKey.create(user_id: user.id, key: "123123123")
|
||||
expect { make_anonymous }.to change { ApiKey.count }.by(-1)
|
||||
user.reload
|
||||
user.api_key.should == nil
|
||||
expect(user.api_key).to eq(nil)
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user