diff options
Diffstat (limited to 'spec/lib/gitlab/ci/config')
55 files changed, 248 insertions, 105 deletions
diff --git a/spec/lib/gitlab/ci/config/edge_stages_injector_spec.rb b/spec/lib/gitlab/ci/config/edge_stages_injector_spec.rb index 042f9b591b6..52ea925c1c4 100644 --- a/spec/lib/gitlab/ci/config/edge_stages_injector_spec.rb +++ b/spec/lib/gitlab/ci/config/edge_stages_injector_spec.rb @@ -2,7 +2,7 @@ require 'fast_spec_helper' -describe Gitlab::Ci::Config::EdgeStagesInjector do +RSpec.describe Gitlab::Ci::Config::EdgeStagesInjector do describe '#call' do subject { described_class.new(config).to_hash } diff --git a/spec/lib/gitlab/ci/config/entry/artifacts_spec.rb b/spec/lib/gitlab/ci/config/entry/artifacts_spec.rb index 8cfd07df777..028dcd3e1e6 100644 --- a/spec/lib/gitlab/ci/config/entry/artifacts_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/artifacts_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Artifacts do +RSpec.describe Gitlab::Ci::Config::Entry::Artifacts do let(:entry) { described_class.new(config) } describe 'validation' do diff --git a/spec/lib/gitlab/ci/config/entry/bridge_spec.rb b/spec/lib/gitlab/ci/config/entry/bridge_spec.rb index d08ce30618d..f33176c3da3 100644 --- a/spec/lib/gitlab/ci/config/entry/bridge_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/bridge_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Bridge do +RSpec.describe Gitlab::Ci::Config::Entry::Bridge do subject { described_class.new(config, name: :my_bridge) } it_behaves_like 'with inheritable CI config' do diff --git a/spec/lib/gitlab/ci/config/entry/cache_spec.rb b/spec/lib/gitlab/ci/config/entry/cache_spec.rb index f7b14360af3..3501812b76e 100644 --- a/spec/lib/gitlab/ci/config/entry/cache_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/cache_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Cache do +RSpec.describe Gitlab::Ci::Config::Entry::Cache do subject(:entry) { described_class.new(config) } describe 'validations' do diff --git a/spec/lib/gitlab/ci/config/entry/commands_spec.rb b/spec/lib/gitlab/ci/config/entry/commands_spec.rb index 8e7f9ab9706..439799fe973 100644 --- a/spec/lib/gitlab/ci/config/entry/commands_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/commands_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Commands do +RSpec.describe Gitlab::Ci::Config::Entry::Commands do let(:entry) { described_class.new(config) } context 'when entry config value is an array of strings' do diff --git a/spec/lib/gitlab/ci/config/entry/coverage_spec.rb b/spec/lib/gitlab/ci/config/entry/coverage_spec.rb index 877e3ec6216..c4353e822ae 100644 --- a/spec/lib/gitlab/ci/config/entry/coverage_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/coverage_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Coverage do +RSpec.describe Gitlab::Ci::Config::Entry::Coverage do let(:entry) { described_class.new(config) } describe 'validations' do diff --git a/spec/lib/gitlab/ci/config/entry/default_spec.rb b/spec/lib/gitlab/ci/config/entry/default_spec.rb index 23c62bbf92a..6e46d02a96e 100644 --- a/spec/lib/gitlab/ci/config/entry/default_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/default_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Default do +RSpec.describe Gitlab::Ci::Config::Entry::Default do let(:entry) { described_class.new(config) } it_behaves_like 'with inheritable CI config' do diff --git a/spec/lib/gitlab/ci/config/entry/environment_spec.rb b/spec/lib/gitlab/ci/config/entry/environment_spec.rb index 8c21d5342cc..0c18a7fb71e 100644 --- a/spec/lib/gitlab/ci/config/entry/environment_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/environment_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Environment do +RSpec.describe Gitlab::Ci::Config::Entry::Environment do let(:entry) { described_class.new(config) } before do @@ -102,6 +102,17 @@ describe Gitlab::Ci::Config::Entry::Environment do end end + context 'when prepare action is used' do + let(:config) do + { name: 'production', + action: 'prepare' } + end + + it 'is valid' do + expect(entry).to be_valid + end + end + context 'when wrong action type is used' do let(:config) do { name: 'production', @@ -137,7 +148,7 @@ describe Gitlab::Ci::Config::Entry::Environment do describe '#errors' do it 'contains error about invalid action' do expect(entry.errors) - .to include 'environment action should be start or stop' + .to include 'environment action should be start, stop or prepare' end end end diff --git a/spec/lib/gitlab/ci/config/entry/files_spec.rb b/spec/lib/gitlab/ci/config/entry/files_spec.rb index 2bebbd7b198..6a101d80c7d 100644 --- a/spec/lib/gitlab/ci/config/entry/files_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/files_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Files do +RSpec.describe Gitlab::Ci::Config::Entry::Files do let(:entry) { described_class.new(config) } describe 'validations' do diff --git a/spec/lib/gitlab/ci/config/entry/hidden_spec.rb b/spec/lib/gitlab/ci/config/entry/hidden_spec.rb index 40b73352676..090ef67f39d 100644 --- a/spec/lib/gitlab/ci/config/entry/hidden_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/hidden_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Hidden do +RSpec.describe Gitlab::Ci::Config::Entry::Hidden do describe '.matching?' do subject { described_class.matching?(name, {}) } diff --git a/spec/lib/gitlab/ci/config/entry/image_spec.rb b/spec/lib/gitlab/ci/config/entry/image_spec.rb index de3e887a6ed..c3d91057328 100644 --- a/spec/lib/gitlab/ci/config/entry/image_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/image_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Image do +RSpec.describe Gitlab::Ci::Config::Entry::Image do let(:entry) { described_class.new(config) } context 'when configuration is a string' do diff --git a/spec/lib/gitlab/ci/config/entry/include_spec.rb b/spec/lib/gitlab/ci/config/entry/include_spec.rb index bab11f26fa1..3e816f70c03 100644 --- a/spec/lib/gitlab/ci/config/entry/include_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/include_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe ::Gitlab::Ci::Config::Entry::Include do +RSpec.describe ::Gitlab::Ci::Config::Entry::Include do subject(:include_entry) { described_class.new(config) } describe 'validations' do diff --git a/spec/lib/gitlab/ci/config/entry/inherit/default_spec.rb b/spec/lib/gitlab/ci/config/entry/inherit/default_spec.rb index 073f93ce542..7cd9b0acb99 100644 --- a/spec/lib/gitlab/ci/config/entry/inherit/default_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/inherit/default_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe ::Gitlab::Ci::Config::Entry::Inherit::Default do +RSpec.describe ::Gitlab::Ci::Config::Entry::Inherit::Default do using RSpec::Parameterized::TableSyntax subject { described_class.new(config) } diff --git a/spec/lib/gitlab/ci/config/entry/inherit/variables_spec.rb b/spec/lib/gitlab/ci/config/entry/inherit/variables_spec.rb index 06deed11c15..b1a8fbcdbe0 100644 --- a/spec/lib/gitlab/ci/config/entry/inherit/variables_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/inherit/variables_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe ::Gitlab::Ci::Config::Entry::Inherit::Variables do +RSpec.describe ::Gitlab::Ci::Config::Entry::Inherit::Variables do using RSpec::Parameterized::TableSyntax subject { described_class.new(config) } diff --git a/spec/lib/gitlab/ci/config/entry/job_spec.rb b/spec/lib/gitlab/ci/config/entry/job_spec.rb index b6279485426..180c52ee1ab 100644 --- a/spec/lib/gitlab/ci/config/entry/job_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/job_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Job do +RSpec.describe Gitlab::Ci::Config::Entry::Job do let(:entry) { described_class.new(config, name: :rspec) } it_behaves_like 'with inheritable CI config' do @@ -33,7 +33,7 @@ describe Gitlab::Ci::Config::Entry::Job do inherit] end - it { is_expected.to match_array result } + it { is_expected.to include(*result) } end end diff --git a/spec/lib/gitlab/ci/config/entry/jobs_spec.rb b/spec/lib/gitlab/ci/config/entry/jobs_spec.rb index 203342ab620..8561bd330b7 100644 --- a/spec/lib/gitlab/ci/config/entry/jobs_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/jobs_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Jobs do +RSpec.describe Gitlab::Ci::Config::Entry::Jobs do let(:entry) { described_class.new(config) } let(:config) do diff --git a/spec/lib/gitlab/ci/config/entry/key_spec.rb b/spec/lib/gitlab/ci/config/entry/key_spec.rb index 327607e2266..4ee1ffb29ad 100644 --- a/spec/lib/gitlab/ci/config/entry/key_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/key_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Key do +RSpec.describe Gitlab::Ci::Config::Entry::Key do let(:entry) { described_class.new(config) } describe 'validations' do diff --git a/spec/lib/gitlab/ci/config/entry/kubernetes_spec.rb b/spec/lib/gitlab/ci/config/entry/kubernetes_spec.rb index 468e83ec506..53809d2d549 100644 --- a/spec/lib/gitlab/ci/config/entry/kubernetes_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/kubernetes_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Kubernetes do +RSpec.describe Gitlab::Ci::Config::Entry::Kubernetes do subject { described_class.new(config) } describe 'attributes' do diff --git a/spec/lib/gitlab/ci/config/entry/need_spec.rb b/spec/lib/gitlab/ci/config/entry/need_spec.rb index 92b71c5f6cc..5a826bf8282 100644 --- a/spec/lib/gitlab/ci/config/entry/need_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/need_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe ::Gitlab::Ci::Config::Entry::Need do +RSpec.describe ::Gitlab::Ci::Config::Entry::Need do subject(:need) { described_class.new(config) } shared_examples 'job type' do diff --git a/spec/lib/gitlab/ci/config/entry/needs_spec.rb b/spec/lib/gitlab/ci/config/entry/needs_spec.rb index b8b84b5efd2..f3b9d0c3c84 100644 --- a/spec/lib/gitlab/ci/config/entry/needs_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/needs_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe ::Gitlab::Ci::Config::Entry::Needs do +RSpec.describe ::Gitlab::Ci::Config::Entry::Needs do subject(:needs) { described_class.new(config) } before do diff --git a/spec/lib/gitlab/ci/config/entry/paths_spec.rb b/spec/lib/gitlab/ci/config/entry/paths_spec.rb index 221d5ae5863..dd4e7befc46 100644 --- a/spec/lib/gitlab/ci/config/entry/paths_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/paths_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Paths do +RSpec.describe Gitlab::Ci::Config::Entry::Paths do let(:entry) { described_class.new(config) } describe 'validations' do diff --git a/spec/lib/gitlab/ci/config/entry/policy_spec.rb b/spec/lib/gitlab/ci/config/entry/policy_spec.rb index a606eb303e7..46800055dd9 100644 --- a/spec/lib/gitlab/ci/config/entry/policy_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/policy_spec.rb @@ -4,7 +4,7 @@ require 'fast_spec_helper' require 'support/helpers/stub_feature_flags' require_dependency 'active_model' -describe Gitlab::Ci::Config::Entry::Policy do +RSpec.describe Gitlab::Ci::Config::Entry::Policy do let(:entry) { described_class.new(config) } context 'when using simplified policy' do diff --git a/spec/lib/gitlab/ci/config/entry/port_spec.rb b/spec/lib/gitlab/ci/config/entry/port_spec.rb index 5f8f294334e..e2840c07f6b 100644 --- a/spec/lib/gitlab/ci/config/entry/port_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/port_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Port do +RSpec.describe Gitlab::Ci::Config::Entry::Port do let(:entry) { described_class.new(config) } before do diff --git a/spec/lib/gitlab/ci/config/entry/ports_spec.rb b/spec/lib/gitlab/ci/config/entry/ports_spec.rb index 2063bd1d86c..f738c4ee875 100644 --- a/spec/lib/gitlab/ci/config/entry/ports_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/ports_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Ports do +RSpec.describe Gitlab::Ci::Config::Entry::Ports do let(:entry) { described_class.new(config) } before do diff --git a/spec/lib/gitlab/ci/config/entry/prefix_spec.rb b/spec/lib/gitlab/ci/config/entry/prefix_spec.rb index 8132a674488..b337747f5d6 100644 --- a/spec/lib/gitlab/ci/config/entry/prefix_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/prefix_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Prefix do +RSpec.describe Gitlab::Ci::Config::Entry::Prefix do let(:entry) { described_class.new(config) } describe 'validations' do diff --git a/spec/lib/gitlab/ci/config/entry/processable_spec.rb b/spec/lib/gitlab/ci/config/entry/processable_spec.rb index 8447a29c772..fdf6008f89f 100644 --- a/spec/lib/gitlab/ci/config/entry/processable_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/processable_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Processable do +RSpec.describe Gitlab::Ci::Config::Entry::Processable do let(:node_class) do Class.new(::Gitlab::Config::Entry::Node) do include Gitlab::Ci::Config::Entry::Processable @@ -231,6 +231,12 @@ describe Gitlab::Ci::Config::Entry::Processable do end context 'when workflow rules is used' do + let(:workflow) { double('workflow', 'has_rules?' => true) } + + before do + entry.compose!(deps) + end + context 'when rules are used' do let(:config) { { script: 'ls', cache: { key: 'test' }, rules: [] } } @@ -239,11 +245,11 @@ describe Gitlab::Ci::Config::Entry::Processable do end end - context 'when rules are not used' do + context 'when rules are not used and only is defined' do let(:config) { { script: 'ls', cache: { key: 'test' }, only: [] } } - it 'does not define only' do - expect(entry).not_to be_only_defined + it 'keeps only entry' do + expect(entry).to be_only_defined end end end diff --git a/spec/lib/gitlab/ci/config/entry/release/assets/link_spec.rb b/spec/lib/gitlab/ci/config/entry/release/assets/link_spec.rb index 0e346de3d9e..bc320258412 100644 --- a/spec/lib/gitlab/ci/config/entry/release/assets/link_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/release/assets/link_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Release::Assets::Link do +RSpec.describe Gitlab::Ci::Config::Entry::Release::Assets::Link do let(:entry) { described_class.new(config) } describe 'validation' do diff --git a/spec/lib/gitlab/ci/config/entry/release/assets/links_spec.rb b/spec/lib/gitlab/ci/config/entry/release/assets/links_spec.rb index d12e8d966ab..440745d9eb3 100644 --- a/spec/lib/gitlab/ci/config/entry/release/assets/links_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/release/assets/links_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Release::Assets::Links do +RSpec.describe Gitlab::Ci::Config::Entry::Release::Assets::Links do let(:entry) { described_class.new(config) } describe 'validation' do diff --git a/spec/lib/gitlab/ci/config/entry/release/assets_spec.rb b/spec/lib/gitlab/ci/config/entry/release/assets_spec.rb index 08ad5764eaa..3d44d7d9903 100644 --- a/spec/lib/gitlab/ci/config/entry/release/assets_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/release/assets_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Release::Assets do +RSpec.describe Gitlab::Ci::Config::Entry::Release::Assets do let(:entry) { described_class.new(config) } describe 'validation' do diff --git a/spec/lib/gitlab/ci/config/entry/release_spec.rb b/spec/lib/gitlab/ci/config/entry/release_spec.rb index 500897569e9..e5155f91be4 100644 --- a/spec/lib/gitlab/ci/config/entry/release_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/release_spec.rb @@ -2,24 +2,35 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Release do +RSpec.describe Gitlab::Ci::Config::Entry::Release do let(:entry) { described_class.new(config) } + shared_examples_for 'a valid entry' do + describe '#value' do + it 'returns release configuration' do + expect(entry.value).to eq config + end + end + + describe '#valid?' do + it 'is valid' do + expect(entry).to be_valid + end + end + end + + shared_examples_for 'reports error' do |message| + it 'reports error' do + expect(entry.errors) + .to include message + end + end + describe 'validation' do context 'when entry config value is correct' do let(:config) { { tag_name: 'v0.06', description: "./release_changelog.txt" } } - describe '#value' do - it 'returns release configuration' do - expect(entry.value).to eq config - end - end - - describe '#valid?' do - it 'is valid' do - expect(entry).to be_valid - end - end + it_behaves_like 'a valid entry' end context "when value includes 'assets' keyword" do @@ -36,38 +47,144 @@ describe Gitlab::Ci::Config::Entry::Release do } end - describe '#value' do - it 'returns release configuration' do - expect(entry.value).to eq config - end + it_behaves_like 'a valid entry' + end + + context "when value includes 'name' keyword" do + let(:config) do + { + tag_name: 'v0.06', + description: "./release_changelog.txt", + name: "Release $CI_TAG_NAME" + } end - describe '#valid?' do - it 'is valid' do - expect(entry).to be_valid - end + it_behaves_like 'a valid entry' + end + + context "when value includes 'ref' keyword" do + let(:config) do + { + tag_name: 'v0.06', + description: "./release_changelog.txt", + name: "Release $CI_TAG_NAME", + ref: 'b3235930aa443112e639f941c69c578912189bdd' + } end + + it_behaves_like 'a valid entry' end - context "when value includes 'name' keyword" do + context "when value includes 'released_at' keyword" do let(:config) do { tag_name: 'v0.06', description: "./release_changelog.txt", - name: "Release $CI_TAG_NAME" + name: "Release $CI_TAG_NAME", + released_at: '2019-03-15T08:00:00Z' } end - describe '#value' do - it 'returns release configuration' do - expect(entry.value).to eq config - end + it_behaves_like 'a valid entry' + end + + context "when value includes 'milestones' keyword" do + let(:config) do + { + tag_name: 'v0.06', + description: "./release_changelog.txt", + name: "Release $CI_TAG_NAME", + milestones: milestones + } end - describe '#valid?' do - it 'is valid' do - expect(entry).to be_valid - end + context 'for an array of milestones' do + let(:milestones) { %w[m1 m2 m3] } + + it_behaves_like 'a valid entry' + end + + context 'for a single milestone' do + let(:milestones) { 'm1' } + + it_behaves_like 'a valid entry' + end + end + + context "when value includes 'ref' keyword" do + let(:config) do + { + tag_name: 'v0.06', + description: "./release_changelog.txt", + name: "Release $CI_TAG_NAME", + ref: ref + } + end + + context "when 'ref' is a full commit SHA" do + let(:ref) { 'b3235930aa443112e639f941c69c578912189bdd' } + + it_behaves_like 'a valid entry' + end + + context "when 'ref' is a short commit SHA" do + let(:ref) { 'b3235930'} + + it_behaves_like 'a valid entry' + end + + context "when 'ref' is a branch name" do + let(:ref) { 'fix/123-branch-name'} + + it_behaves_like 'a valid entry' + end + + context "when 'ref' is a semantic versioning tag" do + let(:ref) { 'v1.2.3'} + + it_behaves_like 'a valid entry' + end + + context "when 'ref' is a semantic versioning tag rc" do + let(:ref) { 'v1.2.3-rc'} + + it_behaves_like 'a valid entry' + end + end + + context "when value includes 'released_at' keyword" do + let(:config) do + { + tag_name: 'v0.06', + description: "./release_changelog.txt", + name: "Release $CI_TAG_NAME", + released_at: '2019-03-15T08:00:00Z' + } + end + + it_behaves_like 'a valid entry' + end + + context "when value includes 'milestones' keyword" do + let(:config) do + { + tag_name: 'v0.06', + description: "./release_changelog.txt", + name: "Release $CI_TAG_NAME", + milestones: milestones + } + end + + context 'for an array of milestones' do + let(:milestones) { %w[m1 m2 m3] } + + it_behaves_like 'a valid entry' + end + + context 'for a single milestone' do + let(:milestones) { 'm1' } + + it_behaves_like 'a valid entry' end end @@ -76,37 +193,43 @@ describe Gitlab::Ci::Config::Entry::Release do context 'when value of attribute is invalid' do let(:config) { { description: 10 } } - it 'reports error' do - expect(entry.errors) - .to include 'release description should be a string' - end + it_behaves_like 'reports error', 'release description should be a string' end context 'when release description is missing' do let(:config) { { tag_name: 'v0.06' } } - it 'reports error' do - expect(entry.errors) - .to include "release description can't be blank" - end + it_behaves_like 'reports error', "release description can't be blank" end context 'when release tag_name is missing' do let(:config) { { description: "./release_changelog.txt" } } - it 'reports error' do - expect(entry.errors) - .to include "release tag name can't be blank" - end + it_behaves_like 'reports error', "release tag name can't be blank" end context 'when there is an unknown key present' do let(:config) { { test: 100 } } - it 'reports error' do - expect(entry.errors) - .to include 'release config contains unknown keys: test' - end + it_behaves_like 'reports error', 'release config contains unknown keys: test' + end + + context 'when `released_at` is not a valid date' do + let(:config) { { released_at: 'ABC123' } } + + it_behaves_like 'reports error', 'release released at must be a valid datetime' + end + + context 'when `ref` is not valid' do + let(:config) { { ref: 'invalid\branch' } } + + it_behaves_like 'reports error', 'release ref must be a valid ref' + end + + context 'when `milestones` is not an array of strings' do + let(:config) { { milestones: [1, 2, 3] } } + + it_behaves_like 'reports error', 'release milestones should be an array of strings or a string' end end end diff --git a/spec/lib/gitlab/ci/config/entry/reports_spec.rb b/spec/lib/gitlab/ci/config/entry/reports_spec.rb index 2c12a88dedb..98105ebcd55 100644 --- a/spec/lib/gitlab/ci/config/entry/reports_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/reports_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Reports do +RSpec.describe Gitlab::Ci::Config::Entry::Reports do let(:entry) { described_class.new(config) } describe 'validates ALLOWED_KEYS' do @@ -44,6 +44,9 @@ describe Gitlab::Ci::Config::Entry::Reports do :license_management | 'gl-license-management-report.json' :license_scanning | 'gl-license-scanning-report.json' :performance | 'performance.json' + :browser_performance | 'browser-performance.json' + :browser_performance | 'performance.json' + :load_performance | 'load-performance.json' :lsif | 'lsif.json' :dotenv | 'build.dotenv' :cobertura | 'cobertura-coverage.xml' diff --git a/spec/lib/gitlab/ci/config/entry/retry_spec.rb b/spec/lib/gitlab/ci/config/entry/retry_spec.rb index 67253c71f6b..b38387a437e 100644 --- a/spec/lib/gitlab/ci/config/entry/retry_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/retry_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Retry do +RSpec.describe Gitlab::Ci::Config::Entry::Retry do let(:entry) { described_class.new(config) } shared_context 'when retry value is a numeric', :numeric do diff --git a/spec/lib/gitlab/ci/config/entry/root_spec.rb b/spec/lib/gitlab/ci/config/entry/root_spec.rb index ba2dbf72fba..140b3c4f55b 100644 --- a/spec/lib/gitlab/ci/config/entry/root_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/root_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Root do +RSpec.describe Gitlab::Ci::Config::Entry::Root do let(:root) { described_class.new(hash) } describe '.nodes' do diff --git a/spec/lib/gitlab/ci/config/entry/rules/rule_spec.rb b/spec/lib/gitlab/ci/config/entry/rules/rule_spec.rb index 20db5f02fc7..4a43e6c9a86 100644 --- a/spec/lib/gitlab/ci/config/entry/rules/rule_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/rules/rule_spec.rb @@ -5,7 +5,7 @@ require 'gitlab_chronic_duration' require 'support/helpers/stub_feature_flags' require_dependency 'active_model' -describe Gitlab::Ci::Config::Entry::Rules::Rule do +RSpec.describe Gitlab::Ci::Config::Entry::Rules::Rule do let(:factory) do Gitlab::Config::Entry::Factory.new(described_class) .metadata(metadata) diff --git a/spec/lib/gitlab/ci/config/entry/rules_spec.rb b/spec/lib/gitlab/ci/config/entry/rules_spec.rb index 3c050801023..7d26365e7b3 100644 --- a/spec/lib/gitlab/ci/config/entry/rules_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/rules_spec.rb @@ -4,7 +4,7 @@ require 'fast_spec_helper' require 'support/helpers/stub_feature_flags' require_dependency 'active_model' -describe Gitlab::Ci::Config::Entry::Rules do +RSpec.describe Gitlab::Ci::Config::Entry::Rules do let(:factory) do Gitlab::Config::Entry::Factory.new(described_class) .metadata(metadata) diff --git a/spec/lib/gitlab/ci/config/entry/script_spec.rb b/spec/lib/gitlab/ci/config/entry/script_spec.rb index 57dc20ea628..1ddf7881e81 100644 --- a/spec/lib/gitlab/ci/config/entry/script_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/script_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Script do +RSpec.describe Gitlab::Ci::Config::Entry::Script do let(:entry) { described_class.new(config) } describe 'validations' do diff --git a/spec/lib/gitlab/ci/config/entry/service_spec.rb b/spec/lib/gitlab/ci/config/entry/service_spec.rb index 66cca100688..9fbc14c19b9 100644 --- a/spec/lib/gitlab/ci/config/entry/service_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Service do +RSpec.describe Gitlab::Ci::Config::Entry::Service do let(:entry) { described_class.new(config) } before do diff --git a/spec/lib/gitlab/ci/config/entry/services_spec.rb b/spec/lib/gitlab/ci/config/entry/services_spec.rb index 764f783b083..e4f8a348d21 100644 --- a/spec/lib/gitlab/ci/config/entry/services_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/services_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Services do +RSpec.describe Gitlab::Ci::Config::Entry::Services do let(:entry) { described_class.new(config) } before do diff --git a/spec/lib/gitlab/ci/config/entry/stage_spec.rb b/spec/lib/gitlab/ci/config/entry/stage_spec.rb index 574fa00575a..2a105fb978e 100644 --- a/spec/lib/gitlab/ci/config/entry/stage_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/stage_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Stage do +RSpec.describe Gitlab::Ci::Config::Entry::Stage do let(:stage) { described_class.new(config) } describe 'validations' do diff --git a/spec/lib/gitlab/ci/config/entry/stages_spec.rb b/spec/lib/gitlab/ci/config/entry/stages_spec.rb index 3e6ff8eca28..1dd11bb03f8 100644 --- a/spec/lib/gitlab/ci/config/entry/stages_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/stages_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Stages do +RSpec.describe Gitlab::Ci::Config::Entry::Stages do let(:entry) { described_class.new(config) } describe 'validations' do diff --git a/spec/lib/gitlab/ci/config/entry/trigger_spec.rb b/spec/lib/gitlab/ci/config/entry/trigger_spec.rb index dfd9807583c..5b4289741f3 100644 --- a/spec/lib/gitlab/ci/config/entry/trigger_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/trigger_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Trigger do +RSpec.describe Gitlab::Ci::Config::Entry::Trigger do subject { described_class.new(config) } context 'when trigger config is a non-empty string' do diff --git a/spec/lib/gitlab/ci/config/entry/variables_spec.rb b/spec/lib/gitlab/ci/config/entry/variables_spec.rb index 1320b366367..d6391092f63 100644 --- a/spec/lib/gitlab/ci/config/entry/variables_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/variables_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Variables do +RSpec.describe Gitlab::Ci::Config::Entry::Variables do let(:entry) { described_class.new(config) } describe 'validations' do diff --git a/spec/lib/gitlab/ci/config/entry/workflow_spec.rb b/spec/lib/gitlab/ci/config/entry/workflow_spec.rb index f2832b94bf0..3d19832e13d 100644 --- a/spec/lib/gitlab/ci/config/entry/workflow_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/workflow_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::Entry::Workflow do +RSpec.describe Gitlab::Ci::Config::Entry::Workflow do let(:factory) { Gitlab::Config::Entry::Factory.new(described_class).value(rules_hash) } let(:config) { factory.create! } diff --git a/spec/lib/gitlab/ci/config/extendable/entry_spec.rb b/spec/lib/gitlab/ci/config/extendable/entry_spec.rb index e00104e3c68..69aa3bab77a 100644 --- a/spec/lib/gitlab/ci/config/extendable/entry_spec.rb +++ b/spec/lib/gitlab/ci/config/extendable/entry_spec.rb @@ -2,7 +2,7 @@ require 'fast_spec_helper' -describe Gitlab::Ci::Config::Extendable::Entry do +RSpec.describe Gitlab::Ci::Config::Extendable::Entry do describe '.new' do context 'when entry key is not included in the context hash' do it 'raises error' do diff --git a/spec/lib/gitlab/ci/config/extendable_spec.rb b/spec/lib/gitlab/ci/config/extendable_spec.rb index 874b224067b..481f55d790e 100644 --- a/spec/lib/gitlab/ci/config/extendable_spec.rb +++ b/spec/lib/gitlab/ci/config/extendable_spec.rb @@ -2,7 +2,7 @@ require 'fast_spec_helper' -describe Gitlab::Ci::Config::Extendable do +RSpec.describe Gitlab::Ci::Config::Extendable do subject { described_class.new(hash) } describe '#each' do diff --git a/spec/lib/gitlab/ci/config/external/context_spec.rb b/spec/lib/gitlab/ci/config/external/context_spec.rb index 610646ca85a..4b9adf7e87b 100644 --- a/spec/lib/gitlab/ci/config/external/context_spec.rb +++ b/spec/lib/gitlab/ci/config/external/context_spec.rb @@ -2,7 +2,7 @@ require 'fast_spec_helper' -describe Gitlab::Ci::Config::External::Context do +RSpec.describe Gitlab::Ci::Config::External::Context do let(:project) { double('Project') } let(:user) { double('User') } let(:sha) { '12345' } diff --git a/spec/lib/gitlab/ci/config/external/file/artifact_spec.rb b/spec/lib/gitlab/ci/config/external/file/artifact_spec.rb index a8eb13c47bc..8dd92c5b5fd 100644 --- a/spec/lib/gitlab/ci/config/external/file/artifact_spec.rb +++ b/spec/lib/gitlab/ci/config/external/file/artifact_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::External::File::Artifact do +RSpec.describe Gitlab::Ci::Config::External::File::Artifact do let(:parent_pipeline) { create(:ci_pipeline) } let(:context) do Gitlab::Ci::Config::External::Context.new(parent_pipeline: parent_pipeline) diff --git a/spec/lib/gitlab/ci/config/external/file/base_spec.rb b/spec/lib/gitlab/ci/config/external/file/base_spec.rb index d472d6527e2..445edb253fd 100644 --- a/spec/lib/gitlab/ci/config/external/file/base_spec.rb +++ b/spec/lib/gitlab/ci/config/external/file/base_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::External::File::Base do +RSpec.describe Gitlab::Ci::Config::External::File::Base do let(:context_params) { { sha: 'HEAD' } } let(:context) { Gitlab::Ci::Config::External::Context.new(**context_params) } diff --git a/spec/lib/gitlab/ci/config/external/file/local_spec.rb b/spec/lib/gitlab/ci/config/external/file/local_spec.rb index c9851239859..993a07568de 100644 --- a/spec/lib/gitlab/ci/config/external/file/local_spec.rb +++ b/spec/lib/gitlab/ci/config/external/file/local_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::External::File::Local do +RSpec.describe Gitlab::Ci::Config::External::File::Local do let_it_be(:project) { create(:project, :repository) } let_it_be(:user) { create(:user) } let(:sha) { '12345' } diff --git a/spec/lib/gitlab/ci/config/external/file/project_spec.rb b/spec/lib/gitlab/ci/config/external/file/project_spec.rb index 4d8f0dbc861..a5e4e27df6f 100644 --- a/spec/lib/gitlab/ci/config/external/file/project_spec.rb +++ b/spec/lib/gitlab/ci/config/external/file/project_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::External::File::Project do +RSpec.describe Gitlab::Ci::Config::External::File::Project do let_it_be(:context_project) { create(:project) } let_it_be(:project) { create(:project, :repository) } let_it_be(:user) { create(:user) } diff --git a/spec/lib/gitlab/ci/config/external/file/remote_spec.rb b/spec/lib/gitlab/ci/config/external/file/remote_spec.rb index a23cce9b757..ab60ac215ba 100644 --- a/spec/lib/gitlab/ci/config/external/file/remote_spec.rb +++ b/spec/lib/gitlab/ci/config/external/file/remote_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::External::File::Remote do +RSpec.describe Gitlab::Ci::Config::External::File::Remote do include StubRequests let(:context_params) { { sha: '12345' } } diff --git a/spec/lib/gitlab/ci/config/external/file/template_spec.rb b/spec/lib/gitlab/ci/config/external/file/template_spec.rb index 7ea5aadac52..ad1d93a64a1 100644 --- a/spec/lib/gitlab/ci/config/external/file/template_spec.rb +++ b/spec/lib/gitlab/ci/config/external/file/template_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::External::File::Template do +RSpec.describe Gitlab::Ci::Config::External::File::Template do let_it_be(:project) { create(:project) } let_it_be(:user) { create(:user) } let(:context_params) { { project: project, sha: '12345', user: user } } diff --git a/spec/lib/gitlab/ci/config/external/mapper_spec.rb b/spec/lib/gitlab/ci/config/external/mapper_spec.rb index fa358f36527..bf14d8d6b34 100644 --- a/spec/lib/gitlab/ci/config/external/mapper_spec.rb +++ b/spec/lib/gitlab/ci/config/external/mapper_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::External::Mapper do +RSpec.describe Gitlab::Ci::Config::External::Mapper do include StubRequests let_it_be(:project) { create(:project, :repository) } diff --git a/spec/lib/gitlab/ci/config/external/processor_spec.rb b/spec/lib/gitlab/ci/config/external/processor_spec.rb index 45f646660a7..b2cf36b2597 100644 --- a/spec/lib/gitlab/ci/config/external/processor_spec.rb +++ b/spec/lib/gitlab/ci/config/external/processor_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Config::External::Processor do +RSpec.describe Gitlab::Ci::Config::External::Processor do include StubRequests let_it_be(:project) { create(:project, :repository) } diff --git a/spec/lib/gitlab/ci/config/normalizer_spec.rb b/spec/lib/gitlab/ci/config/normalizer_spec.rb index db62fb7524d..d3d165ba00f 100644 --- a/spec/lib/gitlab/ci/config/normalizer_spec.rb +++ b/spec/lib/gitlab/ci/config/normalizer_spec.rb @@ -2,7 +2,7 @@ require 'fast_spec_helper' -describe Gitlab::Ci::Config::Normalizer do +RSpec.describe Gitlab::Ci::Config::Normalizer do let(:job_name) { :rspec } let(:job_config) { { script: 'rspec', parallel: 5, name: 'rspec' } } let(:config) { { job_name => job_config } } |