Commit 185d3db2 authored by Rémy Coutable's avatar Rémy Coutable

Use described_class when possible

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent dc713897
......@@ -5,37 +5,37 @@ describe Settings do
describe '#host_without_www' do
context 'URL with protocol' do
it 'returns the host' do
expect(Settings.host_without_www('http://foo.com')).to eq 'foo.com'
expect(Settings.host_without_www('http://www.foo.com')).to eq 'foo.com'
expect(Settings.host_without_www('http://secure.foo.com')).to eq 'secure.foo.com'
expect(Settings.host_without_www('http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon')).to eq 'gravatar.com'
expect(described_class.host_without_www('http://foo.com')).to eq 'foo.com'
expect(described_class.host_without_www('http://www.foo.com')).to eq 'foo.com'
expect(described_class.host_without_www('http://secure.foo.com')).to eq 'secure.foo.com'
expect(described_class.host_without_www('http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon')).to eq 'gravatar.com'
expect(Settings.host_without_www('https://foo.com')).to eq 'foo.com'
expect(Settings.host_without_www('https://www.foo.com')).to eq 'foo.com'
expect(Settings.host_without_www('https://secure.foo.com')).to eq 'secure.foo.com'
expect(Settings.host_without_www('https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon')).to eq 'secure.gravatar.com'
expect(described_class.host_without_www('https://foo.com')).to eq 'foo.com'
expect(described_class.host_without_www('https://www.foo.com')).to eq 'foo.com'
expect(described_class.host_without_www('https://secure.foo.com')).to eq 'secure.foo.com'
expect(described_class.host_without_www('https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon')).to eq 'secure.gravatar.com'
end
end
context 'URL without protocol' do
it 'returns the host' do
expect(Settings.host_without_www('foo.com')).to eq 'foo.com'
expect(Settings.host_without_www('www.foo.com')).to eq 'foo.com'
expect(Settings.host_without_www('secure.foo.com')).to eq 'secure.foo.com'
expect(Settings.host_without_www('www.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon')).to eq 'gravatar.com'
expect(described_class.host_without_www('foo.com')).to eq 'foo.com'
expect(described_class.host_without_www('www.foo.com')).to eq 'foo.com'
expect(described_class.host_without_www('secure.foo.com')).to eq 'secure.foo.com'
expect(described_class.host_without_www('www.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon')).to eq 'gravatar.com'
end
context 'URL with user/port' do
it 'returns the host' do
expect(Settings.host_without_www('bob:pass@foo.com:8080')).to eq 'foo.com'
expect(Settings.host_without_www('bob:pass@www.foo.com:8080')).to eq 'foo.com'
expect(Settings.host_without_www('bob:pass@secure.foo.com:8080')).to eq 'secure.foo.com'
expect(Settings.host_without_www('bob:pass@www.gravatar.com:8080/avatar/%{hash}?s=%{size}&d=identicon')).to eq 'gravatar.com'
expect(described_class.host_without_www('bob:pass@foo.com:8080')).to eq 'foo.com'
expect(described_class.host_without_www('bob:pass@www.foo.com:8080')).to eq 'foo.com'
expect(described_class.host_without_www('bob:pass@secure.foo.com:8080')).to eq 'secure.foo.com'
expect(described_class.host_without_www('bob:pass@www.gravatar.com:8080/avatar/%{hash}?s=%{size}&d=identicon')).to eq 'gravatar.com'
expect(Settings.host_without_www('http://bob:pass@foo.com:8080')).to eq 'foo.com'
expect(Settings.host_without_www('http://bob:pass@www.foo.com:8080')).to eq 'foo.com'
expect(Settings.host_without_www('http://bob:pass@secure.foo.com:8080')).to eq 'secure.foo.com'
expect(Settings.host_without_www('http://bob:pass@www.gravatar.com:8080/avatar/%{hash}?s=%{size}&d=identicon')).to eq 'gravatar.com'
expect(described_class.host_without_www('http://bob:pass@foo.com:8080')).to eq 'foo.com'
expect(described_class.host_without_www('http://bob:pass@www.foo.com:8080')).to eq 'foo.com'
expect(described_class.host_without_www('http://bob:pass@secure.foo.com:8080')).to eq 'secure.foo.com'
expect(described_class.host_without_www('http://bob:pass@www.gravatar.com:8080/avatar/%{hash}?s=%{size}&d=identicon')).to eq 'gravatar.com'
end
end
end
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
describe CsvBuilder do
let(:object) { double(question: :answer) }
let(:fake_relation) { FakeRelation.new([object]) }
let(:subject) { CsvBuilder.new(fake_relation, 'Q & A' => :question, 'Reversed' => -> (o) { o.question.to_s.reverse }) }
let(:subject) { described_class.new(fake_relation, 'Q & A' => :question, 'Reversed' => -> (o) { o.question.to_s.reverse }) }
let(:csv_data) { subject.render }
class FakeRelation < Array
......@@ -87,7 +87,7 @@ describe CsvBuilder do
let(:dangerous_title) { double(title: "=cmd|' /C calc'!A0 title", description: "*safe_desc") }
let(:dangerous_desc) { double(title: "*safe_title", description: "=cmd|' /C calc'!A0 desc") }
let(:fake_relation) { FakeRelation.new([dangerous_title, dangerous_desc]) }
let(:subject) { CsvBuilder.new(fake_relation, 'Title' => 'title', 'Description' => 'description') }
let(:subject) { described_class.new(fake_relation, 'Title' => 'title', 'Description' => 'description') }
let(:csv_data) { subject.render }
it 'sanitizes dangerous characters at the beginning of a column' do
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe DisableEmailInterceptor do
before do
Mail.register_interceptor(DisableEmailInterceptor)
Mail.register_interceptor(described_class)
end
it 'does not send emails' do
......@@ -14,7 +14,7 @@ describe DisableEmailInterceptor do
# Removing interceptor from the list because unregister_interceptor is
# implemented in later version of mail gem
# See: https://github.com/mikel/mail/pull/705
Mail.unregister_interceptor(DisableEmailInterceptor)
Mail.unregister_interceptor(described_class)
end
def deliver_mail
......
......@@ -4,7 +4,7 @@ describe Gitlab::LDAP::Adapter do
include LdapHelpers
it 'includes the EE module' do
expect(Gitlab::LDAP::Adapter).to include_module(EE::Gitlab::LDAP::Adapter)
expect(described_class).to include_module(EE::Gitlab::LDAP::Adapter)
end
let(:adapter) { ldap_adapter('ldapmain') }
......
......@@ -21,7 +21,7 @@ describe EE::Gitlab::LDAP::Group do
range_start: '3',
range_end: '*'
)
group = EE::Gitlab::LDAP::Group.new(group_entry_page1, adapter)
group = described_class.new(group_entry_page1, adapter)
stub_ldap_adapter_group_members_in_range(group_entry_page2, adapter, range_start: '3')
stub_ldap_adapter_nested_groups(group.dn, [], adapter)
......@@ -54,7 +54,7 @@ describe EE::Gitlab::LDAP::Group do
member_of: group1_entry.dn
)
end
let(:group) { EE::Gitlab::LDAP::Group.new(group1_entry, adapter) }
let(:group) { described_class.new(group1_entry, adapter) }
it 'resolves the correct member_dns when there are nested groups' do
group3_entry = ldap_group_entry(
......
......@@ -21,7 +21,7 @@ describe EE::Gitlab::LDAP::Sync::Group do
it 'uses the ldap sync state machine' do
expect(group).to receive(:start_ldap_sync)
expect(group).to receive(:finish_ldap_sync)
expect(EE::Gitlab::LDAP::Sync::Group)
expect(described_class)
.to receive(:new).at_most(:twice).and_call_original
execute
......@@ -51,7 +51,7 @@ describe EE::Gitlab::LDAP::Sync::Group do
it 'does not update permissions' do
group.start_ldap_sync
expect_any_instance_of(EE::Gitlab::LDAP::Sync::Group)
expect_any_instance_of(described_class)
.not_to receive(:update_permissions)
execute
......
......@@ -5,7 +5,7 @@ describe EE::Gitlab::LDAP::Sync::Proxy do
include LdapHelpers
let(:adapter) { ldap_adapter }
let(:sync_proxy) { EE::Gitlab::LDAP::Sync::Proxy.new('ldapmain', adapter) }
let(:sync_proxy) { described_class.new('ldapmain', adapter) }
before do
stub_ldap_config(active_directory: false)
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe Gitlab::OAuth::AuthHash do
let(:auth_hash) do
Gitlab::OAuth::AuthHash.new(
described_class.new(
OmniAuth::AuthHash.new(
provider: ascii('kerberos'),
uid: ascii(uid),
......
......@@ -10,7 +10,7 @@ describe Gitlab::OAuth::User do
let(:base_dn) { 'ou=users,dc=ad,dc=example,dc=com' }
let(:info_hash) { { email: uid + '@' + realm, username: uid } }
let(:auth_hash) { OmniAuth::AuthHash.new(uid: uid, provider: provider, info: info_hash) }
let(:oauth_user) { Gitlab::OAuth::User.new(auth_hash) }
let(:oauth_user) { described_class.new(auth_hash) }
let(:real_email) { 'myname@example.com' }
before do
......
......@@ -16,42 +16,42 @@ describe EventFilter do
let!(:left_event) { create(:event, :left, project: public_project, target: public_project, author: source_user) }
it 'applies push filter' do
events = EventFilter.new(EventFilter.push).apply_filter(Event.all)
events = described_class.new(described_class.push).apply_filter(Event.all)
expect(events).to contain_exactly(push_event)
end
it 'applies merged filter' do
events = EventFilter.new(EventFilter.merged).apply_filter(Event.all)
events = described_class.new(described_class.merged).apply_filter(Event.all)
expect(events).to contain_exactly(merged_event)
end
it 'applies issue filter' do
events = EventFilter.new(EventFilter.issue).apply_filter(Event.all)
events = described_class.new(described_class.issue).apply_filter(Event.all)
expect(events).to contain_exactly(created_event, updated_event, closed_event, reopened_event)
end
it 'applies comments filter' do
events = EventFilter.new(EventFilter.comments).apply_filter(Event.all)
events = described_class.new(described_class.comments).apply_filter(Event.all)
expect(events).to contain_exactly(comments_event)
end
it 'applies team filter' do
events = EventFilter.new(EventFilter.team).apply_filter(Event.all)
events = described_class.new(described_class.team).apply_filter(Event.all)
expect(events).to contain_exactly(joined_event, left_event)
end
it 'applies all filter' do
events = EventFilter.new(EventFilter.all).apply_filter(Event.all)
events = described_class.new(described_class.all).apply_filter(Event.all)
expect(events).to contain_exactly(push_event, merged_event, created_event, updated_event, closed_event, reopened_event, comments_event, joined_event, left_event)
end
it 'applies no filter' do
events = EventFilter.new(nil).apply_filter(Event.all)
events = described_class.new(nil).apply_filter(Event.all)
expect(events).to contain_exactly(push_event, merged_event, created_event, updated_event, closed_event, reopened_event, comments_event, joined_event, left_event)
end
it 'applies unknown filter' do
events = EventFilter.new('').apply_filter(Event.all)
events = described_class.new('').apply_filter(Event.all)
expect(events).to contain_exactly(push_event, merged_event, created_event, updated_event, closed_event, reopened_event, comments_event, joined_event, left_event)
end
end
......
require 'spec_helper'
describe ExtractsPath do
include ExtractsPath
include described_class
include RepoHelpers
include Gitlab::Routing
......
require 'spec_helper'
describe FileSizeValidator do
let(:validator) { FileSizeValidator.new(options) }
let(:validator) { described_class.new(options) }
let(:attachment) { AttachmentUploader.new }
let(:note) { create(:note) }
......
......@@ -19,7 +19,7 @@ describe Gitlab::AuthorityAnalyzer do
]
end
let(:approvers) { Gitlab::AuthorityAnalyzer.new(merge_request, author).calculate(number_of_approvers) }
let(:approvers) { described_class.new(merge_request, author).calculate(number_of_approvers) }
before do
merge_request.compare = double(:compare, raw_diffs: files)
......
......@@ -58,7 +58,7 @@ describe Gitlab::BitbucketImport::Importer do
)
end
let(:importer) { Gitlab::BitbucketImport::Importer.new(project) }
let(:importer) { described_class.new(project) }
let(:issues_statuses_sample_data) do
{
......
......@@ -27,7 +27,7 @@ describe Gitlab::BitbucketImport::ProjectCreator do
it 'creates project' do
allow_any_instance_of(EE::Project).to receive(:add_import_job)
project_creator = Gitlab::BitbucketImport::ProjectCreator.new(repo, 'vim', namespace, user, access_params)
project_creator = described_class.new(repo, 'vim', namespace, user, access_params)
project = project_creator.execute
expect(project.import_url).to eq("ssh://git@bitbucket.org/asd/vim.git")
......
require 'spec_helper'
describe Gitlab::CiAccess do
let(:access) { Gitlab::CiAccess.new }
let(:access) { described_class.new }
describe '#can_do_action?' do
context 'when action is :build_download_code' do
......
......@@ -10,7 +10,7 @@ describe Gitlab::Conflict::File do
let(:index) { rugged.merge_commits(our_commit, their_commit) }
let(:conflict) { index.conflicts.last }
let(:merge_file_result) { index.merge_file('files/ruby/regex.rb') }
let(:conflict_file) { Gitlab::Conflict::File.new(merge_file_result, conflict, merge_request: merge_request) }
let(:conflict_file) { described_class.new(merge_file_result, conflict, merge_request: merge_request) }
describe '#resolve_lines' do
let(:section_keys) { conflict_file.sections.map { |section| section[:id] }.compact }
......@@ -220,7 +220,7 @@ end
FILE
end
let(:conflict_file) { Gitlab::Conflict::File.new({ data: file }, conflict, merge_request: merge_request) }
let(:conflict_file) { described_class.new({ data: file }, conflict, merge_request: merge_request) }
let(:sections) { conflict_file.sections }
it 'sets the correct match line headers' do
......
require 'spec_helper'
describe Gitlab::Conflict::Parser do
let(:parser) { Gitlab::Conflict::Parser.new }
let(:parser) { described_class.new }
describe '#parse' do
def parse_text(text)
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
describe Gitlab::Database::MigrationHelpers do
let(:model) do
ActiveRecord::Migration.new.extend(
Gitlab::Database::MigrationHelpers
described_class
)
end
......
......@@ -10,7 +10,7 @@ describe Gitlab::Diff::Highlight do
describe '#highlight' do
context "with a diff file" do
let(:subject) { Gitlab::Diff::Highlight.new(diff_file, repository: project.repository).highlight }
let(:subject) { described_class.new(diff_file, repository: project.repository).highlight }
it 'returns Gitlab::Diff::Line elements' do
expect(subject.first).to be_an_instance_of(Gitlab::Diff::Line)
......@@ -41,7 +41,7 @@ describe Gitlab::Diff::Highlight do
end
context "with diff lines" do
let(:subject) { Gitlab::Diff::Highlight.new(diff_file.diff_lines, repository: project.repository).highlight }
let(:subject) { described_class.new(diff_file.diff_lines, repository: project.repository).highlight }
it 'returns Gitlab::Diff::Line elements' do
expect(subject.first).to be_an_instance_of(Gitlab::Diff::Line)
......
......@@ -6,7 +6,7 @@ describe Gitlab::Diff::Parser do
let(:project) { create(:project) }
let(:commit) { project.commit(sample_commit.id) }
let(:diff) { commit.raw_diffs.first }
let(:parser) { Gitlab::Diff::Parser.new }
let(:parser) { described_class.new }
describe '#parse' do
let(:diff) do
......
......@@ -53,12 +53,12 @@ describe Gitlab::Elastic::ProjectSearchResults do
Gitlab::Elastic::Helper.refresh_index
result = Gitlab::Elastic::ProjectSearchResults.new(user, 'term', project.id)
result = described_class.new(user, 'term', project.id)
expect(result.notes_count).to eq(1)
expect(result.wiki_blobs_count).to eq(1)
expect(result.blobs_count).to eq(1)
result1 = Gitlab::Elastic::ProjectSearchResults.new(user, 'initial', project.id)
result1 = described_class.new(user, 'initial', project.id)
expect(result1.commits_count).to eq(1)
end
......@@ -74,7 +74,7 @@ describe Gitlab::Elastic::ProjectSearchResults do
Gitlab::Elastic::Helper.refresh_index
result = Gitlab::Elastic::ProjectSearchResults.new(guest, 'term', project.id)
result = described_class.new(guest, 'term', project.id)
expect(result.wiki_blobs_count).to eq(1)
end
end
......@@ -126,7 +126,7 @@ describe Gitlab::Elastic::ProjectSearchResults do
describe 'search for blobs in non-default branch' do
let(:project) { create(:project, :public, :repository_private) }
let(:result) { Gitlab::Elastic::ProjectSearchResults.new(user, 'initial', project.id, 'test') }
let(:result) { described_class.new(user, 'initial', project.id, 'test') }
subject(:blobs) { result.objects('blobs') }
......
......@@ -358,7 +358,7 @@ describe Gitlab::Elastic::SearchResults do
Gitlab::Elastic::Helper.refresh_index
result = Gitlab::Elastic::SearchResults.new(user, 'term', [project.id])
result = described_class.new(user, 'term', [project.id])
expect(result.issues_count).to eq(2)
expect(result.merge_requests_count).to eq(2)
......
......@@ -5,7 +5,7 @@ describe Gitlab::Git::Hook do
before do
# We need this because in the spec/spec_helper.rb we define it like this:
# allow_any_instance_of(Gitlab::Git::Hook).to receive(:trigger).and_return([true, nil])
allow_any_instance_of(Gitlab::Git::Hook).to receive(:trigger).and_call_original
allow_any_instance_of(described_class).to receive(:trigger).and_call_original
end
describe "#trigger" do
......@@ -48,7 +48,7 @@ describe Gitlab::Git::Hook do
it "returns success with no errors" do
create_hook(hook_name)
hook = Gitlab::Git::Hook.new(hook_name, project)
hook = described_class.new(hook_name, project)
blank = Gitlab::Git::BLANK_SHA
ref = Gitlab::Git::BRANCH_REF_PREFIX + 'new_branch'
......@@ -66,7 +66,7 @@ describe Gitlab::Git::Hook do
context "when the hook is unsuccessful" do
it "returns failure with errors" do
create_failing_hook(hook_name)
hook = Gitlab::Git::Hook.new(hook_name, project)
hook = described_class.new(hook_name, project)
blank = Gitlab::Git::BLANK_SHA
ref = Gitlab::Git::BRANCH_REF_PREFIX + 'new_branch'
......@@ -80,7 +80,7 @@ describe Gitlab::Git::Hook do
context "when the hook doesn't exist" do
it "returns success with no errors" do
hook = Gitlab::Git::Hook.new('unknown_hook', project)
hook = described_class.new('unknown_hook', project)
blank = Gitlab::Git::BLANK_SHA
ref = Gitlab::Git::BRANCH_REF_PREFIX + 'new_branch'
......
......@@ -11,7 +11,7 @@ describe Gitlab::Git::RevList do
end
context "#new_refs" do
let(:rev_list) { Gitlab::Git::RevList.new(newrev: 'newrev', path_to_repo: project.repository.path_to_repo) }
let(:rev_list) { described_class.new(newrev: 'newrev', path_to_repo: project.repository.path_to_repo) }
it 'calls out to `popen`' do
expect(Gitlab::Popen).to receive(:popen).with([
......@@ -33,7 +33,7 @@ describe Gitlab::Git::RevList do
end
context "#missed_ref" do
let(:rev_list) { Gitlab::Git::RevList.new(oldrev: 'oldrev', newrev: 'newrev', path_to_repo: project.repository.path_to_repo) }
let(:rev_list) { described_class.new(oldrev: 'oldrev', newrev: 'newrev', path_to_repo: project.repository.path_to_repo) }
it 'calls out to `popen`' do
expect(Gitlab::Popen).to receive(:popen).with([
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
describe Gitlab::GitAccess do
let(:pull_access_check) { access.check('git-upload-pack', '_any') }
let(:push_access_check) { access.check('git-receive-pack', '_any') }
let(:access) { Gitlab::GitAccess.new(actor, project, protocol, authentication_abilities: authentication_abilities, redirected_path: redirected_path) }
let(:access) { described_class.new(actor, project, protocol, authentication_abilities: authentication_abilities, redirected_path: redirected_path) }
let(:project) { create(:project, :repository) }
let(:user) { create(:user) }
let(:actor) { user }
......@@ -280,7 +280,7 @@ describe Gitlab::GitAccess do
context 'when project is public' do
let(:public_project) { create(:project, :public, :repository) }
let(:access) { Gitlab::GitAccess.new(nil, public_project, 'web', authentication_abilities: []) }
let(:access) { described_class.new(nil, public_project, 'web', authentication_abilities: []) }
context 'when repository is enabled' do
it 'give access to download code' do
......@@ -453,7 +453,7 @@ describe Gitlab::GitAccess do
end
permissions_matrix[role].each do |action, allowed|
context action do
context action.to_s do
subject { access.send(:check_push_access!, changes[action]) }
it do
......@@ -480,7 +480,7 @@ describe Gitlab::GitAccess do
end
permissions_matrix[role].each do |action, allowed|
context action do
context action.to_s do
subject { access.send(:check_push_access!, changes[action]) }
it do
......
require 'spec_helper'
describe Gitlab::GitAccessWiki do
let(:access) { Gitlab::GitAccessWiki.new(user, project, 'web', authentication_abilities: authentication_abilities, redirected_path: redirected_path) }
let(:access) { described_class.new(user, project, 'web', authentication_abilities: authentication_abilities, redirected_path: redirected_path) }
let!(:project) { create(:project, :repository) }
let(:user) { create(:user) }
let(:changes) { ['6f6d7e7ed 570e7b2ab refs/heads/master'] }
......
require 'spec_helper'
describe Gitlab::GitRefValidator do
it { expect(Gitlab::GitRefValidator.validate('feature/new')).to be_truthy }
it { expect(Gitlab::GitRefValidator.validate('implement_@all')).to be_truthy }
it { expect(Gitlab::GitRefValidator.validate('my_new_feature')).to be_truthy }
it { expect(Gitlab::GitRefValidator.validate('#1')).to be_truthy }
it { expect(Gitlab::GitRefValidator.validate('feature/refs/heads/foo')).to be_truthy }
it { expect(Gitlab::GitRefValidator.validate('feature/~new/')).to be_falsey }
it { expect(Gitlab::GitRefValidator.validate('feature/^new/')).to be_falsey }
it { expect(Gitlab::GitRefValidator.validate('feature/:new/')).to be_falsey }
it { expect(Gitlab::GitRefValidator.validate('feature/?new/')).to be_falsey }
it { expect(Gitlab::GitRefValidator.validate('feature/*new/')).to be_falsey }
it { expect(Gitlab::GitRefValidator.validate('feature/[new/')).to be_falsey }
it { expect(Gitlab::GitRefValidator.validate('feature/new/')).to be_falsey }
it { expect(Gitlab::GitRefValidator.validate('feature/new.')).to be_falsey }
it { expect(Gitlab::GitRefValidator.validate('feature\@{')).to be_falsey }
it { expect(Gitlab::GitRefValidator.validate('feature\new')).to be_falsey }
it { expect(Gitlab::GitRefValidator.validate('feature//new')).to be_falsey }
it { expect(Gitlab::GitRefValidator.validate('feature new')).to be_falsey }
it { expect(Gitlab::GitRefValidator.validate('refs/heads/')).to be_falsey }
it { expect(Gitlab::GitRefValidator.validate('refs/remotes/')).to be_falsey }
it { expect(Gitlab::GitRefValidator.validate('refs/heads/feature')).to be_falsey }
it { expect(Gitlab::GitRefValidator.validate('refs/remotes/origin')).to be_falsey }
it { expect(described_class.validate('feature/new')).to be_truthy }
it { expect(described_class.validate('implement_@all')).to be_truthy }
it { expect(described_class.validate('my_new_feature')).to be_truthy }
it { expect(described_class.validate('#1')).to be_truthy }
it { expect(described_class.validate('feature/refs/heads/foo')).to be_truthy }
it { expect(described_class.validate('feature/~new/')).to be_falsey }
it { expect(described_class.validate('feature/^new/')).to be_falsey }
it { expect(described_class.validate('feature/:new/')).to be_falsey }
it { expect(described_class.validate('feature/?new/')).to be_falsey }
it { expect(described_class.validate('feature/*new/')).to be_falsey }
it { expect(described_class.validate('feature/[new/')).to be_falsey }
it { expect(described_class.validate('feature/new/')).to be_falsey }
it { expect(described_class.validate('feature/new.')).to be_falsey }
it { expect(described_class.validate('feature\@{')).to be_falsey }
it { expect(described_class.validate('feature\new')).to be_falsey }
it { expect(described_class.validate('feature//new')).to be_falsey }
it { expect(described_class.validate('feature new')).to be_falsey }
it { expect(described_class.validate('refs/heads/')).to be_falsey }
it { expect(described_class.validate('refs/remotes/')).to be_falsey }
it { expect(described_class.validate('refs/heads/feature')).to be_falsey }
it { expect(described_class.validate('refs/remotes/origin')).to be_falsey }
end
......@@ -6,7 +6,7 @@ describe Gitlab::Git do
describe 'committer_hash' do
it "returns a hash containing the given email and name" do
committer_hash = Gitlab::Git.committer_hash(email: committer_email, name: committer_name)
committer_hash = described_class.committer_hash(email: committer_email, name: committer_name)
expect(committer_hash[:email]).to eq(committer_email)
expect(committer_hash[:name]).to eq(committer_name)
......@@ -15,7 +15,7 @@ describe Gitlab::Git do
context 'when email is nil' do
it "returns nil" do
committer_hash = Gitlab::Git.committer_hash(email: nil, name: committer_name)
committer_hash = described_class.committer_hash(email: nil, name: committer_name)
expect(committer_hash).to be_nil
end
......@@ -23,7 +23,7 @@ describe Gitlab::Git do
context 'when name is nil' do
it "returns nil" do
committer_hash = Gitlab::Git.committer_hash(email: committer_email, name: nil)
committer_hash = described_class.committer_hash(email: committer_email, name: nil)
expect(committer_hash).to be_nil
end
......
......@@ -4,7 +4,7 @@ describe Gitlab::GitlabImport::Client do
include ImportSpecHelper
let(:token) { '123456' }
let(:client) { Gitlab::GitlabImport::Client.new(token) }
let(:client) { described_class.new(token) }
before do
stub_omniauth_provider('gitlab')
......
......@@ -23,7 +23,7 @@ describe Gitlab::GitlabImport::ProjectCreator do
it 'creates project' do
allow_any_instance_of(EE::Project).to receive(:add_import_job)
project_creator = Gitlab::GitlabImport::ProjectCreator.new(repo, namespace, user, access_params)
project_creator = described_class.new(repo, namespace, user, access_params)
project = project_creator.execute
expect(project.import_url).to eq("https://oauth2:asdffg@gitlab.com/asd/vim.git")
......
......@@ -18,7 +18,7 @@ describe Gitlab::GoogleCodeImport::ProjectCreator do
it 'creates project' do
allow_any_instance_of(EE::Project).to receive(:add_import_job)
project_creator = Gitlab::GoogleCodeImport::ProjectCreator.new(repo, namespace, user)
project_creator = described_class.new(repo, namespace, user)
project = project_creator.execute
expect(project.import_url).to eq("https://vim.googlecode.com/git/")
......
......@@ -12,7 +12,7 @@ describe Gitlab::Highlight do
let(:blob) { repository.blob_at_branch(branch, path) }
let(:highlighter) do
Gitlab::Highlight.new(blob.path, blob.data, repository: repository)
described_class.new(blob.path, blob.data, repository: repository)
end
before do
......@@ -42,7 +42,7 @@ describe Gitlab::Highlight do
let(:path) { 'files/whitespace' }
let(:blob) { repository.blob_at_branch(branch, path) }
let(:lines) do
Gitlab::Highlight.highlight(blob.path, blob.data, repository: repository).lines
described_class.highlight(blob.path, blob.data, repository: repository).lines
end
it 'strips extra LFs' do
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe Gitlab::LDAP::Access do
include LdapHelpers
let(:access) { Gitlab::LDAP::Access.new user }
let(:access) { described_class.new user }
let(:user) { create(:omniauth_user) }
describe '.allowed?' do
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe Gitlab::LDAP::AuthHash do
let(:auth_hash) do
Gitlab::LDAP::AuthHash.new(
described_class.new(
OmniAuth::AuthHash.new(
uid: '123456',
provider: 'ldapmain',
......
......@@ -3,11 +3,11 @@ require 'spec_helper'
describe Gitlab::LDAP::Config do
include LdapHelpers
let(:config) { Gitlab::LDAP::Config.new('ldapmain') }
let(:config) { described_class.new('ldapmain') }
describe '#initalize' do
it 'requires a provider' do
expect{ Gitlab::LDAP::Config.new }.to raise_error ArgumentError
expect{ described_class.new }.to raise_error ArgumentError
end
it 'works' do
......@@ -15,7 +15,7 @@ describe Gitlab::LDAP::Config do
end
it "raises an error if a unknow provider is used" do
expect{ Gitlab::LDAP::Config.new 'unknown' }.to raise_error(Gitlab::LDAP::Config::InvalidProvider)
expect{ described_class.new 'unknown' }.to raise_error(Gitlab::LDAP::Config::InvalidProvider)
end
end
......
require 'spec_helper'
describe Gitlab::LDAP::User do
let(:ldap_user) { Gitlab::LDAP::User.new(auth_hash) }
let(:ldap_user) { described_class.new(auth_hash) }
let(:gl_user) { ldap_user.gl_user }
let(:info) do
{
......@@ -13,7 +13,7 @@ describe Gitlab::LDAP::User do
let(:auth_hash) do
OmniAuth::AuthHash.new(uid: 'my-uid', provider: 'ldapmain', info: info)
end
let(:ldap_user_upper_case) { Gitlab::LDAP::User.new(auth_hash_upper_case) }
let(:ldap_user_upper_case) { described_class.new(auth_hash_upper_case) }
let(:info_upper_case) do
{
name: 'John',
......
......@@ -5,36 +5,36 @@ describe Gitlab::MarkupHelper do
%w(textile rdoc org creole wiki
mediawiki rst adoc ad asciidoc mdown md markdown).each do |type|
it "returns true for #{type} files" do
expect(Gitlab::MarkupHelper.markup?("README.#{type}")).to be_truthy
expect(described_class.markup?("README.#{type}")).to be_truthy
end
end
it 'returns false when given a non-markup filename' do
expect(Gitlab::MarkupHelper.markup?('README.rb')).not_to be_truthy
expect(described_class.markup?('README.rb')).not_to be_truthy
end
end
describe '#gitlab_markdown?' do
%w(mdown mkd mkdn md markdown).each do |type|
it "returns true for #{type} files" do
expect(Gitlab::MarkupHelper.gitlab_markdown?("README.#{type}")).to be_truthy
expect(described_class.gitlab_markdown?("README.#{type}")).to be_truthy
end
end
it 'returns false when given a non-markdown filename' do
expect(Gitlab::MarkupHelper.gitlab_markdown?('README.rb')).not_to be_truthy
expect(described_class.gitlab_markdown?('README.rb')).not_to be_truthy
end
end
describe '#asciidoc?' do
%w(adoc ad asciidoc ADOC).each do |type|
it "returns true for #{type} files" do
expect(Gitlab::MarkupHelper.asciidoc?("README.#{type}")).to be_truthy
expect(described_class.asciidoc?("README.#{type}")).to be_truthy
end
end
it 'returns false when given a non-asciidoc filename' do
expect(Gitlab::MarkupHelper.asciidoc?('README.rb')).not_to be_truthy
expect(described_class.asciidoc?('README.rb')).not_to be_truthy
end
end
end
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe Gitlab::OAuth::AuthHash do
let(:auth_hash) do
Gitlab::OAuth::AuthHash.new(
described_class.new(
OmniAuth::AuthHash.new(
provider: provider_ascii,
uid: uid_ascii,
......
require 'spec_helper'
describe Gitlab::OAuth::User do
let(:oauth_user) { Gitlab::OAuth::User.new(auth_hash) }
let(:oauth_user) { described_class.new(auth_hash) }
let(:gl_user) { oauth_user.gl_user }
let(:uid) { 'my-uid' }
let(:provider) { 'my-provider' }
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
describe Gitlab::PathLocksFinder do
let(:project) { create :empty_project }
let(:user) { create :user }
let(:finder) { Gitlab::PathLocksFinder.new(project) }
let(:finder) { described_class.new(project) }
it "returns correct lock information" do
lock1 = create :path_lock, project: project, path: 'app'
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
describe Gitlab::ProjectTransfer do
before do
@root_dir = File.join(Rails.root, "public", "uploads")
@project_transfer = Gitlab::ProjectTransfer.new
@project_transfer = described_class.new
allow(@project_transfer).to receive(:root_dir).and_return(@root_dir)
@project_path_was = "test_project_was"
......
......@@ -7,7 +7,7 @@ describe Gitlab::ReferenceExtractor do
project.team << [project.creator, :developer]
end
subject { Gitlab::ReferenceExtractor.new(project, project.creator) }
subject { described_class.new(project, project.creator) }
it 'accesses valid user objects' do
@u_foo = create(:user, username: 'foo')
......
......@@ -5,7 +5,7 @@ describe Gitlab::RepositorySizeError do
create(:empty_project, statistics: build(:project_statistics, repository_size: 15.megabytes))
end
let(:message) { Gitlab::RepositorySizeError.new(project) }
let(:message) { described_class.new(project) }
let(:base_message) { 'because this repository has exceeded its size limit of 10 MB by 5 MB' }
before do
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe Gitlab::RequestContext do
describe '#client_ip' do
subject { Gitlab::RequestContext.client_ip }
subject { described_class.client_ip }
let(:app) { -> (env) {} }
let(:env) { Hash.new }
......@@ -16,7 +16,7 @@ describe Gitlab::RequestContext do
before do
allow_any_instance_of(Rack::Request).to receive(:ip).and_return(ip)
Gitlab::RequestContext.new(app).call(env)
described_class.new(app).call(env)
end
it { is_expected.to eq(ip) }
......
......@@ -3,7 +3,7 @@ require 'stringio'
describe Gitlab::Shell do
let(:project) { double('Project', id: 7, path: 'diaspora') }
let(:gitlab_shell) { Gitlab::Shell.new }
let(:gitlab_shell) { described_class.new }
let(:popen_vars) { { 'GIT_TERMINAL_PROMPT' => ENV['GIT_TERMINAL_PROMPT'] } }
before do
......@@ -30,7 +30,7 @@ describe Gitlab::Shell do
allow(Gitlab.config.gitlab_shell).to receive(:secret_file).and_return(secret_file)
allow(Gitlab.config.gitlab_shell).to receive(:path).and_return('tmp/tests/shell-secret-test')
FileUtils.mkdir('tmp/tests/shell-secret-test')
Gitlab::Shell.ensure_secret_token!
described_class.ensure_secret_token!
end
after do
......@@ -39,7 +39,7 @@ describe Gitlab::Shell do
end
it 'creates and links the secret token file' do
secret_token = Gitlab::Shell.secret_token
secret_token = described_class.secret_token
expect(File.exist?(secret_file)).to be(true)
expect(File.read(secret_file).chomp).to eq(secret_token)
......
require 'spec_helper'
describe Gitlab::Upgrader do
let(:upgrader) { Gitlab::Upgrader.new }
let(:upgrader) { described_class.new }
let(:current_version) { Gitlab::VERSION }
describe 'current_version_raw' do
......
require 'spec_helper'
describe Gitlab::UserAccess do
let(:access) { Gitlab::UserAccess.new(user, project: project) }
let(:access) { described_class.new(user, project: project) }
let(:project) { create(:project) }
let(:user) { create(:user) }
......@@ -28,7 +28,7 @@ describe Gitlab::UserAccess do
describe 'push to empty project' do
let(:empty_project) { create(:project_empty_repo) }
let(:project_access) { Gitlab::UserAccess.new(user, project: empty_project) }
let(:project_access) { described_class.new(user, project: empty_project) }
it 'returns true if user is master' do
empty_project.team << [user, :master]
......
......@@ -63,13 +63,13 @@ describe Gitlab::Workhorse do
end
context 'without ca_pem' do
subject { Gitlab::Workhorse.terminal_websocket(terminal) }
subject { described_class.terminal_websocket(terminal) }
it { is_expected.to eq(workhorse) }
end
context 'with ca_pem' do
subject { Gitlab::Workhorse.terminal_websocket(terminal(ca_pem: "foo")) }
subject { described_class.terminal_websocket(terminal(ca_pem: "foo")) }
it { is_expected.to eq(workhorse(ca_pem: "foo")) }
end
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
describe RepositoryCache do
let(:project) { create(:empty_project) }
let(:backend) { double('backend').as_null_object }
let(:cache) { RepositoryCache.new('example', project.id, backend) }
let(:cache) { described_class.new('example', project.id, backend) }
describe '#cache_key' do
it 'includes the namespace' do
......
......@@ -19,7 +19,7 @@ describe SystemCheck do
end
describe '.run' do
subject { SystemCheck }
subject { described_class }
it 'detects execution of SimpleCheck' do
is_expected.to execute_check(SimpleCheck)
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
describe Ability do
context 'using a nil subject' do
it 'has no permissions' do
expect(Ability.policy_for(nil, nil)).to be_banned
expect(described_class.policy_for(nil, nil)).to be_banned
end
end
......
require 'spec_helper'
describe ApplicationSetting do
let(:setting) { ApplicationSetting.create_from_defaults }
let(:setting) { described_class.create_from_defaults }
it { expect(setting).to be_valid }
it { expect(setting.uuid).to be_present }
......@@ -159,10 +159,10 @@ describe ApplicationSetting do
context 'redis unavailable' do
it 'returns an ApplicationSetting' do
allow(Rails.cache).to receive(:fetch).and_call_original
allow(ApplicationSetting).to receive(:last).and_return(:last)
allow(described_class).to receive(:last).and_return(:last)
expect(Rails.cache).to receive(:fetch).with(ApplicationSetting::CACHE_KEY).and_raise(ArgumentError)
expect(ApplicationSetting.current).to eq(:last)
expect(described_class.current).to eq(:last)
end
end
end
......
......@@ -24,26 +24,26 @@ describe BroadcastMessage do
it 'returns message if time match' do
message = create(:broadcast_message)
expect(BroadcastMessage.current).to include(message)
expect(described_class.current).to include(message)
end
it 'returns multiple messages if time match' do
message1 = create(:broadcast_message)
message2 = create(:broadcast_message)
expect(BroadcastMessage.current).to contain_exactly(message1, message2)
expect(described_class.current).to contain_exactly(message1, message2)
end
it 'returns empty list if time not come' do
create(:broadcast_message, :future)
expect(BroadcastMessage.current).to be_empty
expect(described_class.current).to be_empty
end
it 'returns empty list if time has passed' do
create(:broadcast_message, :expired)
expect(BroadcastMessage.current).to be_empty
expect(described_class.current).to be_empty
end
end
......
......@@ -46,7 +46,7 @@ describe Ci::PipelineSchedule do
end
it 'updates next_run_at automatically' do
expect(Ci::PipelineSchedule.last.next_run_at).to eq(expected_next_run_at)
expect(described_class.last.next_run_at).to eq(expected_next_run_at)
end
end
......@@ -61,7 +61,7 @@ describe Ci::PipelineSchedule do
it 'updates next_run_at automatically' do
pipeline_schedule.update!(cron: new_cron)
expect(Ci::PipelineSchedule.last.next_run_at).to eq(expected_next_run_at)
expect(described_class.last.next_run_at).to eq(expected_next_run_at)
end
end
end
......
......@@ -50,7 +50,7 @@ describe Ci::Runner do
end
describe '.online' do
subject { Ci::Runner.online }
subject { described_class.online }
before do
@runner1 = FactoryGirl.create(:ci_runner, :shared, contacted_at: 1.year.ago)
......@@ -352,13 +352,13 @@ describe Ci::Runner do
end
context 'does not give owned runner' do
subject { Ci::Runner.assignable_for(project) }
subject { described_class.assignable_for(project) }
it { is_expected.to be_empty }
end
context 'does not give shared runner' do
subject { Ci::Runner.assignable_for(another_project) }
subject { described_class.assignable_for(another_project) }
it { is_expected.to be_empty }
end
......@@ -366,13 +366,13 @@ describe Ci::Runner do
context 'with unlocked runner' do
context 'does not give owned runner' do
subject { Ci::Runner.assignable_for(project) }
subject { described_class.assignable_for(project) }
it { is_expected.to be_empty }
end
context 'does give a specific runner' do
subject { Ci::Runner.assignable_for(another_project) }
subject { described_class.assignable_for(another_project) }
it { is_expected.to contain_exactly(runner) }
end
......@@ -384,13 +384,13 @@ describe Ci::Runner do
end
context 'does not give owned runner' do
subject { Ci::Runner.assignable_for(project) }
subject { described_class.assignable_for(project) }
it { is_expected.to be_empty }
end
context 'does not give a locked runner' do
subject { Ci::Runner.assignable_for(another_project) }
subject { described_class.assignable_for(another_project) }
it { is_expected.to be_empty }
end
......
......@@ -763,7 +763,7 @@ describe Project do
.and_return(true)
expect(Geo::RepositoryRenamedEventStore).to receive(:new)
.with(instance_of(Project), old_path: 'foo', old_path_with_namespace: "#{project.namespace.full_path}/foo")
.with(instance_of(described_class), old_path: 'foo', old_path_with_namespace: "#{project.namespace.full_path}/foo")
.and_call_original
expect { project.rename_repo }.to change(Geo::RepositoryRenamedEvent, :count).by(1)
......
......@@ -72,7 +72,7 @@ describe GlobalMilestone do
project3
]
@global_milestones = GlobalMilestone.build_collection(projects, {})
@global_milestones = described_class.build_collection(projects, {})
end
it 'has all project milestones' do
......@@ -106,7 +106,7 @@ describe GlobalMilestone do
it 'returns the quantity of global milestones in each possible state' do
expected_count = { opened: 1, closed: 2, all: 2 }
count = GlobalMilestone.states_count(Project.all)
count = described_class.states_count(Project.all)
expect(count).to eq(expected_count)
end
......@@ -120,7 +120,7 @@ describe GlobalMilestone do
it 'returns 0 as the quantity of global milestones in each state' do
expected_count = { opened: 0, closed: 0, all: 0 }
count = GlobalMilestone.states_count(Project.all)
count = described_class.states_count(Project.all)
expect(count).to eq(expected_count)
end
......@@ -141,7 +141,7 @@ describe GlobalMilestone do
]
milestones_relation = Milestone.where(id: milestones.map(&:id))
@global_milestone = GlobalMilestone.new(milestone1_project1.title, milestones_relation)
@global_milestone = described_class.new(milestone1_project1.title, milestones_relation)
end
it 'has exactly one group milestone' do
......@@ -157,7 +157,7 @@ describe GlobalMilestone do
let(:milestone) { create(:milestone, title: "git / test", project: project1) }
it 'strips out slashes and spaces' do
global_milestone = GlobalMilestone.new(milestone.title, Milestone.where(id: milestone.id))
global_milestone = described_class.new(milestone.title, Milestone.where(id: milestone.id))
expect(global_milestone.safe_title).to eq('git-test')
end
......@@ -171,7 +171,7 @@ describe GlobalMilestone do
create(:active_milestone, title: title),
create(:closed_milestone, title: title)
]
global_milestone = GlobalMilestone.new(title, milestones)
global_milestone = described_class.new(title, milestones)
expect(global_milestone.state).to eq('active')
end
......@@ -184,7 +184,7 @@ describe GlobalMilestone do
create(:closed_milestone, title: title),
create(:closed_milestone, title: title)
]
global_milestone = GlobalMilestone.new(title, milestones)
global_milestone = described_class.new(title, milestones)
expect(global_milestone.state).to eq('closed')
end
......
......@@ -9,7 +9,7 @@ describe GroupMilestone do
describe '.build' do
it 'returns milestone with group assigned' do
milestone = GroupMilestone.build(
milestone = described_class.build(
group,
[project],
project_milestone.title
......@@ -25,7 +25,7 @@ describe GroupMilestone do
end
it 'returns array of milestones, each with group assigned' do
milestones = GroupMilestone.build_collection(group, [project], {})
milestones = described_class.build_collection(group, [project], {})
expect(milestones).to all(have_attributes(group: group))
end
end
......
......@@ -376,7 +376,7 @@ describe Group do
subject { build(:group, :nested) }
it { is_expected.to be_valid }
it { expect(subject.parent).to be_kind_of(Group) }
it { expect(subject.parent).to be_kind_of(described_class) }
end
describe '#members_with_parents', :nested_groups do
......
......@@ -8,13 +8,13 @@ describe Guest do
describe '.can_pull?' do
context 'when project is private' do
it 'does not allow to pull the repo' do
expect(Guest.can?(:download_code, private_project)).to eq(false)
expect(described_class.can?(:download_code, private_project)).to eq(false)
end
end
context 'when project is internal' do
it 'does not allow to pull the repo' do
expect(Guest.can?(:download_code, internal_project)).to eq(false)
expect(described_class.can?(:download_code, internal_project)).to eq(false)
end
end
......@@ -23,7 +23,7 @@ describe Guest do
it 'does not allow to pull the repo' do
public_project.project_feature.update_attribute(:repository_access_level, ProjectFeature::DISABLED)
expect(Guest.can?(:download_code, public_project)).to eq(false)
expect(described_class.can?(:download_code, public_project)).to eq(false)
end
end
......@@ -31,13 +31,13 @@ describe Guest do
it 'does not allow to pull the repo' do
public_project.project_feature.update_attribute(:repository_access_level, ProjectFeature::PRIVATE)
expect(Guest.can?(:download_code, public_project)).to eq(false)
expect(described_class.can?(:download_code, public_project)).to eq(false)
end
end
context 'when repository is enabled' do
it 'allows to pull the repo' do
expect(Guest.can?(:download_code, public_project)).to eq(true)
expect(described_class.can?(:download_code, public_project)).to eq(true)
end
end
end
......
......@@ -13,7 +13,7 @@ describe ProjectHook do
it 'returns hooks for push events only' do
hook = create(:project_hook, push_events: true)
create(:project_hook, push_events: false)
expect(ProjectHook.push_hooks).to eq([hook])
expect(described_class.push_hooks).to eq([hook])
end
end
......@@ -21,7 +21,7 @@ describe ProjectHook do
it 'returns hooks for tag push events only' do
hook = create(:project_hook, tag_push_events: true)
create(:project_hook, tag_push_events: false)
expect(ProjectHook.tag_push_hooks).to eq([hook])
expect(described_class.tag_push_hooks).to eq([hook])
end
end
end
......@@ -122,7 +122,7 @@ describe SystemHook do
it 'returns hooks for repository update events only' do
hook = create(:system_hook, repository_update_events: true)
create(:system_hook, repository_update_events: false)
expect(SystemHook.repository_update_hooks).to eq([hook])
expect(described_class.repository_update_hooks).to eq([hook])
end
end
......
......@@ -6,7 +6,7 @@ describe Member do
end
describe "Validation" do
subject { Member.new(access_level: Member::GUEST) }
subject { described_class.new(access_level: Member::GUEST) }
it { is_expected.to validate_presence_of(:user) }
it { is_expected.to validate_presence_of(:source) }
......
......@@ -139,7 +139,7 @@ describe ProjectMember do
@project_1.team << [@user_1, :developer]
@project_2.team << [@user_2, :reporter]
ProjectMember.truncate_teams([@project_1.id, @project_2.id])
described_class.truncate_teams([@project_1.id, @project_2.id])
end
it { expect(@project_1.users).to be_empty }
......
......@@ -98,7 +98,7 @@ describe MergeRequestDiff do
end
it 'saves empty state' do
allow_any_instance_of(MergeRequestDiff).to receive_message_chain(:compare, :commits)
allow_any_instance_of(described_class).to receive_message_chain(:compare, :commits)
.and_return([])
mr_diff = create(:merge_request).merge_request_diff
......
......@@ -39,13 +39,13 @@ describe Milestone do
describe "unique milestone title" do
context "per project" do
it "does not accept the same title in a project twice" do
new_milestone = Milestone.new(project: milestone.project, title: milestone.title)
new_milestone = described_class.new(project: milestone.project, title: milestone.title)
expect(new_milestone).not_to be_valid
end
it "accepts the same title in another project" do
project = create(:empty_project)
new_milestone = Milestone.new(project: project, title: milestone.title)
new_milestone = described_class.new(project: project, title: milestone.title)
expect(new_milestone).to be_valid
end
......@@ -60,7 +60,7 @@ describe Milestone do
end
it "does not accept the same title in a group twice" do
new_milestone = Milestone.new(group: group, title: milestone.title)
new_milestone = described_class.new(group: group, title: milestone.title)
expect(new_milestone).not_to be_valid
end
......@@ -68,7 +68,7 @@ describe Milestone do
it "does not accept the same title of a child project milestone" do
create(:milestone, project: group.projects.first)
new_milestone = Milestone.new(group: group, title: milestone.title)
new_milestone = described_class.new(group: group, title: milestone.title)
expect(new_milestone).not_to be_valid
end
......@@ -216,7 +216,7 @@ describe Milestone do
# The call to `#try` is because this returns a relation with a Postgres DB,
# and an array of IDs with a MySQL DB.
let(:milestone_ids) { Milestone.upcoming_ids_by_projects(projects).map { |id| id.try(:id) || id } }
let(:milestone_ids) { described_class.upcoming_ids_by_projects(projects).map { |id| id.try(:id) || id } }
it 'returns the next upcoming open milestone ID for each project' do
expect(milestone_ids).to contain_exactly(current_milestone_project_1.id, current_milestone_project_2.id)
......
......@@ -133,7 +133,7 @@ describe Namespace do
it "sums all project storage counters in the namespace" do
project1
project2
statistics = Namespace.with_statistics.find(namespace.id)
statistics = described_class.with_statistics.find(namespace.id)
expect(statistics.storage_size).to eq 666
expect(statistics.repository_size).to eq 111
......@@ -142,7 +142,7 @@ describe Namespace do
end
it "correctly handles namespaces without projects" do
statistics = Namespace.with_statistics.find(namespace.id)
statistics = described_class.with_statistics.find(namespace.id)
expect(statistics.storage_size).to eq 0
expect(statistics.repository_size).to eq 0
......@@ -298,9 +298,9 @@ describe Namespace do
@namespace = create(:namespace, name: 'WoW', path: 'woW')
end
it { expect(Namespace.find_by_path_or_name('wow')).to eq(@namespace) }
it { expect(Namespace.find_by_path_or_name('WOW')).to eq(@namespace) }
it { expect(Namespace.find_by_path_or_name('unknown')).to eq(nil) }
it { expect(described_class.find_by_path_or_name('wow')).to eq(@namespace) }
it { expect(described_class.find_by_path_or_name('WOW')).to eq(@namespace) }
it { expect(described_class.find_by_path_or_name('unknown')).to eq(nil) }
end
describe ".clean_path" do
......@@ -308,8 +308,8 @@ describe Namespace do
let!(:namespace) { create(:namespace, path: "JohnGitLab-etc1") }
it "cleans the path and makes sure it's available" do
expect(Namespace.clean_path("-john+gitlab-ETC%.git@gmail.com")).to eq("johngitlab-ETC2")
expect(Namespace.clean_path("--%+--valid_*&%name=.git.%.atom.atom.@email.com")).to eq("valid_name")
expect(described_class.clean_path("-john+gitlab-ETC%.git@gmail.com")).to eq("johngitlab-ETC2")
expect(described_class.clean_path("--%+--valid_*&%name=.git.%.atom.atom.@email.com")).to eq("valid_name")
end
end
......
......@@ -525,7 +525,7 @@ describe Note do
it "has a discussion id" do
# The discussion_id is set in `after_initialize`, so `reload` won't work
reloaded_note = Note.find(note.id)
reloaded_note = described_class.find(note.id)
expect(reloaded_note.discussion_id).not_to be_nil
expect(reloaded_note.discussion_id).to match(/\A\h{40}\z/)
......
......@@ -35,7 +35,7 @@ describe AsanaService do
end
before do
@asana = AsanaService.new
@asana = described_class.new
allow(@asana).to receive_messages(
project: project,
project_id: project.id,
......
......@@ -11,7 +11,7 @@ describe AssemblaService do
let(:project) { create(:project, :repository) }
before do
@assembla_service = AssemblaService.new
@assembla_service = described_class.new
allow(@assembla_service).to receive_messages(
project_id: project.id,
project: project,
......
......@@ -29,7 +29,7 @@ describe CampfireService do
let(:project) { create(:project, :repository) }
before do
@campfire_service = CampfireService.new
@campfire_service = described_class.new
allow(@campfire_service).to receive_messages(
project_id: project.id,
project: project,
......
......@@ -29,7 +29,7 @@ describe FlowdockService do
let(:project) { create(:project, :repository) }
before do
@flowdock_service = FlowdockService.new
@flowdock_service = described_class.new
allow(@flowdock_service).to receive_messages(
project_id: project.id,
project: project,
......
......@@ -31,7 +31,7 @@ describe GemnasiumService do
let(:project) { create(:project, :repository) }
before do
@gemnasium_service = GemnasiumService.new
@gemnasium_service = described_class.new
allow(@gemnasium_service).to receive_messages(
project_id: project.id,
project: project,
......
......@@ -27,7 +27,7 @@ describe GitlabIssueTrackerService do
context 'with absolute urls' do
before do
allow(GitlabIssueTrackerService).to receive(:default_url_options).and_return(script_name: "/gitlab/root")
allow(described_class).to receive(:default_url_options).and_return(script_name: "/gitlab/root")
end
it 'gives the correct path' do
......@@ -39,7 +39,7 @@ describe GitlabIssueTrackerService do
context 'with relative urls' do
before do
allow(GitlabIssueTrackerService).to receive(:default_url_options).and_return(script_name: "/gitlab/root")
allow(described_class).to receive(:default_url_options).and_return(script_name: "/gitlab/root")
end
it 'gives the correct path' do
......
......@@ -25,7 +25,7 @@ describe HipchatService do
end
describe "Execute" do
let(:hipchat) { HipchatService.new }
let(:hipchat) { described_class.new }
let(:user) { create(:user) }
let(:project) { create(:project, :repository) }
let(:api_url) { 'https://hipchat.example.com/v2/room/123456/notification?auth_token=verySecret' }
......
......@@ -27,7 +27,7 @@ describe IrkerService do
end
describe 'Execute' do
let(:irker) { IrkerService.new }
let(:irker) { described_class.new }
let(:user) { create(:user) }
let(:project) { create(:project, :repository) }
let(:sample_data) do
......
......@@ -80,7 +80,7 @@ describe JiraService do
let(:merge_request) { create(:merge_request) }
before do
@jira_service = JiraService.new
@jira_service = described_class.new
allow(@jira_service).to receive_messages(
project_id: project.id,
project: project,
......@@ -170,7 +170,7 @@ describe JiraService do
stub_config_setting(relative_url_root: '/gitlab')
stub_config_setting(url: Settings.send(:build_gitlab_url))
allow(JiraService).to receive(:default_url_options) do
allow(described_class).to receive(:default_url_options) do
{ script_name: '/gitlab' }
end
......@@ -224,7 +224,7 @@ describe JiraService do
context "when a password was previously set" do
before do
@jira_service = JiraService.create!(
@jira_service = described_class.create!(
project: project,
properties: {
url: 'http://jira.example.com/web',
......@@ -305,7 +305,7 @@ describe JiraService do
context 'when no password was previously set' do
before do
@jira_service = JiraService.create(
@jira_service = described_class.create(
project: project,
properties: {
url: 'http://jira.example.com/rest/api/2',
......
......@@ -26,7 +26,7 @@ describe PivotaltrackerService do
describe 'Execute' do
let(:service) do
PivotaltrackerService.new.tap do |service|
described_class.new.tap do |service|
service.token = 'secret_api_token'
end
end
......
......@@ -29,7 +29,7 @@ describe PushoverService do
end
describe 'Execute' do
let(:pushover) { PushoverService.new }
let(:pushover) { described_class.new }
let(:user) { create(:user) }
let(:project) { create(:project, :repository) }
let(:sample_data) do
......
......@@ -78,7 +78,7 @@ describe Project do
context 'after initialized' do
it "has a project_feature" do
expect(Project.new.project_feature).to be_present
expect(described_class.new.project_feature).to be_present
end
end
......@@ -128,8 +128,8 @@ describe Project do
project = create(:project_empty_repo, wiki_access_level: ProjectFeature::ENABLED)
project1 = create(:project, wiki_access_level: ProjectFeature::DISABLED)
expect(Project.with_wiki_enabled).to include(project)
expect(Project.with_wiki_enabled).not_to include(project1)
expect(described_class.with_wiki_enabled).to include(project)
expect(described_class.with_wiki_enabled).not_to include(project1)
end
end
end
......@@ -476,7 +476,7 @@ describe Project do
end
it 'returns valid url to repo' do
project = Project.new(path: 'somewhere')
project = described_class.new(path: 'somewhere')
expect(project.url_to_repo).to eq(Gitlab.config.gitlab_shell.ssh_path_prefix + 'somewhere.git')
end
......@@ -1098,7 +1098,7 @@ describe Project do
end
describe '.with_shared_runners' do
subject { Project.with_shared_runners }
subject { described_class.with_shared_runners }
context 'when shared runners are enabled for project' do
let!(:project) { create(:empty_project, shared_runners_enabled: true) }
......@@ -1123,10 +1123,10 @@ describe Project do
let!(:project2) { create(:empty_project, :public, group: group) }
it 'returns total project count' do
expect(Project).to receive(:count).once.and_call_original
expect(described_class).to receive(:count).once.and_call_original
3.times do
expect(Project.cached_count).to eq(2)
expect(described_class.cached_count).to eq(2)
end
end
end
......@@ -1171,7 +1171,7 @@ describe Project do
user1.toggle_star(project1)
user2.toggle_star(project2)
expect(Project.starred_by(user1)).to contain_exactly(project1)
expect(described_class.starred_by(user1)).to contain_exactly(project1)
end
end
......@@ -1821,7 +1821,7 @@ describe Project do
let(:project) { create(:empty_project, :mirror) }
it 'calls RepositoryImportWorker and inserts in front of the mirror scheduler queue' do
allow_any_instance_of(Project).to receive(:repository_exists?).and_return(false, true)
allow_any_instance_of(described_class).to receive(:repository_exists?).and_return(false, true)
expect_any_instance_of(EE::Project).to receive(:force_import_job!)
expect_any_instance_of(RepositoryImportWorker).to receive(:perform).with(project.id).and_call_original
......@@ -2176,13 +2176,13 @@ describe Project do
describe '.where_full_path_in' do
context 'without any paths' do
it 'returns an empty relation' do
expect(Project.where_full_path_in([])).to eq([])
expect(described_class.where_full_path_in([])).to eq([])
end
end
context 'without any valid paths' do
it 'returns an empty relation' do
expect(Project.where_full_path_in(%w[foo])).to eq([])
expect(described_class.where_full_path_in(%w[foo])).to eq([])
end
end
......@@ -2191,15 +2191,15 @@ describe Project do
let!(:project2) { create(:project) }
it 'returns the projects matching the paths' do
projects = Project.where_full_path_in([project1.path_with_namespace,
project2.path_with_namespace])
projects = described_class.where_full_path_in([project1.path_with_namespace,
project2.path_with_namespace])
expect(projects).to contain_exactly(project1, project2)
end
it 'returns projects regardless of the casing of paths' do
projects = Project.where_full_path_in([project1.path_with_namespace.upcase,
project2.path_with_namespace.upcase])
projects = described_class.where_full_path_in([project1.path_with_namespace.upcase,
project2.path_with_namespace.upcase])
expect(projects).to contain_exactly(project1, project2)
end
......@@ -2520,7 +2520,7 @@ describe Project do
let!(:path) { project1.namespace.full_path }
it 'returns correct project' do
expect(Project.inside_path(path)).to eq([project1])
expect(described_class.inside_path(path)).to eq([project1])
end
end
......@@ -2724,7 +2724,7 @@ describe Project do
context 'with a user' do
let(:projects) do
Project.all.public_or_visible_to_user(user)
described_class.all.public_or_visible_to_user(user)
end
it 'includes projects the user has access to' do
......@@ -2738,7 +2738,7 @@ describe Project do
context 'without a user' do
it 'only includes public projects' do
projects = Project.all.public_or_visible_to_user
projects = described_class.all.public_or_visible_to_user
expect(projects).to eq([public_project])
end
......
......@@ -5,7 +5,7 @@ describe ProjectWiki do
let(:repository) { project.repository }
let(:user) { project.owner }
let(:gitlab_shell) { Gitlab::Shell.new }
let(:project_wiki) { ProjectWiki.new(project, user) }
let(:project_wiki) { described_class.new(project, user) }
subject { project_wiki }
......
......@@ -200,17 +200,17 @@ describe ProtectedBranch do
production = create(:protected_branch, name: "production")
staging = create(:protected_branch, name: "staging")
expect(ProtectedBranch.matching("production")).to include(production)
expect(ProtectedBranch.matching("production")).not_to include(staging)
expect(described_class.matching("production")).to include(production)
expect(described_class.matching("production")).not_to include(staging)
end
it "accepts a list of protected branches to search from, so as to avoid a DB call" do
production = build(:protected_branch, name: "production")
staging = build(:protected_branch, name: "staging")
expect(ProtectedBranch.matching("production")).to be_empty
expect(ProtectedBranch.matching("production", protected_refs: [production, staging])).to include(production)
expect(ProtectedBranch.matching("production", protected_refs: [production, staging])).not_to include(staging)
expect(described_class.matching("production")).to be_empty
expect(described_class.matching("production", protected_refs: [production, staging])).to include(production)
expect(described_class.matching("production", protected_refs: [production, staging])).not_to include(staging)
end
end
......@@ -219,17 +219,17 @@ describe ProtectedBranch do
production = create(:protected_branch, name: "production/*")
staging = create(:protected_branch, name: "staging/*")
expect(ProtectedBranch.matching("production/some-branch")).to include(production)
expect(ProtectedBranch.matching("production/some-branch")).not_to include(staging)
expect(described_class.matching("production/some-branch")).to include(production)
expect(described_class.matching("production/some-branch")).not_to include(staging)
end
it "accepts a list of protected branches to search from, so as to avoid a DB call" do
production = build(:protected_branch, name: "production/*")
staging = build(:protected_branch, name: "staging/*")
expect(ProtectedBranch.matching("production/some-branch")).to be_empty
expect(ProtectedBranch.matching("production/some-branch", protected_refs: [production, staging])).to include(production)
expect(ProtectedBranch.matching("production/some-branch", protected_refs: [production, staging])).not_to include(staging)
expect(described_class.matching("production/some-branch")).to be_empty
expect(described_class.matching("production/some-branch", protected_refs: [production, staging])).to include(production)
expect(described_class.matching("production/some-branch", protected_refs: [production, staging])).not_to include(staging)
end
end
end
......@@ -241,23 +241,23 @@ describe ProtectedBranch do
it 'returns true when the branch matches a protected branch via direct match' do
create(:protected_branch, project: project, name: "foo")
expect(ProtectedBranch.protected?(project, 'foo')).to eq(true)
expect(described_class.protected?(project, 'foo')).to eq(true)
end
it 'returns true when the branch matches a protected branch via wildcard match' do
create(:protected_branch, project: project, name: "production/*")
expect(ProtectedBranch.protected?(project, 'production/some-branch')).to eq(true)
expect(described_class.protected?(project, 'production/some-branch')).to eq(true)
end
it 'returns false when the branch does not match a protected branch via direct match' do
expect(ProtectedBranch.protected?(project, 'foo')).to eq(false)
expect(described_class.protected?(project, 'foo')).to eq(false)
end
it 'returns false when the branch does not match a protected branch via wildcard match' do
create(:protected_branch, project: project, name: "production/*")
expect(ProtectedBranch.protected?(project, 'staging/some-branch')).to eq(false)
expect(described_class.protected?(project, 'staging/some-branch')).to eq(false)
end
end
......@@ -267,25 +267,25 @@ describe ProtectedBranch do
it 'returns false when default_protected_branch is unprotected' do
stub_application_setting(default_branch_protection: Gitlab::Access::PROTECTION_NONE)
expect(ProtectedBranch.protected?(project, 'master')).to be false
expect(described_class.protected?(project, 'master')).to be false
end
it 'returns false when default_protected_branch lets developers push' do
stub_application_setting(default_branch_protection: Gitlab::Access::PROTECTION_DEV_CAN_PUSH)
expect(ProtectedBranch.protected?(project, 'master')).to be false
expect(described_class.protected?(project, 'master')).to be false
end
it 'returns true when default_branch_protection does not let developers push but let developer merge branches' do
stub_application_setting(default_branch_protection: Gitlab::Access::PROTECTION_DEV_CAN_MERGE)
expect(ProtectedBranch.protected?(project, 'master')).to be true
expect(described_class.protected?(project, 'master')).to be true
end
it 'returns true when default_branch_protection is in full protection' do
stub_application_setting(default_branch_protection: Gitlab::Access::PROTECTION_FULL)
expect(ProtectedBranch.protected?(project, 'master')).to be true
expect(described_class.protected?(project, 'master')).to be true
end
end
end
......
......@@ -21,7 +21,7 @@ describe RedirectRoute do
let!(:redirect5) { group.redirect_routes.create(path: 'gitlabb/test/baz') }
it 'returns correct routes' do
expect(RedirectRoute.matching_path_and_descendants('gitlabb/test')).to match_array([redirect2, redirect3, redirect4, redirect5])
expect(described_class.matching_path_and_descendants('gitlabb/test')).to match_array([redirect2, redirect3, redirect4, redirect5])
end
end
end
......@@ -34,7 +34,7 @@ describe Route do
context 'after create' do
it 'calls #delete_conflicting_redirects' do
route.destroy
new_route = Route.new(source: group, path: group.path)
new_route = described_class.new(source: group, path: group.path)
expect(new_route).to receive(:delete_conflicting_redirects)
new_route.save!
end
......@@ -49,7 +49,7 @@ describe Route do
let!(:another_group_nested) { create(:group, path: 'another', name: 'another', parent: similar_group) }
it 'returns correct routes' do
expect(Route.inside_path('git_lab')).to match_array([nested_group.route, deep_nested_group.route])
expect(described_class.inside_path('git_lab')).to match_array([nested_group.route, deep_nested_group.route])
end
end
......
......@@ -38,7 +38,7 @@ describe SentNotification do
let(:issue) { create(:issue) }
it 'creates a new SentNotification' do
expect { described_class.record(issue, user.id) }.to change { SentNotification.count }.by(1)
expect { described_class.record(issue, user.id) }.to change { described_class.count }.by(1)
end
end
......@@ -47,7 +47,7 @@ describe SentNotification do
let(:note) { create(:diff_note_on_merge_request) }
it 'creates a new SentNotification' do
expect { described_class.record_note(note, user.id) }.to change { SentNotification.count }.by(1)
expect { described_class.record_note(note, user.id) }.to change { described_class.count }.by(1)
end
end
......
......@@ -58,7 +58,7 @@ describe Service do
end
describe "Available services" do
it { expect(Service.available_services_names).to include("jenkins", "jira")}
it { expect(described_class.available_services_names).to include("jenkins", "jira")}
end
describe "Template" do
......
This diff is collapsed.
......@@ -10,7 +10,7 @@ RSpec.describe WikiDirectory do
describe '#initialize' do
context 'when there are pages' do
let(:pages) { [build(:wiki_page)] }
let(:directory) { WikiDirectory.new('/path_up_to/dir', pages) }
let(:directory) { described_class.new('/path_up_to/dir', pages) }
it 'sets the slug attribute' do
expect(directory.slug).to eq('/path_up_to/dir')
......@@ -22,7 +22,7 @@ RSpec.describe WikiDirectory do
end
context 'when there are no pages' do
let(:directory) { WikiDirectory.new('/path_up_to/dir') }
let(:directory) { described_class.new('/path_up_to/dir') }
it 'sets the slug attribute' do
expect(directory.slug).to eq('/path_up_to/dir')
......
......@@ -5,13 +5,13 @@ describe WikiPage do
let(:user) { project.owner }
let(:wiki) { ProjectWiki.new(project, user) }
subject { WikiPage.new(wiki) }
subject { described_class.new(wiki) }
describe '.group_by_directory' do
context 'when there are no pages' do
it 'returns an empty array' do
expect(WikiPage.group_by_directory(nil)).to eq([])
expect(WikiPage.group_by_directory([])).to eq([])
expect(described_class.group_by_directory(nil)).to eq([])
expect(described_class.group_by_directory([])).to eq([])
end
end
......@@ -39,7 +39,7 @@ describe WikiPage do
it 'returns an array with pages and directories' do
expected_grouped_entries = [page_1, dir_1, dir_1_1, dir_2]
grouped_entries = WikiPage.group_by_directory(wiki.pages)
grouped_entries = described_class.group_by_directory(wiki.pages)
grouped_entries.each_with_index do |page_or_dir, i|
expected_page_or_dir = expected_grouped_entries[i]
......@@ -56,7 +56,7 @@ describe WikiPage do
expected_order = ['page_1', 'dir_1/page_2', 'dir_1/dir_1_1/page_3',
'dir_2/page_4', 'dir_2/page_5']
grouped_entries = WikiPage.group_by_directory(wiki.pages)
grouped_entries = described_class.group_by_directory(wiki.pages)
actual_order =
grouped_entries.map do |page_or_dir|
......@@ -72,7 +72,7 @@ describe WikiPage do
it 'removes hyphens from a name' do
name = 'a-name--with-hyphens'
expect(WikiPage.unhyphenize(name)).to eq('a name with hyphens')
expect(described_class.unhyphenize(name)).to eq('a name with hyphens')
end
end
......@@ -81,7 +81,7 @@ describe WikiPage do
before do
create_page("test page", "test content")
@page = wiki.wiki.paged("test page")
@wiki_page = WikiPage.new(wiki, @page, true)
@wiki_page = described_class.new(wiki, @page, true)
end
it "sets the slug attribute" do
......
......@@ -4,7 +4,7 @@ describe GlobalPolicy do
let(:current_user) { create(:user) }
let(:user) { create(:user) }
subject { GlobalPolicy.new(current_user, [user]) }
subject { described_class.new(current_user, [user]) }
describe "reading the list of users" do
context "for a logged in user" do
......
......@@ -4,7 +4,7 @@ describe UserPolicy do
let(:current_user) { create(:user) }
let(:user) { create(:user) }
subject { UserPolicy.new(current_user, user) }
subject { described_class.new(current_user, user) }
describe "reading a user's information" do
it { is_expected.to be_allowed(:read_user) }
......
......@@ -5,7 +5,7 @@ describe CreateReleaseService do
let(:user) { create(:user) }
let(:tag_name) { project.repository.tag_names.first }
let(:description) { 'Awesome release!' }
let(:service) { CreateReleaseService.new(project, user) }
let(:service) { described_class.new(project, user) }
it 'creates a new release' do
result = service.execute(tag_name, description)
......
......@@ -14,7 +14,7 @@ describe MergeRequests::BuildService do # rubocop:disable RSpec/FilePath
let(:commits) { nil }
let(:service) do
MergeRequests::BuildService.new(project, user,
described_class.new(project, user,
description: description,
source_branch: source_branch,
target_branch: target_branch,
......
......@@ -26,7 +26,7 @@ describe Projects::DestroyService do
Gitlab::Mirror.increment_capacity(project_mirror.id)
expect do
Projects::DestroyService.new(project_mirror, project_mirror.owner, {}).execute
described_class.new(project_mirror, project_mirror.owner, {}).execute
end.to change { Gitlab::Mirror.available_capacity }.from(max_capacity - 1).to(max_capacity)
end
end
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
describe EventCreateService do
include UserActivitiesHelpers
let(:service) { EventCreateService.new }
let(:service) { described_class.new }
describe 'Issues' do
describe '#open_issue' do
......
require 'spec_helper'
describe Geo::EnqueueWikiUpdateService do
subject { Geo::EnqueueWikiUpdateService.new(project) }
subject { described_class.new(project) }
let(:project) { double(:project) }
let(:fake_url) { 'git@localhost:repo/path.git' }
let(:fake_id) { 999 }
......
......@@ -4,7 +4,7 @@ describe Geo::MoveRepositoryService do
let(:project) { create(:project) }
let(:new_path) { project.path_with_namespace + '+renamed' }
let(:full_new_path) { File.join(project.repository_storage_path, new_path) }
subject { Geo::MoveRepositoryService.new(project.id, project.name, project.path_with_namespace, new_path) }
subject { described_class.new(project.id, project.name, project.path_with_namespace, new_path) }
describe '#execute' do
it 'renames the path' do
......
require 'spec_helper'
describe Geo::ScheduleKeyChangeService do
subject(:key_create) { Geo::ScheduleKeyChangeService.new('id' => 1, 'key' => key.key, 'action' => :create) }
subject(:key_delete) { Geo::ScheduleKeyChangeService.new('id' => 1, 'key' => key.key, 'action' => :delete) }
subject(:key_create) { described_class.new('id' => 1, 'key' => key.key, 'action' => :create) }
subject(:key_delete) { described_class.new('id' => 1, 'key' => key.key, 'action' => :delete) }
let(:key) { FactoryGirl.build(:key) }
before do
......
......@@ -5,7 +5,7 @@ describe GitHooksService do
let(:user) { create(:user) }
let(:project) { create(:project, :repository) }
let(:service) { GitHooksService.new }
let(:service) { described_class.new }
before do
@blankrev = Gitlab::Git::BLANK_SHA
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment