summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/ci/yaml_processor_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-10 15:07:47 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-10 15:07:47 +0000
commit8b1228b0d409d7751f01d9fb72ebfbbf62399486 (patch)
tree1b4126fe48d7666a90c0d7ee26230cf8379b6410 /spec/lib/gitlab/ci/yaml_processor_spec.rb
parent96b0c1245c93585a8b0fe23e22306d32ff4e4905 (diff)
downloadgitlab-ce-8b1228b0d409d7751f01d9fb72ebfbbf62399486.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/ci/yaml_processor_spec.rb')
-rw-r--r--spec/lib/gitlab/ci/yaml_processor_spec.rb53
1 files changed, 53 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/yaml_processor_spec.rb b/spec/lib/gitlab/ci/yaml_processor_spec.rb
index 2e470d59345..9dea74f6345 100644
--- a/spec/lib/gitlab/ci/yaml_processor_spec.rb
+++ b/spec/lib/gitlab/ci/yaml_processor_spec.rb
@@ -1285,6 +1285,59 @@ module Gitlab
end
end
+ describe "release" do
+ let(:processor) { Gitlab::Ci::YamlProcessor.new(YAML.dump(config)) }
+ let(:config) do
+ {
+ stages: ["build", "test", "release"], # rubocop:disable Style/WordArray
+ release: {
+ stage: "release",
+ only: ["tags"],
+ script: ["make changelog | tee release_changelog.txt"],
+ release: {
+ tag_name: "$CI_COMMIT_TAG",
+ name: "Release $CI_TAG_NAME",
+ description: "./release_changelog.txt",
+ assets: {
+ links: [
+ {
+ name: "cool-app.zip",
+ url: "http://my.awesome.download.site/1.0-$CI_COMMIT_SHORT_SHA.zip"
+ },
+ {
+ name: "cool-app.exe",
+ url: "http://my.awesome.download.site/1.0-$CI_COMMIT_SHORT_SHA.exe"
+ }
+ ]
+ }
+ }
+ }
+ }
+ end
+
+ context 'with feature flag active' do
+ before do
+ stub_feature_flags(ci_release_generation: true)
+ end
+
+ it "returns release info" do
+ expect(processor.stage_builds_attributes('release').first[:options])
+ .to eq(config[:release].except(:stage, :only))
+ end
+ end
+
+ context 'with feature flag inactive' do
+ before do
+ stub_feature_flags(ci_release_generation: false)
+ end
+
+ it "returns release info" do
+ expect(processor.stage_builds_attributes('release').first[:options].include?(config[:release]))
+ .to be false
+ end
+ end
+ end
+
describe '#environment' do
let(:config) do
{