Commit 7648f113 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Remove unnecessary contexts

parent 81dba76b
......@@ -5,6 +5,11 @@ describe Gitlab::Git::Repository, seed_helper: true do
let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH) }
after do
# Prevent cached stubs (gRPC connection objects) from poisoning tests.
Gitlab::GitalyClient.clear_stubs!
end
describe "Respond to" do
subject { repository }
......@@ -30,15 +35,6 @@ describe Gitlab::Git::Repository, seed_helper: true do
expect(repository.root_ref.encoding).to eq(Encoding.find('UTF-8'))
end
context 'with gitaly enabled' do
before do
stub_gitaly
end
after do
Gitlab::GitalyClient.clear_stubs!
end
it 'gets the branch name from GitalyClient' do
expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:default_branch_name)
repository.root_ref
......@@ -56,7 +52,6 @@ describe Gitlab::Git::Repository, seed_helper: true do
expect { repository.root_ref }.to raise_error(Gitlab::Git::CommandError)
end
end
end
describe "#rugged" do
context 'with no Git env stored' do
......@@ -135,15 +130,6 @@ describe Gitlab::Git::Repository, seed_helper: true do
it { is_expected.to include("master") }
it { is_expected.not_to include("branch-from-space") }
context 'with gitaly enabled' do
before do
stub_gitaly
end
after do
Gitlab::GitalyClient.clear_stubs!
end
it 'gets the branch names from GitalyClient' do
expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:branch_names)
subject
......@@ -161,7 +147,6 @@ describe Gitlab::Git::Repository, seed_helper: true do
expect { subject }.to raise_error(Gitlab::Git::CommandError)
end
end
end
describe '#tag_names' do
subject { repository.tag_names }
......@@ -183,15 +168,6 @@ describe Gitlab::Git::Repository, seed_helper: true do
it { is_expected.to include("v1.0.0") }
it { is_expected.not_to include("v5.0.0") }
context 'with gitaly enabled' do
before do
stub_gitaly
end
after do
Gitlab::GitalyClient.clear_stubs!
end
it 'gets the tag names from GitalyClient' do
expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:tag_names)
subject
......@@ -209,7 +185,6 @@ describe Gitlab::Git::Repository, seed_helper: true do
expect { subject }.to raise_error(Gitlab::Git::CommandError)
end
end
end
shared_examples 'archive check' do |extenstion|
it { expect(metadata['ArchivePath']).to match(/tmp\/gitlab-git-test.git\/gitlab-git-test-master-#{SeedRepo::LastCommit::ID}/) }
......@@ -1281,15 +1256,6 @@ describe Gitlab::Git::Repository, seed_helper: true do
expect(@repo.local_branches.any? { |branch| branch.name == 'local_branch' }).to eq(true)
end
context 'with gitaly enabled' do
before do
stub_gitaly
end
after do
Gitlab::GitalyClient.clear_stubs!
end
it 'returns a Branch with UTF-8 fields' do
branches = @repo.local_branches.to_a
expect(branches.size).to be > 0
......@@ -1318,7 +1284,6 @@ describe Gitlab::Git::Repository, seed_helper: true do
expect { @repo.local_branches }.to raise_error(Gitlab::Git::CommandError)
end
end
end
def create_remote_branch(remote_name, branch_name, source_branch_name)
source_branch = @repo.branches.find { |branch| branch.name == source_branch_name }
......@@ -1395,11 +1360,4 @@ describe Gitlab::Git::Repository, seed_helper: true do
sha = Rugged::Commit.create(repo, options)
repo.lookup(sha)
end
def stub_gitaly
allow(Gitlab::GitalyClient).to receive(:feature_enabled?).and_return(true)
stub = double(:stub)
allow(Gitaly::Ref::Stub).to receive(:new).and_return(stub)
end
end
......@@ -6,10 +6,6 @@ describe Gitlab::GitalyClient::Ref do
let(:relative_path) { project.path_with_namespace + '.git' }
let(:client) { described_class.new(project.repository) }
before do
allow(Gitlab.config.gitaly).to receive(:enabled).and_return(true)
end
after do
# When we say `expect_any_instance_of(Gitaly::Ref::Stub)` a double is created,
# and because GitalyClient shares stubs these will get passed from example to
......
......@@ -120,7 +120,6 @@ describe Environment, models: true do
let(:head_commit) { project.commit }
let(:commit) { project.commit.parent }
context 'Gitaly find_ref_name feature disabled' do
it 'returns deployment id for the environment' do
expect(environment.first_deployment_for(commit)).to eq deployment1
end
......@@ -128,20 +127,10 @@ describe Environment, models: true do
it 'return nil when no deployment is found' do
expect(environment.first_deployment_for(head_commit)).to eq nil
end
end
# TODO: Uncomment when feature is reenabled
# context 'Gitaly find_ref_name feature enabled' do
# before do
# allow(Gitlab::GitalyClient).to receive(:feature_enabled?).with(:find_ref_name).and_return(true)
# end
#
# it 'calls GitalyClient' do
# expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:find_ref_name)
#
# environment.first_deployment_for(commit)
# end
# end
it 'returns a UTF-8 ref' do
expect(environment.first_deployment_for(commit).ref).to be_utf8
end
end
describe '#environment_type' do
......
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