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

base_spec.rb « mapper « external « config « ci « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0fdcc5e8ff7ccbd8322cb47ec7bcdfd2e90b60fb (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
30
31
32
33
34
35
36
37
38
39
40
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::Ci::Config::External::Mapper::Base, feature_category: :pipeline_authoring do
  let(:test_class) do
    Class.new(described_class) do
      def self.name
        'TestClass'
      end
    end
  end

  let(:context) { Gitlab::Ci::Config::External::Context.new }
  let(:mapper) { test_class.new(context) }

  describe '#process' do
    subject(:process) { mapper.process }

    context 'when the method is not implemented' do
      it 'raises NotImplementedError' do
        expect { process }.to raise_error(NotImplementedError)
      end
    end

    context 'when the method is implemented' do
      before do
        test_class.class_eval do
          def process_without_instrumentation
            'test'
          end
        end
      end

      it 'calls the method' do
        expect(process).to eq('test')
      end
    end
  end
end