diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-02 15:06:12 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-02 15:06:12 +0000 |
commit | 4f4dcd3c5d7a15b7eab5fa28e27482fa68c750a3 (patch) | |
tree | 75e1d73289b774a909461007406eb22b33989265 /spec/lib/gitlab | |
parent | 2cf5eb1498d6613523b39a829eb00f76df17e781 (diff) | |
download | gitlab-ce-4f4dcd3c5d7a15b7eab5fa28e27482fa68c750a3.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r-- | spec/lib/gitlab/git/repository_spec.rb | 29 | ||||
-rw-r--r-- | spec/lib/gitlab/gitaly_client/repository_service_spec.rb | 22 |
2 files changed, 51 insertions, 0 deletions
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb index dcb7401b695..354260f23f6 100644 --- a/spec/lib/gitlab/git/repository_spec.rb +++ b/spec/lib/gitlab/git/repository_spec.rb @@ -2236,4 +2236,33 @@ describe Gitlab::Git::Repository, :seed_helper do expect(repository.commit(new_commit.oid).id).to eq(new_commit.oid) end end + + describe '#rename' do + let(:project) { create(:project, :repository)} + let(:repository) { project.repository } + + it 'moves the repository' do + checksum = repository.checksum + new_relative_path = "rename_test/relative/path" + renamed_repository = Gitlab::Git::Repository.new(repository.storage, new_relative_path, nil, nil) + + repository.rename(new_relative_path) + + expect(renamed_repository.checksum).to eq(checksum) + expect(repository.exists?).to be false + end + end + + describe '#remove' do + let(:project) { create(:project, :repository)} + let(:repository) { project.repository } + + it 'removes the repository' do + expect(repository.exists?).to be true + + repository.remove + + expect(repository.raw_repository.exists?).to be false + end + end end diff --git a/spec/lib/gitlab/gitaly_client/repository_service_spec.rb b/spec/lib/gitlab/gitaly_client/repository_service_spec.rb index a3808adb376..f4b73931f21 100644 --- a/spec/lib/gitlab/gitaly_client/repository_service_spec.rb +++ b/spec/lib/gitlab/gitaly_client/repository_service_spec.rb @@ -272,4 +272,26 @@ describe Gitlab::GitalyClient::RepositoryService do end end end + + describe 'remove' do + it 'sends a remove_repository message' do + expect_any_instance_of(Gitaly::RepositoryService::Stub) + .to receive(:remove_repository) + .with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash)) + .and_return(double(value: true)) + + client.remove + end + end + + describe 'rename' do + it 'sends a rename_repository message' do + expect_any_instance_of(Gitaly::RepositoryService::Stub) + .to receive(:rename_repository) + .with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash)) + .and_return(double(value: true)) + + client.rename('some/new/path') + end + end end |