Skip to content
Snippets Groups Projects
Commit 1d268a89 authored by tiagonbotelho's avatar tiagonbotelho
Browse files

adds second batch of tests changed to active tense

parent 519275c1
No related branches found
No related tags found
No related merge requests found
Showing
with 74 additions and 74 deletions
Loading
Loading
@@ -167,7 +167,7 @@ describe Projects::ProjectMembersController do
sign_in(user)
end
 
it 'does not remove himself from the project' do
it 'cannot remove himself from the project' do
delete :leave, namespace_id: project.namespace,
project_id: project
 
Loading
Loading
Loading
Loading
@@ -9,7 +9,7 @@ describe 'factories' do
expect { entity }.not_to raise_error
end
 
it 'should be valid', if: factory.build_class < ActiveRecord::Base do
it 'is valid', if: factory.build_class < ActiveRecord::Base do
expect(entity).to be_valid
end
end
Loading
Loading
Loading
Loading
@@ -46,13 +46,13 @@ describe DiffHelper do
expect(diff_options).to include(no_collapse: true)
end
 
it 'should return paths if action name diff_for_path and param old path' do
it 'returns paths if action name diff_for_path and param old path' do
allow(controller).to receive(:params) { { old_path: 'lib/wadus.rb' } }
allow(controller).to receive(:action_name) { 'diff_for_path' }
expect(diff_options[:paths]).to include('lib/wadus.rb')
end
 
it 'should return paths if action name diff_for_path and param new path' do
it 'returns paths if action name diff_for_path and param new path' do
allow(controller).to receive(:params) { { new_path: 'lib/wadus.rb' } }
allow(controller).to receive(:action_name) { 'diff_for_path' }
expect(diff_options[:paths]).to include('lib/wadus.rb')
Loading
Loading
Loading
Loading
@@ -5,7 +5,7 @@ describe DisableEmailInterceptor, lib: true do
Mail.register_interceptor(DisableEmailInterceptor)
end
 
it 'should not send emails' do
it 'does not send emails' do
allow(Gitlab.config.gitlab).to receive(:email_enabled).and_return(false)
expect { deliver_mail }.not_to change(ActionMailer::Base.deliveries, :count)
end
Loading
Loading
Loading
Loading
@@ -25,7 +25,7 @@ describe ExtractsPath, lib: true do
@project = create(:project)
end
 
it "log tree path should have no escape sequences" do
it "log tree path has no escape sequences" do
assign_ref_vars
expect(@logs_path).to eq("/#{@project.path_with_namespace}/refs/#{ref}/logs_tree/files/ruby/popen.rb")
end
Loading
Loading
@@ -33,7 +33,7 @@ describe ExtractsPath, lib: true do
context 'escaped sequences in ref' do
let(:ref) { "improve%2Fawesome" }
 
it "id should have no escape sequences" do
it "id has no escape sequences" do
assign_ref_vars
expect(@ref).to eq('improve/awesome')
expect(@logs_path).to eq("/#{@project.path_with_namespace}/refs/#{ref}/logs_tree/files/ruby/popen.rb")
Loading
Loading
Loading
Loading
@@ -8,7 +8,7 @@ module Gitlab
let(:html) { 'H<sub>2</sub>O' }
 
