debian-mirror-gitlab/spec/lib/gitlab/ci/build/hook_spec.rb
2023-05-27 22:25:52 +05:30

20 lines
649 B
Ruby

# 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