summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/gitlab/git/repository_spec.rb29
-rw-r--r--spec/lib/gitlab/gitaly_client/repository_service_spec.rb22
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