Commit def164e7 authored by Robert Speicher's avatar Robert Speicher

Fix RSpec/DescribeSymbol cop violations

parent f1e1e513
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require "spec_helper" require "spec_helper"
describe Gitlab::Git::BlobSnippet, seed_helper: true do describe Gitlab::Git::BlobSnippet, seed_helper: true do
describe :data do describe '#data' do
context 'empty lines' do context 'empty lines' do
let(:snippet) { Gitlab::Git::BlobSnippet.new('master', nil, nil, nil) } let(:snippet) { Gitlab::Git::BlobSnippet.new('master', nil, nil, nil) }
......
...@@ -5,7 +5,7 @@ require "spec_helper" ...@@ -5,7 +5,7 @@ require "spec_helper"
describe Gitlab::Git::Blob, seed_helper: true do describe Gitlab::Git::Blob, seed_helper: true do
let(:repository) { Gitlab::Git::Repository.new(TEST_REPO_PATH) } let(:repository) { Gitlab::Git::Repository.new(TEST_REPO_PATH) }
describe :initialize do describe 'initialize' do
let(:blob) { Gitlab::Git::Blob.new(name: 'test') } let(:blob) { Gitlab::Git::Blob.new(name: 'test') }
it 'handles nil data' do it 'handles nil data' do
...@@ -15,7 +15,7 @@ describe Gitlab::Git::Blob, seed_helper: true do ...@@ -15,7 +15,7 @@ describe Gitlab::Git::Blob, seed_helper: true do
end end
end end
describe :find do describe '.find' do
context 'file in subdir' do context 'file in subdir' do
let(:blob) { Gitlab::Git::Blob.find(repository, SeedRepo::Commit::ID, "files/ruby/popen.rb") } let(:blob) { Gitlab::Git::Blob.find(repository, SeedRepo::Commit::ID, "files/ruby/popen.rb") }
...@@ -101,7 +101,7 @@ describe Gitlab::Git::Blob, seed_helper: true do ...@@ -101,7 +101,7 @@ describe Gitlab::Git::Blob, seed_helper: true do
end end
end end
describe :raw do describe '.raw' do
let(:raw_blob) { Gitlab::Git::Blob.raw(repository, SeedRepo::RubyBlob::ID) } let(:raw_blob) { Gitlab::Git::Blob.raw(repository, SeedRepo::RubyBlob::ID) }
it { expect(raw_blob.id).to eq(SeedRepo::RubyBlob::ID) } it { expect(raw_blob.id).to eq(SeedRepo::RubyBlob::ID) }
it { expect(raw_blob.data[0..10]).to eq("require \'fi") } it { expect(raw_blob.data[0..10]).to eq("require \'fi") }
...@@ -222,7 +222,7 @@ describe Gitlab::Git::Blob, seed_helper: true do ...@@ -222,7 +222,7 @@ describe Gitlab::Git::Blob, seed_helper: true do
end end
end end
describe :lfs_pointers do describe 'lfs_pointers' do
context 'file a valid lfs pointer' do context 'file a valid lfs pointer' do
let(:blob) do let(:blob) do
Gitlab::Git::Blob.find( Gitlab::Git::Blob.find(
......
...@@ -65,7 +65,7 @@ describe Gitlab::Git::Commit, seed_helper: true do ...@@ -65,7 +65,7 @@ describe Gitlab::Git::Commit, seed_helper: true do
end end
context 'Class methods' do context 'Class methods' do
describe :find do describe '.find' do
it "should return first head commit if without params" do it "should return first head commit if without params" do
expect(Gitlab::Git::Commit.last(repository).id).to eq( expect(Gitlab::Git::Commit.last(repository).id).to eq(
repository.raw.head.target.oid repository.raw.head.target.oid
...@@ -103,7 +103,7 @@ describe Gitlab::Git::Commit, seed_helper: true do ...@@ -103,7 +103,7 @@ describe Gitlab::Git::Commit, seed_helper: true do
end end
end end
describe :last_for_path do describe '.last_for_path' do
context 'no path' do context 'no path' do
subject { Gitlab::Git::Commit.last_for_path(repository, 'master') } subject { Gitlab::Git::Commit.last_for_path(repository, 'master') }
...@@ -132,7 +132,7 @@ describe Gitlab::Git::Commit, seed_helper: true do ...@@ -132,7 +132,7 @@ describe Gitlab::Git::Commit, seed_helper: true do
end end
end end
describe "where" do describe '.where' do
context 'path is empty string' do context 'path is empty string' do
subject do subject do
commits = Gitlab::Git::Commit.where( commits = Gitlab::Git::Commit.where(
...@@ -230,7 +230,7 @@ describe Gitlab::Git::Commit, seed_helper: true do ...@@ -230,7 +230,7 @@ describe Gitlab::Git::Commit, seed_helper: true do
end end
end end
describe :between do describe '.between' do
subject do subject do
commits = Gitlab::Git::Commit.between(repository, SeedRepo::Commit::PARENT_ID, SeedRepo::Commit::ID) commits = Gitlab::Git::Commit.between(repository, SeedRepo::Commit::PARENT_ID, SeedRepo::Commit::ID)
commits.map { |c| c.id } commits.map { |c| c.id }
...@@ -243,7 +243,7 @@ describe Gitlab::Git::Commit, seed_helper: true do ...@@ -243,7 +243,7 @@ describe Gitlab::Git::Commit, seed_helper: true do
it { is_expected.not_to include(SeedRepo::FirstCommit::ID) } it { is_expected.not_to include(SeedRepo::FirstCommit::ID) }
end end
describe :find_all do describe '.find_all' do
context 'max_count' do context 'max_count' do
subject do subject do
commits = Gitlab::Git::Commit.find_all( commits = Gitlab::Git::Commit.find_all(
...@@ -304,7 +304,7 @@ describe Gitlab::Git::Commit, seed_helper: true do ...@@ -304,7 +304,7 @@ describe Gitlab::Git::Commit, seed_helper: true do
end end
end end
describe :init_from_rugged do describe '#init_from_rugged' do
let(:gitlab_commit) { Gitlab::Git::Commit.new(rugged_commit) } let(:gitlab_commit) { Gitlab::Git::Commit.new(rugged_commit) }
subject { gitlab_commit } subject { gitlab_commit }
...@@ -314,7 +314,7 @@ describe Gitlab::Git::Commit, seed_helper: true do ...@@ -314,7 +314,7 @@ describe Gitlab::Git::Commit, seed_helper: true do
end end
end end
describe :init_from_hash do describe '#init_from_hash' do
let(:commit) { Gitlab::Git::Commit.new(sample_commit_hash) } let(:commit) { Gitlab::Git::Commit.new(sample_commit_hash) }
subject { commit } subject { commit }
...@@ -329,7 +329,7 @@ describe Gitlab::Git::Commit, seed_helper: true do ...@@ -329,7 +329,7 @@ describe Gitlab::Git::Commit, seed_helper: true do
end end
end end
describe :stats do describe '#stats' do
subject { commit.stats } subject { commit.stats }
describe '#additions' do describe '#additions' do
...@@ -343,25 +343,25 @@ describe Gitlab::Git::Commit, seed_helper: true do ...@@ -343,25 +343,25 @@ describe Gitlab::Git::Commit, seed_helper: true do
end end
end end
describe :to_diff do describe '#to_diff' do
subject { commit.to_diff } subject { commit.to_diff }
it { is_expected.not_to include "From #{SeedRepo::Commit::ID}" } it { is_expected.not_to include "From #{SeedRepo::Commit::ID}" }
it { is_expected.to include 'diff --git a/files/ruby/popen.rb b/files/ruby/popen.rb'} it { is_expected.to include 'diff --git a/files/ruby/popen.rb b/files/ruby/popen.rb'}
end end
describe :has_zero_stats? do describe '#has_zero_stats?' do
it { expect(commit.has_zero_stats?).to eq(false) } it { expect(commit.has_zero_stats?).to eq(false) }
end end
describe :to_patch do describe '#to_patch' do
subject { commit.to_patch } subject { commit.to_patch }
it { is_expected.to include "From #{SeedRepo::Commit::ID}" } it { is_expected.to include "From #{SeedRepo::Commit::ID}" }
it { is_expected.to include 'diff --git a/files/ruby/popen.rb b/files/ruby/popen.rb'} it { is_expected.to include 'diff --git a/files/ruby/popen.rb b/files/ruby/popen.rb'}
end end
describe :to_hash do describe '#to_hash' do
let(:hash) { commit.to_hash } let(:hash) { commit.to_hash }
subject { hash } subject { hash }
...@@ -373,7 +373,7 @@ describe Gitlab::Git::Commit, seed_helper: true do ...@@ -373,7 +373,7 @@ describe Gitlab::Git::Commit, seed_helper: true do
end end
end end
describe :diffs do describe '#diffs' do
subject { commit.diffs } subject { commit.diffs }
it { is_expected.to be_kind_of Gitlab::Git::DiffCollection } it { is_expected.to be_kind_of Gitlab::Git::DiffCollection }
...@@ -381,7 +381,7 @@ describe Gitlab::Git::Commit, seed_helper: true do ...@@ -381,7 +381,7 @@ describe Gitlab::Git::Commit, seed_helper: true do
it { expect(subject.first).to be_kind_of Gitlab::Git::Diff } it { expect(subject.first).to be_kind_of Gitlab::Git::Diff }
end end
describe :ref_names do describe '#ref_names' do
let(:commit) { Gitlab::Git::Commit.find(repository, 'master') } let(:commit) { Gitlab::Git::Commit.find(repository, 'master') }
subject { commit.ref_names(repository) } subject { commit.ref_names(repository) }
......
...@@ -5,7 +5,7 @@ describe Gitlab::Git::Compare, seed_helper: true do ...@@ -5,7 +5,7 @@ describe Gitlab::Git::Compare, seed_helper: true do
let(:compare) { Gitlab::Git::Compare.new(repository, SeedRepo::BigCommit::ID, SeedRepo::Commit::ID, false) } let(:compare) { Gitlab::Git::Compare.new(repository, SeedRepo::BigCommit::ID, SeedRepo::Commit::ID, false) }
let(:compare_straight) { Gitlab::Git::Compare.new(repository, SeedRepo::BigCommit::ID, SeedRepo::Commit::ID, true) } let(:compare_straight) { Gitlab::Git::Compare.new(repository, SeedRepo::BigCommit::ID, SeedRepo::Commit::ID, true) }
describe :commits do describe '#commits' do
subject do subject do
compare.commits.map(&:id) compare.commits.map(&:id)
end end
...@@ -42,7 +42,7 @@ describe Gitlab::Git::Compare, seed_helper: true do ...@@ -42,7 +42,7 @@ describe Gitlab::Git::Compare, seed_helper: true do
end end
end end
describe :diffs do describe '#diffs' do
subject do subject do
compare.diffs.map(&:new_path) compare.diffs.map(&:new_path)
end end
...@@ -67,7 +67,7 @@ describe Gitlab::Git::Compare, seed_helper: true do ...@@ -67,7 +67,7 @@ describe Gitlab::Git::Compare, seed_helper: true do
end end
end end
describe :same do describe '#same' do
subject do subject do
compare.same compare.same
end end
...@@ -81,7 +81,7 @@ describe Gitlab::Git::Compare, seed_helper: true do ...@@ -81,7 +81,7 @@ describe Gitlab::Git::Compare, seed_helper: true do
end end
end end
describe :commits_straight do describe '#commits', 'straight compare' do
subject do subject do
compare_straight.commits.map(&:id) compare_straight.commits.map(&:id)
end end
...@@ -94,7 +94,7 @@ describe Gitlab::Git::Compare, seed_helper: true do ...@@ -94,7 +94,7 @@ describe Gitlab::Git::Compare, seed_helper: true do
it { is_expected.not_to include(SeedRepo::BigCommit::PARENT_ID) } it { is_expected.not_to include(SeedRepo::BigCommit::PARENT_ID) }
end end
describe :diffs_straight do describe '#diffs', 'straight compare' do
subject do subject do
compare_straight.diffs.map(&:new_path) compare_straight.diffs.map(&:new_path)
end end
......
...@@ -24,7 +24,7 @@ describe Gitlab::Git::DiffCollection, seed_helper: true do ...@@ -24,7 +24,7 @@ describe Gitlab::Git::DiffCollection, seed_helper: true do
it { is_expected.to be_kind_of ::Array } it { is_expected.to be_kind_of ::Array }
end end
describe :decorate! do describe '#decorate!' do
let(:file_count) { 3 } let(:file_count) { 3 }
it 'modifies the array in place' do it 'modifies the array in place' do
...@@ -302,7 +302,7 @@ describe Gitlab::Git::DiffCollection, seed_helper: true do ...@@ -302,7 +302,7 @@ describe Gitlab::Git::DiffCollection, seed_helper: true do
end end
end end
describe :each do describe '#each' do
context 'when diff are too large' do context 'when diff are too large' do
let(:collection) do let(:collection) do
Gitlab::Git::DiffCollection.new([{ diff: 'a' * 204800 }]) Gitlab::Git::DiffCollection.new([{ diff: 'a' * 204800 }])
......
...@@ -11,7 +11,7 @@ describe Gitlab::Git::Tree, seed_helper: true do ...@@ -11,7 +11,7 @@ describe Gitlab::Git::Tree, seed_helper: true do
it { expect(tree.select(&:file?).size).to eq(10) } it { expect(tree.select(&:file?).size).to eq(10) }
it { expect(tree.select(&:submodule?).size).to eq(2) } it { expect(tree.select(&:submodule?).size).to eq(2) }
describe :dir do describe '#dir?' do
let(:dir) { tree.select(&:dir?).first } let(:dir) { tree.select(&:dir?).first }
it { expect(dir).to be_kind_of Gitlab::Git::Tree } it { expect(dir).to be_kind_of Gitlab::Git::Tree }
...@@ -41,7 +41,7 @@ describe Gitlab::Git::Tree, seed_helper: true do ...@@ -41,7 +41,7 @@ describe Gitlab::Git::Tree, seed_helper: true do
end end
end end
describe :file do describe '#file?' do
let(:file) { tree.select(&:file?).first } let(:file) { tree.select(&:file?).first }
it { expect(file).to be_kind_of Gitlab::Git::Tree } it { expect(file).to be_kind_of Gitlab::Git::Tree }
...@@ -50,21 +50,21 @@ describe Gitlab::Git::Tree, seed_helper: true do ...@@ -50,21 +50,21 @@ describe Gitlab::Git::Tree, seed_helper: true do
it { expect(file.name).to eq('.gitignore') } it { expect(file.name).to eq('.gitignore') }
end end
describe :readme do describe '#readme?' do
let(:file) { tree.select(&:readme?).first } let(:file) { tree.select(&:readme?).first }
it { expect(file).to be_kind_of Gitlab::Git::Tree } it { expect(file).to be_kind_of Gitlab::Git::Tree }
it { expect(file.name).to eq('README.md') } it { expect(file.name).to eq('README.md') }
end end
describe :contributing do describe '#contributing?' do
let(:file) { tree.select(&:contributing?).first } let(:file) { tree.select(&:contributing?).first }
it { expect(file).to be_kind_of Gitlab::Git::Tree } it { expect(file).to be_kind_of Gitlab::Git::Tree }
it { expect(file.name).to eq('CONTRIBUTING.md') } it { expect(file.name).to eq('CONTRIBUTING.md') }
end end
describe :submodule do describe '#submodule?' do
let(:submodule) { tree.select(&:submodule?).first } let(:submodule) { tree.select(&:submodule?).first }
it { expect(submodule).to be_kind_of Gitlab::Git::Tree } it { expect(submodule).to be_kind_of Gitlab::Git::Tree }
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::Git::Util do describe Gitlab::Git::Util do
describe :count_lines do describe '#count_lines' do
[ [
["", 0], ["", 0],
["foo", 1], ["foo", 1],
......
...@@ -57,7 +57,7 @@ describe Gitlab::LDAP::User, lib: true do ...@@ -57,7 +57,7 @@ describe Gitlab::LDAP::User, lib: true do
end end
end end
describe :find_or_create do describe 'find or create' do
it "finds the user if already existing" do it "finds the user if already existing" do
create(:omniauth_user, extern_uid: 'my-uid', provider: 'ldapmain') create(:omniauth_user, extern_uid: 'my-uid', provider: 'ldapmain')
......
...@@ -109,7 +109,7 @@ describe Milestone, models: true do ...@@ -109,7 +109,7 @@ describe Milestone, models: true do
it { expect(milestone.percent_complete(user)).to eq(75) } it { expect(milestone.percent_complete(user)).to eq(75) }
end end
describe :items_count do describe '#is_empty?' do
before do before do
milestone.issues << create(:issue, project: project) milestone.issues << create(:issue, project: project)
milestone.issues << create(:closed_issue, project: project) milestone.issues << create(:closed_issue, project: project)
......
...@@ -163,7 +163,7 @@ describe Namespace, models: true do ...@@ -163,7 +163,7 @@ describe Namespace, models: true do
end end
end end
describe :rm_dir do describe '#rm_dir', 'callback' do
let!(:project) { create(:empty_project, namespace: namespace) } let!(:project) { create(:empty_project, namespace: namespace) }
let!(:path) { File.join(Gitlab.config.repositories.storages.default['path'], namespace.full_path) } let!(:path) { File.join(Gitlab.config.repositories.storages.default['path'], namespace.full_path) }
......
...@@ -5,7 +5,7 @@ describe PagesDomain, models: true do ...@@ -5,7 +5,7 @@ describe PagesDomain, models: true do
it { is_expected.to belong_to(:project) } it { is_expected.to belong_to(:project) }
end end
describe :validate_domain do describe 'validate domain' do
subject { build(:pages_domain, domain: domain) } subject { build(:pages_domain, domain: domain) }
context 'is unique' do context 'is unique' do
...@@ -75,7 +75,7 @@ describe PagesDomain, models: true do ...@@ -75,7 +75,7 @@ describe PagesDomain, models: true do
end end
end end
describe :url do describe '#url' do
subject { domain.url } subject { domain.url }
context 'without the certificate' do context 'without the certificate' do
...@@ -91,7 +91,7 @@ describe PagesDomain, models: true do ...@@ -91,7 +91,7 @@ describe PagesDomain, models: true do
end end
end end
describe :has_matching_key? do describe '#has_matching_key?' do
subject { domain.has_matching_key? } subject { domain.has_matching_key? }
context 'for matching key' do context 'for matching key' do
...@@ -107,7 +107,7 @@ describe PagesDomain, models: true do ...@@ -107,7 +107,7 @@ describe PagesDomain, models: true do
end end
end end
describe :has_intermediates? do describe '#has_intermediates?' do
subject { domain.has_intermediates? } subject { domain.has_intermediates? }
context 'for self signed' do context 'for self signed' do
...@@ -133,7 +133,7 @@ describe PagesDomain, models: true do ...@@ -133,7 +133,7 @@ describe PagesDomain, models: true do
end end
end end
describe :expired? do describe '#expired?' do
subject { domain.expired? } subject { domain.expired? }
context 'for valid' do context 'for valid' do
...@@ -149,7 +149,7 @@ describe PagesDomain, models: true do ...@@ -149,7 +149,7 @@ describe PagesDomain, models: true do
end end
end end
describe :subject do describe '#subject' do
let(:domain) { build(:pages_domain, :with_certificate) } let(:domain) { build(:pages_domain, :with_certificate) }
subject { domain.subject } subject { domain.subject }
...@@ -157,7 +157,7 @@ describe PagesDomain, models: true do ...@@ -157,7 +157,7 @@ describe PagesDomain, models: true do
it { is_expected.to eq('/CN=test-certificate') } it { is_expected.to eq('/CN=test-certificate') }
end end
describe :certificate_text do describe '#certificate_text' do
let(:domain) { build(:pages_domain, :with_certificate) } let(:domain) { build(:pages_domain, :with_certificate) }
subject { domain.certificate_text } subject { domain.certificate_text }
......
...@@ -1083,7 +1083,7 @@ describe Repository, models: true do ...@@ -1083,7 +1083,7 @@ describe Repository, models: true do
end end
end end
describe :skip_merged_commit do describe 'skip_merges option' do
subject { repository.commits(Gitlab::Git::BRANCH_REF_PREFIX + "'test'", limit: 100, skip_merges: true).map{ |k| k.id } } subject { repository.commits(Gitlab::Git::BRANCH_REF_PREFIX + "'test'", limit: 100, skip_merges: true).map{ |k| k.id } }
it { is_expected.not_to include('e56497bb5f03a90a51293fc6d516788730953899') } it { is_expected.not_to include('e56497bb5f03a90a51293fc6d516788730953899') }
......
...@@ -902,7 +902,7 @@ describe API::Projects, :api do ...@@ -902,7 +902,7 @@ describe API::Projects, :api do
end end
end end
describe :fork_admin do describe 'fork management' do
let(:project_fork_target) { create(:empty_project) } let(:project_fork_target) { create(:empty_project) }
let(:project_fork_source) { create(:empty_project, :public) } let(:project_fork_source) { create(:empty_project, :public) }
......
...@@ -949,7 +949,7 @@ describe API::V3::Projects, api: true do ...@@ -949,7 +949,7 @@ describe API::V3::Projects, api: true do
end end
end end
describe :fork_admin do describe 'fork management' do
let(:project_fork_target) { create(:empty_project) } let(:project_fork_target) { create(:empty_project) }
let(:project_fork_source) { create(:empty_project, :public) } let(:project_fork_source) { create(:empty_project, :public) }
......
...@@ -17,7 +17,7 @@ describe Milestones::CloseService, services: true do ...@@ -17,7 +17,7 @@ describe Milestones::CloseService, services: true do
it { expect(milestone).to be_valid } it { expect(milestone).to be_valid }
it { expect(milestone).to be_closed } it { expect(milestone).to be_closed }
describe :event do describe 'event' do
let(:event) { Event.recent.first } let(:event) { Event.recent.first }
it { expect(event.milestone).to be_truthy } it { expect(event.milestone).to be_truthy }
......
require 'spec_helper' require 'spec_helper'
describe Projects::ForkService, services: true do describe Projects::ForkService, services: true do
describe :fork_by_user do describe 'fork by user' do
before do before do
@from_namespace = create(:namespace) @from_namespace = create(:namespace)
@from_user = create(:user, namespace: @from_namespace ) @from_user = create(:user, namespace: @from_namespace )
...@@ -100,7 +100,7 @@ describe Projects::ForkService, services: true do ...@@ -100,7 +100,7 @@ describe Projects::ForkService, services: true do
end end
end end
describe :fork_to_namespace do describe 'fork to namespace' do
before do before do
@group_owner = create(:user) @group_owner = create(:user)
@developer = create(:user) @developer = create(:user)
......
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