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

job_entity_spec.rb « lint « ci « serializers « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e1477612ad5775521e6d853855298da98cff7218 (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
41
42
43
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Ci::Lint::JobEntity, :aggregate_failures do
  describe '#represent' do
    let(:job) do
      {
        name: 'rspec',
        stage: 'test',
        before_script: ['bundle install', 'bundle exec rake db:create'],
        script: ["rake spec"],
        after_script: ["rake spec"],
        tag_list: %w[ruby postgres],
        environment: { name: 'hello', url: 'world' },
        when: 'on_success',
        allow_failure: false,
        except: { refs: ["branches"] },
        only: { refs: ["branches"] },
        variables: { hello: 'world' }
      }
    end

    subject(:serialized_job_result) { described_class.new(job).as_json }

    it 'exposes job data' do
      expect(serialized_job_result.keys).to contain_exactly(
        :name,
        :stage,
        :before_script,
        :script,
        :after_script,
        :tag_list,
        :environment,
        :when,
        :allow_failure,
        :only,
        :except
      )
      expect(serialized_job_result.keys).not_to include(:variables)
    end
  end
end