debian-mirror-gitlab/spec/serializers/import/provider_repo_serializer_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
956 B
Ruby
Raw Normal View History

2020-06-23 00:09:42 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe Import::ProviderRepoSerializer do
2020-06-23 00:09:42 +05:30
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
2022-10-11 01:57:18 +05:30
expect { described_class.new.represent({}, { provider: :invalid }) }.to raise_error { NotImplementedError }
2020-06-23 00:09:42 +05:30
end
end
end