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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/ci/build/hook_spec.rb')
-rw-r--r--spec/lib/gitlab/ci/build/hook_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/build/hook_spec.rb b/spec/lib/gitlab/ci/build/hook_spec.rb
new file mode 100644
index 00000000000..6ed40a44c97
--- /dev/null
+++ b/spec/lib/gitlab/ci/build/hook_spec.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Gitlab::Ci::Build::Hook, feature_category: :pipeline_authoring 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