2016-12-16 03:15:30 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Gitlab::ImportSources do
|
|
|
|
describe '.options' do
|
|
|
|
it 'returns a hash' do
|
|
|
|
expected =
|
|
|
|
{
|
|
|
|
'GitHub' => 'github',
|
|
|
|
'Bitbucket' => 'bitbucket',
|
|
|
|
'GitLab.com' => 'gitlab',
|
|
|
|
'Google Code' => 'google_code',
|
|
|
|
'FogBugz' => 'fogbugz',
|
|
|
|
'Repo by URL' => 'git',
|
|
|
|
'GitLab export' => 'gitlab_project',
|
|
|
|
'Gitea' => 'gitea'
|
|
|
|
}
|
|
|
|
|
|
|
|
expect(described_class.options).to eq(expected)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '.values' do
|
|
|
|
it 'returns an array' do
|
|
|
|
expected =
|
2017-02-22 12:46:57 -05:00
|
|
|
%w(
|
2017-02-22 13:03:32 -05:00
|
|
|
github
|
|
|
|
bitbucket
|
|
|
|
gitlab
|
|
|
|
google_code
|
|
|
|
fogbugz
|
|
|
|
git
|
|
|
|
gitlab_project
|
|
|
|
gitea
|
|
|
|
)
|
2016-12-16 03:15:30 -05:00
|
|
|
|
|
|
|
expect(described_class.values).to eq(expected)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '.importer_names' do
|
|
|
|
it 'returns an array of importer names' do
|
|
|
|
expected =
|
2017-02-22 12:46:57 -05:00
|
|
|
%w(
|
2017-02-22 13:03:32 -05:00
|
|
|
github
|
|
|
|
bitbucket
|
|
|
|
gitlab
|
|
|
|
google_code
|
|
|
|
fogbugz
|
|
|
|
gitlab_project
|
|
|
|
gitea
|
|
|
|
)
|
2016-12-16 03:15:30 -05:00
|
|
|
|
|
|
|
expect(described_class.importer_names).to eq(expected)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '.importer' do
|
|
|
|
import_sources = {
|
2017-10-18 15:46:05 -04:00
|
|
|
'github' => Gitlab::GithubImport::ParallelImporter,
|
2016-12-16 03:15:30 -05:00
|
|
|
'bitbucket' => Gitlab::BitbucketImport::Importer,
|
|
|
|
'gitlab' => Gitlab::GitlabImport::Importer,
|
|
|
|
'google_code' => Gitlab::GoogleCodeImport::Importer,
|
|
|
|
'fogbugz' => Gitlab::FogbugzImport::Importer,
|
|
|
|
'git' => nil,
|
|
|
|
'gitlab_project' => Gitlab::ImportExport::Importer,
|
2017-10-13 12:50:36 -04:00
|
|
|
'gitea' => Gitlab::LegacyGithubImport::Importer
|
2016-12-16 03:15:30 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
import_sources.each do |name, klass|
|
|
|
|
it "returns #{klass} when given #{name}" do
|
|
|
|
expect(described_class.importer(name)).to eq(klass)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '.title' do
|
|
|
|
import_sources = {
|
|
|
|
'github' => 'GitHub',
|
|
|
|
'bitbucket' => 'Bitbucket',
|
|
|
|
'gitlab' => 'GitLab.com',
|
|
|
|
'google_code' => 'Google Code',
|
|
|
|
'fogbugz' => 'FogBugz',
|
|
|
|
'git' => 'Repo by URL',
|
|
|
|
'gitlab_project' => 'GitLab export',
|
|
|
|
'gitea' => 'Gitea'
|
|
|
|
}
|
|
|
|
|
|
|
|
import_sources.each do |name, title|
|
|
|
|
it "returns #{title} when given #{name}" do
|
|
|
|
expect(described_class.title(name)).to eq(title)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|