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

hook_spec.rb « build « ci « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6c9175b426083deb7aaf8c6b2b3c40361cf9e0b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::Ci::Build::Hook, feature_category: :pipeline_composition do
  let_it_be(:build1) do
    FactoryBot.build(:ci_build,
                     options: { hooks: { pre_get_sources_script: ["echo 'hello pre_get_sources_script'"] } })
  end

  describe '.from_hooks' do
    subject(:from_hooks) { described_class.from_hooks(build1) }

    it 'initializes and returns hooks' do
      expect(from_hooks.size).to eq(1)
      expect(from_hooks[0].name).to eq('pre_get_sources_script')
      expect(from_hooks[0].script).to eq(["echo 'hello pre_get_sources_script'"])
    end
  end
end