summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2017-05-27 00:41:42 +0000
committerStan Hu <stanhu@gmail.com>2017-05-27 00:41:42 +0000
commitb9f654faf6882493bc5bf7ac547f6248dbaa2d14 (patch)
tree6955df8552feea3d55b06c6d5b84314849dca6a1
parent3ae070c9d8c1f641ce29ef6cf4c584c6ede95f0c (diff)
parent564aa0515d84a66b312b0b68a301845118915fa7 (diff)
downloadgitlab-ce-b9f654faf6882493bc5bf7ac547f6248dbaa2d14.tar.gz
Merge branch 'add-relevant-ee-spec' into 'master'
Add missing project import job example from gitlab-ee See merge request !7106
-rw-r--r--spec/models/project_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index f2b4e9070b4..36575acf671 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -1431,6 +1431,31 @@ describe Project, models: true do
end
end
+ describe 'Project import job' do
+ let(:project) { create(:empty_project) }
+ let(:mirror) { false }
+
+ before do
+ allow_any_instance_of(Gitlab::Shell).to receive(:import_repository)
+ .with(project.repository_storage_path, project.path_with_namespace, project.import_url)
+ .and_return(true)
+
+ allow(project).to receive(:repository_exists?).and_return(true)
+
+ expect_any_instance_of(Repository).to receive(:after_import)
+ .and_call_original
+ end
+
+ it 'imports a project' do
+ expect_any_instance_of(RepositoryImportWorker).to receive(:perform).and_call_original
+
+ project.import_start
+ project.add_import_job
+
+ expect(project.reload.import_status).to eq('finished')
+ end
+ end
+
describe '#latest_successful_builds_for' do
def create_pipeline(status = 'success')
create(:ci_pipeline, project: project,