diff options
author | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2019-04-04 11:58:44 +0300 |
---|---|---|
committer | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2019-04-04 11:58:44 +0300 |
commit | d444a883caaf2116dfaae68870ac793e93f7aac0 (patch) | |
tree | 7e88ab660be5c42c8020d6908b588417dd538c19 | |
parent | 1d9ee789986b59329e66e069e000c370d1bc9725 (diff) |
Remove Gitlab::Git::Branch.find
The code was unused, so I've removed it with the tests it has.
-rw-r--r-- | ruby/lib/gitlab/git/branch.rb | 8 | ||||
-rw-r--r-- | ruby/spec/lib/gitlab/git/branch_spec.rb | 44 |
2 files changed, 1 insertions, 51 deletions
diff --git a/ruby/lib/gitlab/git/branch.rb b/ruby/lib/gitlab/git/branch.rb index ab11401c8..9618b5fef 100644 --- a/ruby/lib/gitlab/git/branch.rb +++ b/ruby/lib/gitlab/git/branch.rb @@ -3,14 +3,6 @@ require_relative 'ref' module Gitlab module Git class Branch < Ref - def self.find(repo, branch_name) - if branch_name.is_a?(Gitlab::Git::Branch) - branch_name - else - repo.find_branch(branch_name) - end - end - def initialize(repository, name, target, target_commit) super(repository, name, target, target_commit) end diff --git a/ruby/spec/lib/gitlab/git/branch_spec.rb b/ruby/spec/lib/gitlab/git/branch_spec.rb index 8d99d2eaa..3381fc230 100644 --- a/ruby/spec/lib/gitlab/git/branch_spec.rb +++ b/ruby/spec/lib/gitlab/git/branch_spec.rb @@ -4,44 +4,10 @@ describe Gitlab::Git::Branch do include TestRepo let(:repository) { gitlab_git_from_gitaly(git_test_repo_read_only) } - let(:rugged) do - Rugged::Repository.new(GIT_TEST_REPO_PATH) - end subject { repository.branches } - it { is_expected.to be_kind_of Array } - - describe '.find' do - subject { described_class.find(repository, branch) } - - before do - allow(repository).to receive(:find_branch).with(branch).and_call_original - end - - context 'when finding branch via branch name' do - let(:branch) { 'master' } - - it 'returns a branch object' do - expect(subject).to be_a(described_class) - expect(subject.name).to eq(branch) - - expect(repository).to have_received(:find_branch).with(branch) - end - end - - context 'when the argument is already a branch' do - let(:commit) { repository.commit('master') } - let(:branch) { described_class.new(repository, 'master', commit.sha, commit) } - - it 'returns a branch object' do - expect(subject).to be_a(described_class) - expect(subject).to eq(branch) - - expect(repository).not_to have_received(:find_branch) - end - end - end + it { is_expected.to be_an(Array) } describe '#size' do subject { super().size } @@ -49,13 +15,5 @@ describe Gitlab::Git::Branch do it { is_expected.to eq(SeedRepo::Repo::BRANCHES.size) } end - describe 'master branch' do - let(:branch) do - repository.branches.find { |branch| branch.name == 'master' } - end - - it { expect(branch.dereferenced_target.sha).to eq(SeedRepo::LastCommit::ID) } - end - it { expect(repository.branches.size).to eq(SeedRepo::Repo::BRANCHES.size) } end |