Welcome to mirror list, hosted at ThFree Co, Russian Federation.

provider_repo_serializer_spec.rb « import « serializers « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 430bad151d35d6fb9693641edb3cd070965661d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Import::ProviderRepoSerializer do
  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