From 8f14332625d2031cb8275d1a4c8293120a25538d Mon Sep 17 00:00:00 2001
From: Jacob Vosmaer <contact@jacobvosmaer.nl>
Date: Wed, 14 Oct 2015 12:17:59 +0200
Subject: [PATCH] Remove RepositoryArchiveWorker specs

These tasks have shifted to gitlab_git and gitlab-git-http-server.
---
 .../archive_repository_service_spec.rb        | 67 +---------------
 .../workers/repository_archive_worker_spec.rb | 79 -------------------
 2 files changed, 1 insertion(+), 145 deletions(-)
 delete mode 100644 spec/workers/repository_archive_worker_spec.rb

diff --git a/spec/services/archive_repository_service_spec.rb b/spec/services/archive_repository_service_spec.rb
index 0ec70c51b3a..1cc7b240216 100644
--- a/spec/services/archive_repository_service_spec.rb
+++ b/spec/services/archive_repository_service_spec.rb
@@ -13,7 +13,7 @@ describe ArchiveRepositoryService do
 
     context "when the repository doesn't have an archive file path" do
       before do
-        allow(project.repository).to receive(:archive_file_path).and_return(nil)
+        allow(project.repository).to receive(:archive_metadata).and_return(Hash.new)
       end
 
       it "raises an error" do
@@ -21,70 +21,5 @@ describe ArchiveRepositoryService do
       end
     end
 
-    context "when the repository has an archive file path" do
-      let(:file_path)     { "/archive.zip" }
-      let(:pid_file_path) { "/archive.zip.pid" }
-
-      before do
-        allow(project.repository).to receive(:archive_file_path).and_return(file_path)
-        allow(project.repository).to receive(:archive_pid_file_path).and_return(pid_file_path)
-      end
-
-      context "when the archive file already exists" do
-        before do
-          allow(File).to receive(:exist?).with(file_path).and_return(true)
-        end
-
-        it "returns the file path" do
-          expect(subject.execute(timeout: 0.0)).to eq(file_path)
-        end
-      end
-
-      context "when the archive file doesn't exist yet" do
-        before do
-          allow(File).to receive(:exist?).with(file_path).and_return(false)
-          allow(File).to receive(:exist?).with(pid_file_path).and_return(true)
-        end
-
-        context "when the archive pid file doesn't exist yet" do
-          before do
-            allow(File).to receive(:exist?).with(pid_file_path).and_return(false)
-          end
-
-          it "queues the RepositoryArchiveWorker" do
-            expect(RepositoryArchiveWorker).to receive(:perform_async)
-
-            subject.execute(timeout: 0.0)
-          end
-        end
-
-        context "when the archive pid file already exists" do
-          it "doesn't queue the RepositoryArchiveWorker" do
-            expect(RepositoryArchiveWorker).not_to receive(:perform_async)
-
-            subject.execute(timeout: 0.0)
-          end
-        end
-
-        context "when the archive file exists after a little while" do
-          before do
-            Thread.new do
-              sleep 0.1
-              allow(File).to receive(:exist?).with(file_path).and_return(true)
-            end
-          end
-
-          it "returns the file path" do
-            expect(subject.execute(timeout: 0.2)).to eq(file_path)
-          end
-        end
-
-        context "when the archive file doesn't exist after the timeout" do
-          it "returns nil" do
-            expect(subject.execute(timeout: 0.0)).to eq(nil)
-          end
-        end
-      end
-    end
   end
 end
diff --git a/spec/workers/repository_archive_worker_spec.rb b/spec/workers/repository_archive_worker_spec.rb
deleted file mode 100644
index a914d0ac8dc..00000000000
--- a/spec/workers/repository_archive_worker_spec.rb
+++ /dev/null
@@ -1,79 +0,0 @@
-require 'spec_helper'
-
-describe RepositoryArchiveWorker do
-  let(:project) { create(:project) }
-  subject { RepositoryArchiveWorker.new }
-
-  before do
-    allow(Project).to receive(:find).and_return(project)
-  end
-
-  describe "#perform" do
-    it "cleans old archives" do
-      expect(project.repository).to receive(:clean_old_archives)
-
-      subject.perform(project.id, "master", "zip")
-    end
-
-    context "when the repository doesn't have an archive file path" do
-      before do
-        allow(project.repository).to receive(:archive_file_path).and_return(nil)
-      end
-
-      it "doesn't archive the repo" do
-        expect(project.repository).not_to receive(:archive_repo)
-
-        subject.perform(project.id, "master", "zip")
-      end
-    end
-
-    context "when the repository has an archive file path" do
-      let(:file_path)     { "/archive.zip" }
-      let(:pid_file_path) { "/archive.zip.pid" }
-
-      before do
-        allow(project.repository).to receive(:archive_file_path).and_return(file_path)
-        allow(project.repository).to receive(:archive_pid_file_path).and_return(pid_file_path)
-      end
-
-      context "when the archive file already exists" do
-        before do
-          allow(File).to receive(:exist?).with(file_path).and_return(true)
-        end
-
-        it "doesn't archive the repo" do
-          expect(project.repository).not_to receive(:archive_repo)
-
-          subject.perform(project.id, "master", "zip")
-        end
-      end
-
-      context "when the archive file doesn't exist yet" do
-        before do
-          allow(File).to receive(:exist?).with(file_path).and_return(false)
-          allow(File).to receive(:exist?).with(pid_file_path).and_return(true)
-        end
-
-        context "when the archive pid file doesn't exist yet" do
-          before do
-            allow(File).to receive(:exist?).with(pid_file_path).and_return(false)
-          end
-
-          it "archives the repo" do
-            expect(project.repository).to receive(:archive_repo)
-
-            subject.perform(project.id, "master", "zip")
-          end
-        end
-
-        context "when the archive pid file already exists" do
-          it "doesn't archive the repo" do
-            expect(project.repository).not_to receive(:archive_repo)
-
-            subject.perform(project.id, "master", "zip")
-          end
-        end
-      end
-    end
-  end
-end
-- 
GitLab