diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
commit | a09983ae35713f5a2bbb100981116d31ce99826e (patch) | |
tree | 2ee2af7bd104d57086db360a7e6d8c9d5d43667a /spec/lib/gitlab/git/repository_spec.rb | |
parent | 18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff) |
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/lib/gitlab/git/repository_spec.rb')
-rw-r--r-- | spec/lib/gitlab/git/repository_spec.rb | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb index 183e6e8d044..e7f4573c95f 100644 --- a/spec/lib/gitlab/git/repository_spec.rb +++ b/spec/lib/gitlab/git/repository_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" -describe Gitlab::Git::Repository, :seed_helper do +RSpec.describe Gitlab::Git::Repository, :seed_helper do include Gitlab::EncodingHelper include RepoHelpers using RSpec::Parameterized::TableSyntax @@ -2187,34 +2187,47 @@ describe Gitlab::Git::Repository, :seed_helper do 'gitaly_address' => Gitlab.config.repositories.storages.default.gitaly_address, 'path' => TestEnv::SECOND_STORAGE_PATH }) - new_repository.create_repository end after do new_repository.remove end - it 'mirrors the source repository' do - subject + context 'destination does not exist' do + it 'mirrors the source repository' do + subject - expect(refs(new_repository_path)).to eq(refs(repository_path)) + expect(refs(new_repository_path)).to eq(refs(repository_path)) + end end - context 'with keep-around refs' do - let(:sha) { SeedRepo::Commit::ID } - let(:keep_around_ref) { "refs/keep-around/#{sha}" } - let(:tmp_ref) { "refs/tmp/#{SecureRandom.hex}" } - + context 'destination exists' do before do - repository.write_ref(keep_around_ref, sha) - repository.write_ref(tmp_ref, sha) + new_repository.create_repository end - it 'includes the temporary and keep-around refs' do + it 'mirrors the source repository' do subject - expect(refs(new_repository_path)).to include(keep_around_ref) - expect(refs(new_repository_path)).to include(tmp_ref) + expect(refs(new_repository_path)).to eq(refs(repository_path)) + end + + context 'with keep-around refs' do + let(:sha) { SeedRepo::Commit::ID } + let(:keep_around_ref) { "refs/keep-around/#{sha}" } + let(:tmp_ref) { "refs/tmp/#{SecureRandom.hex}" } + + before do + repository.write_ref(keep_around_ref, sha) + repository.write_ref(tmp_ref, sha) + end + + it 'includes the temporary and keep-around refs' do + subject + + expect(refs(new_repository_path)).to include(keep_around_ref) + expect(refs(new_repository_path)).to include(tmp_ref) + end end end end |