2019-11-20 06:06:16 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-02-02 21:52:44 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 18:09:03 +00:00
|
|
|
RSpec.describe Gitlab::GitlabImport::ProjectCreator do
|
2015-08-07 07:06:20 +00:00
|
|
|
let(:user) { create(:user) }
|
2015-06-22 20:00:54 +00:00
|
|
|
let(:repo) do
|
|
|
|
{
|
|
|
|
name: 'vim',
|
|
|
|
path: 'vim',
|
|
|
|
visibility_level: Gitlab::VisibilityLevel::PRIVATE,
|
|
|
|
path_with_namespace: 'asd/vim',
|
|
|
|
http_url_to_repo: "https://gitlab.com/asd/vim.git",
|
|
|
|
owner: { name: "john" }
|
|
|
|
}.with_indifferent_access
|
|
|
|
end
|
2020-08-11 03:11:00 +00:00
|
|
|
|
2018-04-23 15:48:26 +00:00
|
|
|
let(:namespace) { create(:group) }
|
2015-08-07 07:06:20 +00:00
|
|
|
let(:token) { "asdffg" }
|
|
|
|
let(:access_params) { { gitlab_access_token: token } }
|
2015-04-15 14:58:43 +00:00
|
|
|
|
|
|
|
before do
|
|
|
|
namespace.add_owner(user)
|
|
|
|
end
|
2015-02-02 21:52:44 +00:00
|
|
|
|
|
|
|
it 'creates project' do
|
2018-06-14 13:04:44 +00:00
|
|
|
expect_next_instance_of(Project) do |project|
|
|
|
|
expect(project).to receive(:add_import_job)
|
|
|
|
end
|
2015-06-22 20:00:54 +00:00
|
|
|
|
2017-07-25 17:09:00 +00:00
|
|
|
project_creator = described_class.new(repo, namespace, user, access_params)
|
2015-02-17 15:59:50 +00:00
|
|
|
project = project_creator.execute
|
2015-06-22 20:00:54 +00:00
|
|
|
|
2015-02-12 18:17:35 +00:00
|
|
|
expect(project.import_url).to eq("https://oauth2:asdffg@gitlab.com/asd/vim.git")
|
|
|
|
expect(project.visibility_level).to eq(Gitlab::VisibilityLevel::PRIVATE)
|
2015-02-02 21:52:44 +00:00
|
|
|
end
|
|
|
|
end
|