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-07-17 19:47:46 -04:00
|
|
|
'github' => Github::Import,
|
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,
|
|
|
|
'gitea' => Gitlab::GithubImport::Importer
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|