BigW Consortium Gitlab

Commit 1d958b03 by Robert Speicher

Merge branch 'rs-describe-symbols' into 'master'

Avoid `describe`-ing symbols in specs See merge request !5195
parents 7a03ece4 adc6ec4a
......@@ -11,7 +11,7 @@ describe NotesFinder do
project.team << [user, :master]
end
describe :execute do
describe '#execute' do
let(:params) { { target_id: commit.id, target_type: 'commit', last_fetched_at: 1.hour.ago.to_i } }
before do
......
......@@ -31,7 +31,7 @@ module Ci
})
end
describe :only do
describe 'only' do
it "does not return builds if only has another branch" do
config = YAML.dump({
before_script: ["pwd"],
......@@ -187,7 +187,7 @@ module Ci
end
end
describe :except do
describe 'except' do
it "returns builds if except has another branch" do
config = YAML.dump({
before_script: ["pwd"],
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
describe 'Gitlab::BuildDataBuilder' do
let(:build) { create(:ci_build) }
describe :build do
describe '.build' do
let(:data) do
Gitlab::BuildDataBuilder.build(build)
end
......
......@@ -8,14 +8,14 @@ describe Gitlab::Diff::File, lib: true do
let(:diff) { commit.diffs.first }
let(:diff_file) { Gitlab::Diff::File.new(diff, diff_refs: commit.diff_refs, repository: project.repository) }
describe :diff_lines do
describe '#diff_lines' do
let(:diff_lines) { diff_file.diff_lines }
it { expect(diff_lines.size).to eq(30) }
it { expect(diff_lines.first).to be_kind_of(Gitlab::Diff::Line) }
end
describe :mode_changed? do
describe '#mode_changed?' do
it { expect(diff_file.mode_changed?).to be_falsey }
end
......
......@@ -8,7 +8,7 @@ describe Gitlab::Diff::Parser, lib: true do
let(:diff) { commit.diffs.first }
let(:parser) { Gitlab::Diff::Parser.new }
describe :parse do
describe '#parse' do
let(:diff) do
<<eos
--- a/files/ruby/popen.rb
......
......@@ -4,7 +4,7 @@ describe Gitlab::LDAP::Access, lib: true do
let(:access) { Gitlab::LDAP::Access.new user }
let(:user) { create(:omniauth_user) }
describe :allowed? do
describe '#allowed?' do
subject { access.allowed? }
context 'when the user cannot be found' do
......
......@@ -25,7 +25,7 @@ describe Gitlab::LDAP::User, lib: true do
OmniAuth::AuthHash.new(uid: 'my-uid', provider: 'ldapmain', info: info_upper_case)
end
describe :changed? do
describe '#changed?' do
it "marks existing ldap user as changed" do
create(:omniauth_user, extern_uid: 'my-uid', provider: 'ldapmain')
expect(ldap_user.changed?).to be_truthy
......
......@@ -15,7 +15,7 @@ describe Ci::Pipeline, models: true do
it { is_expected.to respond_to :git_author_email }
it { is_expected.to respond_to :short_sha }
describe :valid_commit_sha do
describe '#valid_commit_sha' do
context 'commit.sha can not start with 00000000' do
before do
pipeline.sha = '0' * 40
......@@ -26,7 +26,7 @@ describe Ci::Pipeline, models: true do
end
end
describe :short_sha do
describe '#short_sha' do
subject { pipeline.short_sha }
it 'has 8 items' do
......@@ -35,10 +35,10 @@ describe Ci::Pipeline, models: true do
it { expect(pipeline.sha).to start_with(subject) }
end
describe :create_next_builds do
describe '#create_next_builds' do
end
describe :retried do
describe '#retried' do
subject { pipeline.retried }
before do
......@@ -51,7 +51,7 @@ describe Ci::Pipeline, models: true do
end
end
describe :create_builds do
describe '#create_builds' do
let!(:pipeline) { FactoryGirl.create :ci_pipeline, project: project, ref: 'master', tag: false }
def create_builds(trigger_request = nil)
......
......@@ -9,7 +9,7 @@ describe Ci::Variable, models: true do
subject.value = secret_value
end
describe :value do
describe '#value' do
it 'stores the encrypted value' do
expect(subject.encrypted_value).not_to be_nil
end
......
......@@ -24,14 +24,14 @@ describe CommitStatus, models: true do
it { is_expected.to respond_to :running? }
it { is_expected.to respond_to :pending? }
describe :author do
describe '#author' do
subject { commit_status.author }
before { commit_status.author = User.new }
it { is_expected.to eq(commit_status.user) }
end
describe :started? do
describe '#started?' do
subject { commit_status.started? }
context 'without started_at' do
......@@ -57,7 +57,7 @@ describe CommitStatus, models: true do
end
end
describe :active? do
describe '#active?' do
subject { commit_status.active? }
%w(pending running).each do |state|
......@@ -77,7 +77,7 @@ describe CommitStatus, models: true do
end
end
describe :complete? do
describe '#complete?' do
subject { commit_status.complete? }
%w(success failed canceled).each do |state|
......@@ -97,7 +97,7 @@ describe CommitStatus, models: true do
end
end
describe :duration do
describe '#duration' do
subject { commit_status.duration }
it { is_expected.to eq(120.0) }
......@@ -122,7 +122,7 @@ describe CommitStatus, models: true do
end
end
describe :latest do
describe '.latest' do
subject { CommitStatus.latest.order(:id) }
before do
......@@ -138,7 +138,7 @@ describe CommitStatus, models: true do
end
end
describe :running_or_pending do
describe '.running_or_pending' do
subject { CommitStatus.running_or_pending.order(:id) }
before do
......
......@@ -7,7 +7,7 @@ describe Mentionable do
nil
end
describe :references do
describe 'references' do
let(:project) { create(:project) }
it 'excludes JIRA references' do
......
......@@ -18,7 +18,7 @@ describe ForkedProjectLink, "add link on fork" do
end
end
describe :forked_from_project do
describe '#forked?' do
let(:forked_project_link) { build(:forked_project_link) }
let(:project_from) { create(:project) }
let(:project_to) { create(:project, forked_project_link: forked_project_link) }
......
......@@ -4,33 +4,33 @@ describe GenericCommitStatus, models: true do
let(:pipeline) { FactoryGirl.create :ci_pipeline }
let(:generic_commit_status) { FactoryGirl.create :generic_commit_status, pipeline: pipeline }
describe :context do
describe '#context' do
subject { generic_commit_status.context }
before { generic_commit_status.context = 'my_context' }
it { is_expected.to eq(generic_commit_status.name) }
end
describe :tags do
describe '#tags' do
subject { generic_commit_status.tags }
it { is_expected.to eq([:external]) }
end
describe :set_default_values do
describe 'set_default_values' do
before do
generic_commit_status.context = nil
generic_commit_status.stage = nil
generic_commit_status.save
end
describe :context do
describe '#context' do
subject { generic_commit_status.context }
it { is_expected.not_to be_nil }
end
describe :stage do
describe '#stage' do
subject { generic_commit_status.stage }
it { is_expected.not_to be_nil }
......
......@@ -14,7 +14,7 @@ describe GlobalMilestone, models: true do
let(:milestone2_project2) { create(:milestone, title: "VD-123", project: project2) }
let(:milestone2_project3) { create(:milestone, title: "VD-123", project: project3) }
describe :build_collection do
describe '.build_collection' do
before do
milestones =
[
......@@ -42,7 +42,7 @@ describe GlobalMilestone, models: true do
end
end
describe :initialize do
describe '#initialize' do
before do
milestones =
[
......@@ -63,7 +63,7 @@ describe GlobalMilestone, models: true do
end
end
describe :safe_title do
describe '#safe_title' do
let(:milestone) { create(:milestone, title: "git / test", project: project1) }
it 'should strip out slashes and spaces' do
......
......@@ -97,22 +97,22 @@ describe Group, models: true do
end
end
describe :users do
describe '#users' do
it { expect(group.users).to eq(group.owners) }
end
describe :human_name do
describe '#human_name' do
it { expect(group.human_name).to eq(group.name) }
end
describe :add_users do
describe '#add_user' do
let(:user) { create(:user) }
before { group.add_user(user, GroupMember::MASTER) }
it { expect(group.group_members.masters.map(&:user)).to include(user) }
end
describe :add_users do
describe '#add_users' do
let(:user) { create(:user) }
before { group.add_users([user.id], GroupMember::GUEST) }
......@@ -124,7 +124,7 @@ describe Group, models: true do
end
end
describe :avatar_type do
describe '#avatar_type' do
let(:user) { create(:user) }
before { group.add_user(user, GroupMember::MASTER) }
......
......@@ -101,7 +101,7 @@ describe ProjectMember, models: true do
end
end
describe :add_users_into_projects do
describe '.add_users_into_projects' do
before do
@project_1 = create :project
@project_2 = create :project
......@@ -123,7 +123,7 @@ describe ProjectMember, models: true do
it { expect(@project_2.users).to include(@user_2) }
end
describe :truncate_teams do
describe '.truncate_teams' do
before do
@project_1 = create :project
@project_2 = create :project
......
......@@ -70,7 +70,7 @@ describe Milestone, models: true do
end
end
describe :expired? do
describe '#expired?' do
context "expired" do
before do
allow(milestone).to receive(:due_date).and_return(Date.today.prev_year)
......@@ -88,7 +88,7 @@ describe Milestone, models: true do
end
end
describe :percent_complete do
describe '#percent_complete' do
before do
allow(milestone).to receive_messages(
closed_items_count: 3,
......@@ -111,11 +111,11 @@ describe Milestone, models: true do
it { expect(milestone.is_empty?(user)).to be_falsey }
end
describe :can_be_closed? do
describe '#can_be_closed?' do
it { expect(milestone.can_be_closed?).to be_truthy }
end
describe :total_items_count do
describe '#total_items_count' do
before do
create :closed_issue, milestone: milestone
create :merge_request, milestone: milestone
......@@ -126,7 +126,7 @@ describe Milestone, models: true do
end
end
describe :can_be_closed? do
describe '#can_be_closed?' do
before do
milestone = create :milestone
create :closed_issue, milestone: milestone
......
......@@ -18,11 +18,11 @@ describe Namespace, models: true do
it { is_expected.to respond_to(:to_param) }
end
describe :to_param do
describe '#to_param' do
it { expect(namespace.to_param).to eq(namespace.path) }
end
describe :human_name do
describe '#human_name' do
it { expect(namespace.human_name).to eq(namespace.owner_name) }
end
......@@ -54,7 +54,7 @@ describe Namespace, models: true do
end
end
describe :move_dir do
describe '#move_dir' do
before do
@namespace = create :namespace
@project = create :project, namespace: @namespace
......@@ -98,7 +98,7 @@ describe Namespace, models: true do
end
end
describe :find_by_path_or_name do
describe '.find_by_path_or_name' do
before do
@namespace = create(:namespace, name: 'WoW', path: 'woW')
end
......
require 'spec_helper'
describe Project, models: true do
describe :authorization do
describe 'authorization' do
before do
@p1 = create(:project)
......
......@@ -57,7 +57,7 @@ describe BuildkiteService, models: true do
)
end
describe :webhook_url do
describe '#webhook_url' do
it 'returns the webhook url' do
expect(@service.webhook_url).to eq(
'https://webhook.buildkite.com/deliver/secret-sauce-webhook-token'
......@@ -65,7 +65,7 @@ describe BuildkiteService, models: true do
end
end
describe :commit_status_path do
describe '#commit_status_path' do
it 'returns the correct status page' do
expect(@service.commit_status_path('2ab7834c')).to eq(
'https://gitlab.buildkite.com/status/secret-sauce-status-token.json?commit=2ab7834c'
......@@ -73,7 +73,7 @@ describe BuildkiteService, models: true do
end
end
describe :build_page do
describe '#build_page' do
it 'returns the correct build page' do
expect(@service.build_page('2ab7834c', nil)).to eq(
'https://buildkite.com/account-name/example-project/builds?commit=2ab7834c'
......
......@@ -16,7 +16,7 @@ describe Repository, models: true do
repository.commit(merge_commit_sha)
end
describe :branch_names_contains do
describe '#branch_names_contains' do
subject { repository.branch_names_contains(sample_commit.id) }
it { is_expected.to include('master') }
......@@ -24,7 +24,7 @@ describe Repository, models: true do
it { is_expected.not_to include('fix') }
end
describe :tag_names_contains do
describe '#tag_names_contains' do
subject { repository.tag_names_contains(sample_commit.id) }
it { is_expected.to include('v1.1.0') }
......@@ -72,13 +72,13 @@ describe Repository, models: true do
end
end
describe :last_commit_for_path do
describe '#last_commit_for_path' do
subject { repository.last_commit_for_path(sample_commit.id, '.gitignore').id }
it { is_expected.to eq('c1acaa58bbcbc3eafe538cb8274ba387047b69f8') }
end
describe :find_commits_by_message do
describe '#find_commits_by_message' do
subject { repository.find_commits_by_message('submodule').map{ |k| k.id } }
it { is_expected.to include('5937ac0a7beb003549fc5fd26fc247adbce4a52e') }
......@@ -87,7 +87,7 @@ describe Repository, models: true do
it { is_expected.not_to include('913c66a37b4a45b9769037c55c2d238bd0942d2e') }
end
describe :blob_at do
describe '#blob_at' do
context 'blank sha' do
subject { repository.blob_at(Gitlab::Git::BLANK_SHA, '.gitignore') }
......@@ -95,7 +95,7 @@ describe Repository, models: true do
end
end
describe :merged_to_root_ref? do
describe '#merged_to_root_ref?' do
context 'merged branch' do
subject { repository.merged_to_root_ref?('improve/awesome') }
......@@ -103,7 +103,7 @@ describe Repository, models: true do
end
end
describe :can_be_merged? do
describe '#can_be_merged?' do
context 'mergeable branches' do
subject { repository.can_be_merged?('0b4bc9a49b562e85de7cc9e834518ea6828729b9', 'master') }
......@@ -305,7 +305,7 @@ describe Repository, models: true do
end
end
describe :add_branch do
describe '#add_branch' do
context 'when pre hooks were successful' do
it 'should run without errors' do
hook = double(trigger: [true, nil])
......@@ -349,7 +349,7 @@ describe Repository, models: true do
end
end
describe :rm_branch do
describe '#rm_branch' do
context 'when pre hooks were successful' do
it 'should run without errors' do
allow_any_instance_of(Gitlab::Git::Hook).to receive(:trigger).and_return([true, nil])
......@@ -386,7 +386,7 @@ describe Repository, models: true do
end
end
describe :commit_with_hooks do
describe '#commit_with_hooks' do
context 'when pre hooks were successful' do
before do
expect_any_instance_of(GitHooksService).to receive(:execute).
......
......@@ -22,11 +22,11 @@ describe Service, models: true do
@testable = @service.can_test?
end
describe :can_test do
describe '#can_test?' do
it { expect(@testable).to eq(true) }
end
describe :test do
describe '#test' do
let(:data) { 'test' }
it 'test runs execute' do
......@@ -45,7 +45,7 @@ describe Service, models: true do
@testable = @service.can_test?
end
describe :can_test do
describe '#can_test?' do
it { expect(@testable).to eq(true) }
end
end
......
......@@ -427,7 +427,7 @@ describe User, models: true do
end
end
describe :not_in_project do
describe '.not_in_project' do
before do
User.delete_all
@user = create :user
......@@ -598,7 +598,7 @@ describe User, models: true do
end
end
describe :avatar_type do
describe '#avatar_type' do
let(:user) { create(:user) }
it "should be true if avatar is image" do
......@@ -612,7 +612,7 @@ describe User, models: true do
end
end
describe :requires_ldap_check? do
describe '#requires_ldap_check?' do
let(:user) { User.new }
it 'is false when LDAP is disabled' do
......@@ -651,7 +651,7 @@ describe User, models: true do
end
context 'ldap synchronized user' do
describe :ldap_user? do
describe '#ldap_user?' do
it 'is true if provider name starts with ldap' do
user = create(:omniauth_user, provider: 'ldapmain')
expect(user.ldap_user?).to be_truthy
......@@ -668,7 +668,7 @@ describe User, models: true do
end
end
describe :ldap_identity do
describe '#ldap_identity' do
it 'returns ldap identity' do
user = create :omniauth_user
expect(user.ldap_identity.provider).not_to be_empty
......@@ -825,7 +825,7 @@ describe User, models: true do
end
end
describe :can_be_removed? do
describe '#can_be_removed?' do
subject { create(:user) }
context 'no owned groups' do
......
......@@ -9,7 +9,7 @@ describe Ci::CreateTriggerRequestService, services: true do
stub_ci_pipeline_to_return_yaml_file
end
describe :execute do
describe '#execute' do
context 'valid params' do
subject { service.execute(project, trigger, 'master') }
......
......@@ -8,7 +8,7 @@ module Ci
let(:commit) { project.ensure_pipeline(commit_sha, 'master') }
let(:build) { FactoryGirl.create(:ci_build, pipeline: commit) }
describe :execute do
describe '#execute' do
before { build }
context 'branch name' do
......
......@@ -13,7 +13,7 @@ module Ci
specific_runner.assign_to(project)
end
describe :execute do
describe '#execute' do
context 'runner follow tag list' do
it "picks build with the same tag" do
pending_build.tag_list = ["linux"]
......
......@@ -9,7 +9,7 @@ describe CreateCommitBuildsService, services: true do
stub_ci_pipeline_to_return_yaml_file
end
describe :execute do
describe '#execute' do
context 'valid params' do
let(:pipeline) do
service.execute(project, user,
......
......@@ -4,7 +4,7 @@ describe EventCreateService, services: true do
let(:service) { EventCreateService.new }
describe 'Issues' do
describe :open_issue do
describe '#open_issue' do
let(:issue) { create(:issue) }
it { expect(service.open_issue(issue, issue.author)).to be_truthy }
......@@ -14,7 +14,7 @@ describe EventCreateService, services: true do
end
end
describe :close_issue do
describe '#close_issue' do
let(:issue) { create(:issue) }
it { expect(service.close_issue(issue, issue.author)).to be_truthy }
......@@ -24,7 +24,7 @@ describe EventCreateService, services: true do
end
end
describe :reopen_issue do
describe '#reopen_issue' do
let(:issue) { create(:issue) }
it { expect(service.reopen_issue(issue, issue.author)).to be_truthy }
......@@ -36,7 +36,7 @@ describe EventCreateService, services: true do
end
describe 'Merge Requests' do
describe :open_mr do
describe '#open_mr' do
let(:merge_request) { create(:merge_request) }
it { expect(service.open_mr(merge_request, merge_request.author)).to be_truthy }
......@@ -46,7 +46,7 @@ describe EventCreateService, services: true do
end
end
describe :close_mr do
describe '#close_mr' do
let(:merge_request) { create(:merge_request) }
it { expect(service.close_mr(merge_request, merge_request.author)).to be_truthy }
......@@ -56,7 +56,7 @@ describe EventCreateService, services: true do
end
end
describe :merge_mr do
describe '#merge_mr' do
let(:merge_request) { create(:merge_request) }
it { expect(service.merge_mr(merge_request, merge_request.author)).to be_truthy }
......@@ -66,7 +66,7 @@ describe EventCreateService, services: true do
end
end
describe :reopen_mr do
describe '#reopen_mr' do
let(:merge_request) { create(:merge_request) }
it { expect(service.reopen_mr(merge_request, merge_request.author)).to be_truthy }
......@@ -80,7 +80,7 @@ describe EventCreateService, services: true do
describe 'Milestone' do
let(:user) { create :user }
describe :open_milestone do
describe '#open_milestone' do
let(:milestone) { create(:milestone) }
it { expect(service.open_milestone(milestone, user)).to be_truthy }
......@@ -90,7 +90,7 @@ describe EventCreateService, services: true do
end
end
describe :close_mr do
describe '#close_mr' do
let(:milestone) { create(:milestone) }
it { expect(service.close_milestone(milestone, user)).to be_truthy }
......@@ -100,7 +100,7 @@ describe EventCreateService, services: true do
end
end
describe :destroy_mr do
describe '#destroy_mr' do
let(:milestone) { create(:milestone) }
it { expect(service.destroy_milestone(milestone, user)).to be_truthy }
......
......@@ -12,7 +12,7 @@ describe Issues::CloseService, services: true do
project.team << [user2, :developer]
end
describe :execute do
describe '#execute' do
context "valid params" do
before do
perform_enqueued_jobs do
......
......@@ -12,7 +12,7 @@ describe MergeRequests::CloseService, services: true do
project.team << [user2, :developer]
end
describe :execute do
describe '#execute' do
context 'valid params' do
let(:service) { MergeRequests::CloseService.new(project, user, {}) }
......
......@@ -5,7 +5,7 @@ describe MergeRequests::CreateService, services: true do
let(:user) { create(:user) }
let(:assignee) { create(:user) }
describe :execute do
describe '#execute' do
context 'valid params' do
let(:opts) do
{
......
......@@ -11,7 +11,7 @@ describe MergeRequests::MergeService, services: true do
project.team << [user2, :developer]
end
describe :execute do
describe '#execute' do
context 'valid params' do
let(:service) { MergeRequests::MergeService.new(project, user, commit_message: 'Awesome message') }
......
......@@ -5,7 +5,7 @@ describe MergeRequests::RefreshService, services: true do
let(:user) { create(:user) }
let(:service) { MergeRequests::RefreshService }
describe :execute do
describe '#execute' do
before do
@user = create(:user)
group = create(:group)
......
......@@ -11,7 +11,7 @@ describe MergeRequests::ReopenService, services: true do
project.team << [user2, :developer]
end
describe :execute do
describe '#execute' do
context 'valid params' do
let(:service) { MergeRequests::ReopenService.new(project, user, {}) }
......
......@@ -9,7 +9,7 @@ describe Milestones::CloseService, services: true do
project.team << [user, :master]
end
describe :execute do
describe '#execute' do
before do
Milestones::CloseService.new(project, user, {}).execute(milestone)
end
......
......@@ -4,7 +4,7 @@ describe Milestones::CreateService, services: true do
let(:project) { create(:empty_project) }
let(:user) { create(:user) }
describe :execute do
describe '#execute' do
context "valid params" do
before do
project.team << [user, :master]
......
......@@ -5,7 +5,7 @@ describe Notes::CreateService, services: true do
let(:issue) { create(:issue, project: project) }
let(:user) { create(:user) }
describe :execute do
describe '#execute' do
context "valid params" do
before do
project.team << [user, :master]
......
......@@ -5,7 +5,7 @@ describe Notes::PostProcessService, services: true do
let(:issue) { create(:issue, project: project) }
let(:user) { create(:user) }
describe :execute do
describe '#execute' do
before do
project.team << [user, :master]
note_opts = {
......
......@@ -50,7 +50,7 @@ describe NotificationService, services: true do
update_custom_notification(:new_note, @u_custom_global)
end
describe :new_note do
describe '#new_note' do
it do
add_users_with_subscription(note.project, issue)
......@@ -306,7 +306,7 @@ describe NotificationService, services: true do
project.team << [merge_request.assignee, :master]
end
describe :new_note do
describe '#new_note' do
it "records sent notifications" do
# Ensure create SentNotification by noteable = merge_request 6 times, not noteable = note
expect(SentNotification).to receive(:record_note).with(note, any_args).exactly(4).times.and_call_original
......
......@@ -5,7 +5,7 @@ describe TestHookService, services: true do
let(:project) { create :project }
let(:hook) { create :project_hook, project: project }
describe :execute do
describe '#execute' do
it "should execute successfully" do
stub_request(:post, hook.url).to_return(status: 200)
expect(TestHookService.new.execute(hook, user)).to be_truthy
......
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