diff options
Diffstat (limited to 'spec/models/user_spec.rb')
-rw-r--r-- | spec/models/user_spec.rb | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 9f432501c59..f67acbbef37 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -166,7 +166,7 @@ describe User, models: true do allow_any_instance_of(ApplicationSetting).to receive(:domain_whitelist).and_return(['*.example.com']) end - it 'should give priority to whitelist and allow info@test.example.com' do + it 'gives priority to whitelist and allow info@test.example.com' do user = build(:user, email: 'info@test.example.com') expect(user).to be_valid end @@ -304,18 +304,18 @@ describe User, models: true do end describe '#generate_password' do - it "should execute callback when force_random_password specified" do + it "executes callback when force_random_password specified" do user = build(:user, force_random_password: true) expect(user).to receive(:generate_password) user.save end - it "should not generate password by default" do + it "does not generate password by default" do user = create(:user, password: 'abcdefghe') expect(user.password).to eq('abcdefghe') end - it "should generate password when forcing random password" do + it "generates password when forcing random password" do allow(Devise).to receive(:friendly_token).and_return('123456789') user = create(:user, password: 'abcdefg', force_random_password: true) expect(user.password).to eq('12345678') @@ -323,7 +323,7 @@ describe User, models: true do end describe 'authentication token' do - it "should have authentication token" do + it "has authentication token" do user = create(:user) expect(user.authentication_token).not_to be_blank end @@ -430,7 +430,7 @@ describe User, models: true do describe 'blocking user' do let(:user) { create(:user, name: 'John Smith') } - it "should block user" do + it "blocks user" do user.block expect(user.blocked?).to be_truthy end @@ -501,7 +501,7 @@ describe User, models: true do describe 'with defaults' do let(:user) { User.new } - it "should apply defaults to user" do + it "applies defaults to user" do expect(user.projects_limit).to eq(Gitlab.config.gitlab.default_projects_limit) expect(user.can_create_group).to eq(Gitlab.config.gitlab.default_can_create_group) expect(user.theme_id).to eq(Gitlab.config.gitlab.default_theme) @@ -512,7 +512,7 @@ describe User, models: true do describe 'with default overrides' do let(:user) { User.new(projects_limit: 123, can_create_group: false, can_create_team: true, theme_id: 1) } - it "should apply defaults to user" do + it "applies defaults to user" do expect(user.projects_limit).to eq(123) expect(user.can_create_group).to be_falsey expect(user.theme_id).to eq(1) @@ -602,7 +602,7 @@ describe User, models: true do describe 'by_username_or_id' do let(:user1) { create(:user, username: 'foo') } - it "should get the correct user" do + it "gets the correct user" do expect(User.by_username_or_id(user1.id)).to eq(user1) expect(User.by_username_or_id('foo')).to eq(user1) expect(User.by_username_or_id(-1)).to be_nil @@ -614,7 +614,7 @@ describe User, models: true do let(:username) { 'John' } let!(:user) { create(:user, username: username) } - it 'should get the correct user' do + it 'gets the correct user' do expect(User.by_login(user.email.upcase)).to eq user expect(User.by_login(user.email)).to eq user expect(User.by_login(username.downcase)).to eq user @@ -639,7 +639,7 @@ describe User, models: true do describe 'all_ssh_keys' do it { is_expected.to have_many(:keys).dependent(:destroy) } - it "should have all ssh keys" do + it "has all ssh keys" do user = create :user key = create :key, key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD33bWLBxu48Sev9Fert1yzEO4WGcWglWF7K/AwblIUFselOt/QdOL9DSjpQGxLagO1s9wl53STIO8qGS4Ms0EJZyIXOEFMjFJ5xmjSy+S37By4sG7SsltQEHMxtbtFOaW5LV2wCrX+rUsRNqLMamZjgjcPO0/EgGCXIGMAYW4O7cwGZdXWYIhQ1Vwy+CsVMDdPkPgBXqK7nR/ey8KMs8ho5fMNgB5hBw/AL9fNGhRw3QTD6Q12Nkhl4VZES2EsZqlpNnJttnPdp847DUsT6yuLRlfiQfz5Cn9ysHFdXObMN5VYIiPFwHeYCZp1X2S4fDZooRE8uOLTfxWHPXwrhqSH", user_id: user.id @@ -650,12 +650,12 @@ describe User, models: true do describe '#avatar_type' do let(:user) { create(:user) } - it "should be true if avatar is image" do + it "is true if avatar is image" do user.update_attribute(:avatar, 'uploads/avatar.png') expect(user.avatar_type).to be_truthy end - it "should be false if avatar is html page" do + it "is false if avatar is html page" do user.update_attribute(:avatar, 'uploads/avatar.html') expect(user.avatar_type).to eq(["only images allowed"]) end |