context "without project" do
it "should convert the input using Asciidoctor and default options" do
it "converts the input using Asciidoctor and default options" do
expected_asciidoc_opts = {
safe: :secure,
backend: :html5,
Loading
Loading
@@ -24,7 +24,7 @@ module Gitlab
context "with asciidoc_opts" do
let(:asciidoc_opts) { { safe: :safe, attributes: ['foo'] } }
 
it "should merge the options with default ones" do
it "merges the options with default ones" do
expected_asciidoc_opts = {
safe: :safe,
backend: :html5,
Loading
Loading
Loading
Loading
@@ -51,24 +51,24 @@ describe Gitlab::Auth, lib: true do
let(:username) { 'John' } # username isn't lowercase, test this
let(:password) { 'my-secret' }
 
it "should find user by valid login/password" do
it "finds user by valid login/password" do
expect( gl_auth.find_with_user_password(username, password) ).to eql user
end
 
it 'should find user by valid email/password with case-insensitive email' do
it 'finds user by valid email/password with case-insensitive email' do
expect(gl_auth.find_with_user_password(user.email.upcase, password)).to eql user
end
 
it 'should find user by valid username/password with case-insensitive username' do
it 'finds user by valid username/password with case-insensitive username' do
expect(gl_auth.find_with_user_password(username.upcase, password)).to eql user
end
 
it "should not find user with invalid password" do
it "does not find user with invalid password" do
password = 'wrong'
expect( gl_auth.find_with_user_password(username, password) ).not_to eql user
end
 
it "should not find user with invalid login" do
it "does not find user with invalid login" do
user = 'wrong'
expect( gl_auth.find_with_user_password(username, password) ).not_to eql user
end
Loading
Loading
Loading
Loading
@@ -64,7 +64,7 @@ describe Gitlab::LDAP::Access, lib: true do
user.ldap_block
end
 
it 'should unblock user in GitLab' do
it 'unblocks user in GitLab' do
access.allowed?
expect(user).not_to be_blocked
end
Loading
Loading
Loading
Loading
@@ -36,7 +36,7 @@ describe Gitlab::LDAP::User, lib: true do
expect(ldap_user.changed?).to be_truthy
end
 
it "dont marks existing ldap user as changed" do
it "does not mark existing ldap user as changed" do
create(:omniauth_user, email: 'john@example.com', extern_uid: 'my-uid', provider: 'ldapmain', ldap_email: true)
expect(ldap_user.changed?).to be_falsey
end
Loading
Loading
Loading
Loading
@@ -42,7 +42,7 @@ describe Gitlab::OAuth::User, lib: true do
describe 'signup' do
shared_examples 'to verify compliance with allow_single_sign_on' do
context 'provider is marked as external' do
it 'should mark user as external' do
it 'marks user as external' do
stub_omniauth_config(allow_single_sign_on: ['twitter'], external_providers: ['twitter'])
oauth_user.save
expect(gl_user).to be_valid
Loading
Loading
@@ -51,7 +51,7 @@ describe Gitlab::OAuth::User, lib: true do
end
 
context 'provider was external, now has been removed' do
it 'should not mark external user as internal' do
it 'does not mark external user as internal' do
create(:omniauth_user, extern_uid: 'my-uid', provider: 'twitter', external: true)
stub_omniauth_config(allow_single_sign_on: ['twitter'], external_providers: ['facebook'])
oauth_user.save
Loading
Loading
@@ -62,7 +62,7 @@ describe Gitlab::OAuth::User, lib: true do
 
context 'provider is not external' do
context 'when adding a new OAuth identity' do
it 'should not promote an external user to internal' do
it 'does not promote an external user to internal' do
user = create(:user, email: 'john@mail.com', external: true)
user.identities.create(provider: provider, extern_uid: uid)
 
Loading
Loading
Loading
Loading
@@ -33,7 +33,7 @@ describe Gitlab::ProjectSearchResults, lib: true do
let!(:security_issue_1) { create(:issue, :confidential, project: project, title: 'Security issue 1', author: author) }
let!(:security_issue_2) { create(:issue, :confidential, title: 'Security issue 2', project: project, assignee: assignee) }
 
it 'should not list project confidential issues for non project members' do
it 'does not list project confidential issues for non project members' do
results = described_class.new(non_member, project, query)
issues = results.objects('issues')
 
Loading
Loading
@@ -43,7 +43,7 @@ describe Gitlab::ProjectSearchResults, lib: true do
expect(results.issues_count).to eq 1
end
 
it 'should not list project confidential issues for project members with guest role' do
it 'does not list project confidential issues for project members with guest role' do
project.team << [member, :guest]
 
results = described_class.new(member, project, query)
Loading
Loading
@@ -55,7 +55,7 @@ describe Gitlab::ProjectSearchResults, lib: true do
expect(results.issues_count).to eq 1
end
 
it 'should list project confidential issues for author' do
it 'lists project confidential issues for author' do
results = described_class.new(author, project, query)
issues = results.objects('issues')
 
Loading
Loading
@@ -65,7 +65,7 @@ describe Gitlab::ProjectSearchResults, lib: true do
expect(results.issues_count).to eq 2
end
 
it 'should list project confidential issues for assignee' do
it 'lists project confidential issues for assignee' do
results = described_class.new(assignee, project.id, query)
issues = results.objects('issues')
 
Loading
Loading
@@ -75,7 +75,7 @@ describe Gitlab::ProjectSearchResults, lib: true do
expect(results.issues_count).to eq 2
end
 
it 'should list project confidential issues for project members' do
it 'lists project confidential issues for project members' do
project.team << [member, :developer]
 
results = described_class.new(member, project, query)
Loading
Loading
@@ -87,7 +87,7 @@ describe Gitlab::ProjectSearchResults, lib: true do
expect(results.issues_count).to eq 3
end
 
it 'should list all project issues for admin' do
it 'lists all project issues for admin' do
results = described_class.new(admin, project, query)
issues = results.objects('issues')
 
Loading
Loading
Loading
Loading
@@ -67,7 +67,7 @@ describe Gitlab::Saml::User, lib: true do
end
 
context 'user was external, now should not be' do
it 'should make user internal' do
it 'makes user internal' do
existing_user.update_attribute('external', true)
saml_user.save
expect(gl_user).to be_valid
Loading
Loading
@@ -94,14 +94,14 @@ describe Gitlab::Saml::User, lib: true do
 
context 'with allow_single_sign_on default (["saml"])' do
before { stub_omniauth_config(allow_single_sign_on: ['saml']) }
it 'should not throw an error' do
it 'does not throw an error' do
expect{ saml_user.save }.not_to raise_error
end
end
 
context 'with allow_single_sign_on disabled' do
before { stub_omniauth_config(allow_single_sign_on: false) }
it 'should throw an error' do
it 'throws an error' do
expect{ saml_user.save }.to raise_error StandardError
end
end
Loading
Loading
@@ -223,7 +223,7 @@ describe Gitlab::Saml::User, lib: true do
context 'dont block on create' do
before { stub_omniauth_config(block_auto_created_users: false) }
 
it 'should not block the user' do
it 'does not block the user' do
saml_user.save
expect(gl_user).to be_valid
expect(gl_user).not_to be_blocked
Loading
Loading
@@ -233,7 +233,7 @@ describe Gitlab::Saml::User, lib: true do
context 'block on create' do
before { stub_omniauth_config(block_auto_created_users: true) }
 
it 'should block user' do
it 'blocks user' do
saml_user.save
expect(gl_user).to be_valid
expect(gl_user).to be_blocked
Loading
Loading
Loading
Loading
@@ -73,7 +73,7 @@ describe Gitlab::SearchResults do
let!(:security_issue_4) { create(:issue, :confidential, project: project_3, title: 'Security issue 4', assignee: assignee) }
let!(:security_issue_5) { create(:issue, :confidential, project: project_4, title: 'Security issue 5') }
 
it 'should not list confidential issues for non project members' do
it 'does not list confidential issues for non project members' do
results = described_class.new(non_member, limit_projects, query)
issues = results.objects('issues')
 
Loading
Loading
@@ -86,7 +86,7 @@ describe Gitlab::SearchResults do
expect(results.issues_count).to eq 1
end
 
it 'should not list confidential issues for project members with guest role' do
it 'does not list confidential issues for project members with guest role' do
project_1.team << [member, :guest]
project_2.team << [member, :guest]
 
Loading
Loading
@@ -102,7 +102,7 @@ describe Gitlab::SearchResults do
expect(results.issues_count).to eq 1
end
 
it 'should list confidential issues for author' do
it 'lists confidential issues for author' do
results = described_class.new(author, limit_projects, query)
issues = results.objects('issues')
 
Loading
Loading
@@ -115,7 +115,7 @@ describe Gitlab::SearchResults do
expect(results.issues_count).to eq 3
end
 
it 'should list confidential issues for assignee' do
it 'lists confidential issues for assignee' do
results = described_class.new(assignee, limit_projects, query)
issues = results.objects('issues')
 
Loading
Loading
@@ -128,7 +128,7 @@ describe Gitlab::SearchResults do
expect(results.issues_count).to eq 3
end
 
it 'should list confidential issues for project members' do
it 'lists confidential issues for project members' do
project_1.team << [member, :developer]
project_2.team << [member, :developer]
 
Loading
Loading
@@ -144,7 +144,7 @@ describe Gitlab::SearchResults do
expect(results.issues_count).to eq 4
end
 
it 'should list all issues for admin' do
it 'lists all issues for admin' do
results = described_class.new(admin, limit_projects, query)
issues = results.objects('issues')
 
Loading
Loading
Loading
Loading
@@ -9,19 +9,19 @@ describe Gitlab::Upgrader, lib: true do
end
 
describe 'latest_version?' do
it 'should be true if newest version' do
it 'is true if newest version' do
allow(upgrader).to receive(:latest_version_raw).and_return(current_version)
expect(upgrader.latest_version?).to be_truthy
end
end
 
describe 'latest_version_raw' do
it 'should be latest version for GitLab 5' do
it 'is the latest version for GitLab 5' do
allow(upgrader).to receive(:current_version_raw).and_return("5.3.0")
expect(upgrader.latest_version_raw).to eq("v5.4.2")
end
 
it 'should get the latest version from tags' do
it 'gets the latest version from tags' do
allow(upgrader).to receive(:fetch_git_tags).and_return([
'6f0733310546402c15d3ae6128a95052f6c8ea96 refs/tags/v7.1.1',
'facfec4b242ce151af224e20715d58e628aa5e74 refs/tags/v7.1.1^{}',
Loading
Loading
Loading
Loading
@@ -48,7 +48,7 @@ describe Notify do
it_behaves_like 'it should not have Gmail Actions links'
it_behaves_like 'a user cannot unsubscribe through footer link'
 
it 'should not contain the new user\'s password' do
it 'does not contain the new user\'s password' do
is_expected.not_to have_body_text /password/
end
end
Loading
Loading
Loading
Loading
@@ -591,7 +591,7 @@ describe Notify do
is_expected.to have_body_text /#{note.note}/
end
 
it 'not contains note author' do
it 'does not contain note author' do
is_expected.not_to have_body_text /wrote\:/
end
 
Loading
Loading
Loading
Loading
@@ -53,59 +53,59 @@ describe ApplicationSetting, models: true do
end
 
context 'restricted signup domains' do
it 'set single domain' do
it 'sets single domain' do
setting.domain_whitelist_raw = 'example.com'
expect(setting.domain_whitelist).to eq(['example.com'])
end
 
it 'set multiple domains with spaces' do
it 'sets multiple domains with spaces' do
setting.domain_whitelist_raw = 'example.com *.example.com'
expect(setting.domain_whitelist).to eq(['example.com', '*.example.com'])
end
 
it 'set multiple domains with newlines and a space' do
it 'sets multiple domains with newlines and a space' do
setting.domain_whitelist_raw = "example.com\n *.example.com"
expect(setting.domain_whitelist).to eq(['example.com', '*.example.com'])
end
 
it 'set multiple domains with commas' do
it 'sets multiple domains with commas' do
setting.domain_whitelist_raw = "example.com, *.example.com"
expect(setting.domain_whitelist).to eq(['example.com', '*.example.com'])
end
end
 
context 'blacklisted signup domains' do
it 'set single domain' do
it 'sets single domain' do
setting.domain_blacklist_raw = 'example.com'
expect(setting.domain_blacklist).to contain_exactly('example.com')
end
 
it 'set multiple domains with spaces' do
it 'sets multiple domains with spaces' do
setting.domain_blacklist_raw = 'example.com *.example.com'
expect(setting.domain_blacklist).to contain_exactly('example.com', '*.example.com')
end
 
it 'set multiple domains with newlines and a space' do
it 'sets multiple domains with newlines and a space' do
setting.domain_blacklist_raw = "example.com\n *.example.com"
expect(setting.domain_blacklist).to contain_exactly('example.com', '*.example.com')
end
 
it 'set multiple domains with commas' do
it 'sets multiple domains with commas' do
setting.domain_blacklist_raw = "example.com, *.example.com"
expect(setting.domain_blacklist).to contain_exactly('example.com', '*.example.com')
end
 
it 'set multiple domains with semicolon' do
it 'sets multiple domains with semicolon' do
setting.domain_blacklist_raw = "example.com; *.example.com"
expect(setting.domain_blacklist).to contain_exactly('example.com', '*.example.com')
end
 
it 'set multiple domains with mixture of everything' do
it 'sets multiple domains with mixture of everything' do
setting.domain_blacklist_raw = "example.com; *.example.com\n test.com\sblock.com yes.com"
expect(setting.domain_blacklist).to contain_exactly('example.com', '*.example.com', 'test.com', 'block.com', 'yes.com')
end
 
it 'set multiple domain with file' do
it 'sets multiple domain with file' do
setting.domain_blacklist_file = File.open(Rails.root.join('spec/fixtures/', 'domain_blacklist.txt'))
expect(setting.domain_blacklist).to contain_exactly('example.com', 'test.com', 'foo.bar')
end
Loading
Loading
Loading
Loading
@@ -23,19 +23,19 @@ describe BroadcastMessage, models: true do
end
 
describe '.current' do
it "should return last message if time match" do
it "returns last message if time match" do
message = create(:broadcast_message)
 
expect(BroadcastMessage.current).to eq message
end
 
it "should return nil if time not come" do
it "returns nil if time not come" do
create(:broadcast_message, :future)
 
expect(BroadcastMessage.current).to be_nil
end
 
it "should return nil if time has passed" do
it "returns nil if time has passed" do
create(:broadcast_message, :expired)
 
expect(BroadcastMessage.current).to be_nil
Loading
Loading
Loading
Loading
@@ -32,7 +32,7 @@ describe Ci::Build, models: true do
end
let(:create_from_build) { Ci::Build.create_from build }
 
it 'there should be a pending task' do
it 'exists a pending task' do
expect(Ci::Build.pending.count(:all)).to eq 0
create_from_build
expect(Ci::Build.pending.count(:all)).to be > 0
Loading
Loading
@@ -573,19 +573,19 @@ describe Ci::Build, models: true do
let!(:rubocop_test) { create(:ci_build, pipeline: pipeline, name: 'rubocop', stage_idx: 1, stage: 'test') }
let!(:staging) { create(:ci_build, pipeline: pipeline, name: 'staging', stage_idx: 2, stage: 'deploy') }
 
it 'to have no dependents if this is first build' do
it 'expects to have no dependents if this is first build' do
expect(build.depends_on_builds).to be_empty
end
 
it 'to have one dependent if this is test' do
it 'expects to have one dependent if this is test' do
expect(rspec_test.depends_on_builds.map(&:id)).to contain_exactly(build.id)
end
 
it 'to have all builds from build and test stage if this is last' do
it 'expects to have all builds from build and test stage if this is last' do
expect(staging.depends_on_builds.map(&:id)).to contain_exactly(build.id, rspec_test.id, rubocop_test.id)
end
 
it 'to have retried builds instead the original ones' do
it 'expects to have retried builds instead the original ones' do
retried_rspec = Ci::Build.retry(rspec_test)
expect(staging.depends_on_builds.map(&:id)).to contain_exactly(build.id, retried_rspec.id, rubocop_test.id)
end
Loading
Loading
@@ -655,23 +655,23 @@ describe Ci::Build, models: true do
 
describe 'build erasable' do
shared_examples 'erasable' do
it 'should remove artifact file' do
it 'removes artifact file' do
expect(build.artifacts_file.exists?).to be_falsy
end
 
it 'should remove artifact metadata file' do
it 'removes artifact metadata file' do
expect(build.artifacts_metadata.exists?).to be_falsy
end
 
it 'should erase build trace in trace file' do
it 'erases build trace in trace file' do
expect(build.trace).to be_empty
end
 
it 'should set erased to true' do
it 'sets erased to true' do
expect(build.erased?).to be true
end
 
it 'should set erase date' do
it 'sets erase date' do
expect(build.erased_at).not_to be_falsy
end
end
Loading
Loading
@@ -704,7 +704,7 @@ describe Ci::Build, models: true do
 
include_examples 'erasable'
 
it 'should record user who erased a build' do
it 'records user who erased a build' do
expect(build.erased_by).to eq user
end
end
Loading
Loading
@@ -714,7 +714,7 @@ describe Ci::Build, models: true do
 
include_examples 'erasable'
 
it 'should not set user who erased a build' do
it 'does not set user who erased a build' do
expect(build.erased_by).to be_nil
end
end
Loading
Loading
@@ -750,7 +750,7 @@ describe Ci::Build, models: true do
end
 
describe '#erase' do
it 'should not raise error' do
it 'does not raise error' do
expect { build.erase }.not_to raise_error
end
end
Loading
Loading
@@ -900,7 +900,7 @@ describe Ci::Build, models: true do
context 'when build is running' do
before { build.run! }
 
it 'should return false' do
it 'returns false' do
expect(build.retryable?).to be false
end
end
Loading
Loading
@@ -908,7 +908,7 @@ describe Ci::Build, models: true do
context 'when build is finished' do
before { build.success! }
 
it 'should return true' do
it 'returns true' do
expect(build.retryable?).to be true
end
end
Loading
Loading
Loading
Loading
@@ -427,7 +427,7 @@ describe Ci::Pipeline, models: true do
end
 
describe '#update_state' do
it 'execute update_state after touching object' do
it 'executes update_state after touching object' do
expect(pipeline).to receive(:update_state).and_return(true)
pipeline.touch
end
Loading
Loading
@@ -435,7 +435,7 @@ describe Ci::Pipeline, models: true do
context 'dependent objects' do
let(:commit_status) { build :commit_status, pipeline: pipeline }
 
it 'execute update_state after saving dependent object' do
it 'executes update_state after saving dependent object' do
expect(pipeline).to receive(:update_state).and_return(true)
commit_status.save
end
Loading
Loading
@@ -513,7 +513,7 @@ describe Ci::Pipeline, models: true do
create :ci_build, :success, pipeline: pipeline, name: 'rspec'
create :ci_build, :allowed_to_fail, :failed, pipeline: pipeline, name: 'rubocop'
end
it 'returns true' do
is_expected.to be_truthy
end
Loading
Loading
@@ -524,7 +524,7 @@ describe Ci::Pipeline, models: true do
create :ci_build, :success, pipeline: pipeline, name: 'rspec'
create :ci_build, :allowed_to_fail, :success, pipeline: pipeline, name: 'rubocop'
end
it 'returns false' do
is_expected.to be_falsey
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment