2020-06-15 11:08:20 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-26 05:08:59 -04:00
|
|
|
RSpec.describe Import::ProviderRepoSerializer do
|
2020-06-15 11:08:20 -04:00
|
|
|
using RSpec::Parameterized::TableSyntax
|
|
|
|
|
|
|
|
describe '#represent' do
|
|
|
|
where(:provider, :class_name) do
|
|
|
|
:github | 'Import::GithubishProviderRepoEntity'
|
|
|
|
:gitea | 'Import::GithubishProviderRepoEntity'
|
|
|
|
:bitbucket | 'Import::BitbucketProviderRepoEntity'
|
|
|
|
:bitbucket_server | 'Import::BitbucketServerProviderRepoEntity'
|
|
|
|
:fogbugz | 'Import::FogbugzProviderRepoEntity'
|
|
|
|
end
|
|
|
|
|
|
|
|
with_them do
|
|
|
|
it 'uses correct entity class' do
|
|
|
|
opts = { provider: provider }
|
|
|
|
expect(class_name.constantize).to receive(:represent)
|
|
|
|
described_class.new.represent({}, opts)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'raises an error if invalid provider supplied' do
|
|
|
|
expect { described_class.new.represent({}, { provider: :invalid })}.to raise_error { NotImplementedError }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|