Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-06 09:09:36 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-06 09:09:36 +0300
commit0c4b9cacd575b3e71e41a13f042062b3adcb4caf (patch)
treefd06e55f276c1fa42327a41860e328b46a8cb8ee /spec/workers
parent6c005ae9783ad6752e3082d05e1053d20d8da92a (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers')
-rw-r--r--spec/workers/project_update_repository_storage_worker_spec.rb36
1 files changed, 32 insertions, 4 deletions
diff --git a/spec/workers/project_update_repository_storage_worker_spec.rb b/spec/workers/project_update_repository_storage_worker_spec.rb
index 57a4c2128b3..31d0d955759 100644
--- a/spec/workers/project_update_repository_storage_worker_spec.rb
+++ b/spec/workers/project_update_repository_storage_worker_spec.rb
@@ -9,12 +9,40 @@ describe ProjectUpdateRepositoryStorageWorker do
subject { described_class.new }
describe "#perform" do
- it "calls the update repository storage service" do
- expect_next_instance_of(Projects::UpdateRepositoryStorageService) do |instance|
- expect(instance).to receive(:execute).with('new_storage')
+ let(:service) { double(:update_repository_storage_service) }
+
+ before do
+ allow(Gitlab.config.repositories.storages).to receive(:keys).and_return(%w[default test_second_storage])
+ end
+
+ context 'without repository storage move' do
+ it "calls the update repository storage service" do
+ expect(Projects::UpdateRepositoryStorageService).to receive(:new).and_return(service)
+ expect(service).to receive(:execute)
+
+ expect do
+ subject.perform(project.id, 'test_second_storage')
+ end.to change(ProjectRepositoryStorageMove, :count).by(1)
+
+ storage_move = project.repository_storage_moves.last
+ expect(storage_move).to have_attributes(
+ source_storage_name: "default",
+ destination_storage_name: "test_second_storage"
+ )
end
+ end
+
+ context 'with repository storage move' do
+ let!(:repository_storage_move) { create(:project_repository_storage_move) }
- subject.perform(project.id, 'new_storage')
+ it "calls the update repository storage service" do
+ expect(Projects::UpdateRepositoryStorageService).to receive(:new).and_return(service)
+ expect(service).to receive(:execute)
+
+ expect do
+ subject.perform(nil, nil, repository_storage_move_id: repository_storage_move.id)
+ end.not_to change(ProjectRepositoryStorageMove, :count)
+ end
end
end
end