diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-08-23 12:31:17 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-08-23 12:31:17 +0300 |
commit | fbe82e4cd9f4cda7264bb78eab9c5c55e6311518 (patch) | |
tree | de9444c1762fa43c336f595936878677aef8ce43 /spec/lib/gitlab/git/repository_spec.rb | |
parent | 64820f9a6c17a348dc771a87618140a5c3c8874d (diff) | |
parent | 101d52b360a6a43f1633c5dd60b78e37bc8c4339 (diff) |
Merge branch 'master' into issue-discussions-refactor
# Conflicts:
# package.json
Diffstat (limited to 'spec/lib/gitlab/git/repository_spec.rb')
-rw-r--r-- | spec/lib/gitlab/git/repository_spec.rb | 59 |
1 files changed, 31 insertions, 28 deletions
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb index 4ef5d9070a2..8ec8dfe6acf 100644 --- a/spec/lib/gitlab/git/repository_spec.rb +++ b/spec/lib/gitlab/git/repository_spec.rb @@ -235,18 +235,10 @@ describe Gitlab::Git::Repository, seed_helper: true do it { is_expected.to be < 2 } end - describe '#has_commits?' do - it { expect(repository.has_commits?).to be_truthy } - end - describe '#empty?' do it { expect(repository.empty?).to be_falsey } end - describe '#bare?' do - it { expect(repository.bare?).to be_truthy } - end - describe '#ref_names' do let(:ref_names) { repository.ref_names } subject { ref_names } @@ -441,15 +433,6 @@ describe Gitlab::Git::Repository, seed_helper: true do end end - describe "#remote_names" do - let(:remotes) { repository.remote_names } - - it "should have one entry: 'origin'" do - expect(remotes.size).to eq(1) - expect(remotes.first).to eq("origin") - end - end - describe "#refs_hash" do let(:refs) { repository.refs_hash } @@ -1098,28 +1081,48 @@ describe Gitlab::Git::Repository, seed_helper: true do end describe '#tag_exists?' do - it 'returns true for an existing tag' do - tag = repository.tag_names.first + shared_examples 'checks the existence of tags' do + it 'returns true for an existing tag' do + tag = repository.tag_names.first + + expect(repository.tag_exists?(tag)).to eq(true) + end - expect(repository.tag_exists?(tag)).to eq(true) + it 'returns false for a non-existing tag' do + expect(repository.tag_exists?('v9000')).to eq(false) + end end - it 'returns false for a non-existing tag' do - expect(repository.tag_exists?('v9000')).to eq(false) + context 'when Gitaly ref_exists_tags feature is enabled' do + it_behaves_like 'checks the existence of tags' + end + + context 'when Gitaly ref_exists_tags feature is disabled', skip_gitaly_mock: true do + it_behaves_like 'checks the existence of tags' end end describe '#branch_exists?' do - it 'returns true for an existing branch' do - expect(repository.branch_exists?('master')).to eq(true) + shared_examples 'checks the existence of branches' do + it 'returns true for an existing branch' do + expect(repository.branch_exists?('master')).to eq(true) + end + + it 'returns false for a non-existing branch' do + expect(repository.branch_exists?('kittens')).to eq(false) + end + + it 'returns false when using an invalid branch name' do + expect(repository.branch_exists?('.bla')).to eq(false) + end end - it 'returns false for a non-existing branch' do - expect(repository.branch_exists?('kittens')).to eq(false) + context 'when Gitaly ref_exists_branches feature is enabled' do + it_behaves_like 'checks the existence of branches' end - it 'returns false when using an invalid branch name' do - expect(repository.branch_exists?('.bla')).to eq(false) + context 'when Gitaly ref_exists_branches feature is disabled', skip_gitaly_mock: true do + it_behaves_like 'checks the existence of branches' end end |