From 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 18 Feb 2021 10:34:06 +0000 Subject: Add latest changes from gitlab-org/gitlab@13-9-stable-ee --- qa/spec/specs/runner_spec.rb | 28 ++++++++++----------- qa/spec/support/matchers/have_assignee.rb | 15 ----------- qa/spec/support/matchers/have_child_pipeline.rb | 15 ----------- qa/spec/support/matchers/have_content.rb | 15 ----------- qa/spec/support/matchers/have_design.rb | 15 ----------- qa/spec/support/matchers/have_element.rb | 15 ----------- qa/spec/support/matchers/have_file.rb | 15 ----------- qa/spec/support/matchers/have_file_content.rb | 15 ----------- qa/spec/support/matchers/have_issue.rb | 15 ----------- qa/spec/support/matchers/have_job.rb | 15 ----------- qa/spec/support/matchers/have_matcher.rb | 29 ++++++++++++++++++++++ qa/spec/support/matchers/have_package.rb | 15 ----------- qa/spec/support/matchers/have_pipeline.rb | 15 ----------- .../support/matchers/have_related_issue_item.rb | 15 ----------- .../support/matchers/have_snippet_description.rb | 15 ----------- 15 files changed, 43 insertions(+), 209 deletions(-) delete mode 100644 qa/spec/support/matchers/have_assignee.rb delete mode 100644 qa/spec/support/matchers/have_child_pipeline.rb delete mode 100644 qa/spec/support/matchers/have_content.rb delete mode 100644 qa/spec/support/matchers/have_design.rb delete mode 100644 qa/spec/support/matchers/have_element.rb delete mode 100644 qa/spec/support/matchers/have_file.rb delete mode 100644 qa/spec/support/matchers/have_file_content.rb delete mode 100644 qa/spec/support/matchers/have_issue.rb delete mode 100644 qa/spec/support/matchers/have_job.rb create mode 100644 qa/spec/support/matchers/have_matcher.rb delete mode 100644 qa/spec/support/matchers/have_package.rb delete mode 100644 qa/spec/support/matchers/have_pipeline.rb delete mode 100644 qa/spec/support/matchers/have_related_issue_item.rb delete mode 100644 qa/spec/support/matchers/have_snippet_description.rb (limited to 'qa/spec') diff --git a/qa/spec/specs/runner_spec.rb b/qa/spec/specs/runner_spec.rb index b11054f0bd9..642d9e0745b 100644 --- a/qa/spec/specs/runner_spec.rb +++ b/qa/spec/specs/runner_spec.rb @@ -3,9 +3,9 @@ require 'active_support/core_ext/hash' RSpec.describe QA::Specs::Runner do - shared_examples 'excludes orchestrated and geo' do - it 'excludes the orchestrated and geo tags and includes default args' do - expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~geo', *described_class::DEFAULT_TEST_PATH_ARGS]) + shared_examples 'excludes orchestrated, transient, and geo' do + it 'excludes the orchestrated, transient, and geo tags, and includes default args' do + expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~transient', '--tag', '~geo', *described_class::DEFAULT_TEST_PATH_ARGS]) subject.perform end @@ -18,13 +18,13 @@ RSpec.describe QA::Specs::Runner do QA::Runtime::Scenario.define(:gitlab_address, "http://gitlab.test") end - it_behaves_like 'excludes orchestrated and geo' + it_behaves_like 'excludes orchestrated, transient, and geo' context 'when tty is set' do subject { described_class.new.tap { |runner| runner.tty = true } } it 'sets the `--tty` flag' do - expect_rspec_runner_arguments(['--tty', '--tag', '~orchestrated', '--tag', '~geo', *described_class::DEFAULT_TEST_PATH_ARGS]) + expect_rspec_runner_arguments(['--tty', '--tag', '~orchestrated', '--tag', '~transient', '--tag', '~geo', *described_class::DEFAULT_TEST_PATH_ARGS]) subject.perform end @@ -43,7 +43,7 @@ RSpec.describe QA::Specs::Runner do context 'when "--tag smoke" is set as options' do subject { described_class.new.tap { |runner| runner.options = %w[--tag smoke] } } - it 'focuses on the given tag without excluded the orchestrated tag' do + it 'focuses on the given tag without excluded tags' do expect_rspec_runner_arguments(['--tag', '~geo', '--tag', 'smoke', *described_class::DEFAULT_TEST_PATH_ARGS]) subject.perform @@ -53,8 +53,8 @@ RSpec.describe QA::Specs::Runner do context 'when "qa/specs/features/foo" is set as options' do subject { described_class.new.tap { |runner| runner.options = %w[qa/specs/features/foo] } } - it 'passes the given tests path and excludes the orchestrated and geo tags' do - expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~geo', 'qa/specs/features/foo']) + it 'passes the given tests path and excludes the orchestrated, transient, and geo tags' do + expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~transient', '--tag', '~geo', 'qa/specs/features/foo']) subject.perform end @@ -63,7 +63,7 @@ RSpec.describe QA::Specs::Runner do context 'when "--tag smoke" and "qa/specs/features/foo" are set as options' do subject { described_class.new.tap { |runner| runner.options = %w[--tag smoke qa/specs/features/foo] } } - it 'focuses on the given tag and includes the path without excluding the orchestrated tag' do + it 'focuses on the given tag and includes the path without excluding the orchestrated or transient tags' do expect_rspec_runner_arguments(['--tag', '~geo', '--tag', 'smoke', 'qa/specs/features/foo']) subject.perform @@ -76,7 +76,7 @@ RSpec.describe QA::Specs::Runner do end it 'includes default args and excludes the skip_signup_disabled tag' do - expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~geo', '--tag', '~skip_signup_disabled', *described_class::DEFAULT_TEST_PATH_ARGS]) + expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~transient', '--tag', '~geo', '--tag', '~skip_signup_disabled', *described_class::DEFAULT_TEST_PATH_ARGS]) subject.perform end @@ -88,7 +88,7 @@ RSpec.describe QA::Specs::Runner do end it 'includes default args and excludes the skip_live_env tag' do - expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~geo', '--tag', '~skip_live_env', *described_class::DEFAULT_TEST_PATH_ARGS]) + expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~transient', '--tag', '~geo', '--tag', '~skip_live_env', *described_class::DEFAULT_TEST_PATH_ARGS]) subject.perform end end @@ -121,7 +121,7 @@ RSpec.describe QA::Specs::Runner do end it 'includes default args and excludes all unsupported tags' do - expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~geo', *excluded_feature_tags_except(feature), *described_class::DEFAULT_TEST_PATH_ARGS]) + expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~transient', '--tag', '~geo', *excluded_feature_tags_except(feature), *described_class::DEFAULT_TEST_PATH_ARGS]) subject.perform end @@ -146,11 +146,11 @@ RSpec.describe QA::Specs::Runner do end end - it_behaves_like 'excludes orchestrated and geo' + it_behaves_like 'excludes orchestrated, transient, and geo' end context 'when features are not specified' do - it_behaves_like 'excludes orchestrated and geo' + it_behaves_like 'excludes orchestrated, transient, and geo' end end diff --git a/qa/spec/support/matchers/have_assignee.rb b/qa/spec/support/matchers/have_assignee.rb deleted file mode 100644 index 5e7aa2162b2..00000000000 --- a/qa/spec/support/matchers/have_assignee.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Matchers - module HaveAssignee - RSpec::Matchers.define :have_assignee do |assignee| - match do |page_object| - page_object.has_assignee?(assignee) - end - - match_when_negated do |page_object| - page_object.has_no_assignee?(assignee) - end - end - end -end diff --git a/qa/spec/support/matchers/have_child_pipeline.rb b/qa/spec/support/matchers/have_child_pipeline.rb deleted file mode 100644 index d05d9d4209a..00000000000 --- a/qa/spec/support/matchers/have_child_pipeline.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Matchers - module HaveChildPipeline - RSpec::Matchers.define :have_child_pipeline do - match do |page_object| - page_object.has_child_pipeline? - end - - match_when_negated do |page_object| - page_object.has_no_child_pipeline? - end - end - end -end diff --git a/qa/spec/support/matchers/have_content.rb b/qa/spec/support/matchers/have_content.rb deleted file mode 100644 index 66b30b3b6e4..00000000000 --- a/qa/spec/support/matchers/have_content.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Matchers - module HaveContent - RSpec::Matchers.define :have_content do |content| - match do |page_object| - page_object.has_content?(content) - end - - match_when_negated do |page_object| - page_object.has_no_content?(content) - end - end - end -end diff --git a/qa/spec/support/matchers/have_design.rb b/qa/spec/support/matchers/have_design.rb deleted file mode 100644 index 85f1367297a..00000000000 --- a/qa/spec/support/matchers/have_design.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Matchers - module HaveDesign - RSpec::Matchers.define :have_design do |design| - match do |page_object| - page_object.has_design?(design) - end - - match_when_negated do |page_object| - page_object.has_no_design?(design) - end - end - end -end diff --git a/qa/spec/support/matchers/have_element.rb b/qa/spec/support/matchers/have_element.rb deleted file mode 100644 index bf74a78a3b5..00000000000 --- a/qa/spec/support/matchers/have_element.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Matchers - module HaveElement - RSpec::Matchers.define :have_element do |element, **kwargs| - match do |page_object| - page_object.has_element?(element, **kwargs) - end - - match_when_negated do |page_object| - page_object.has_no_element?(element, **kwargs) - end - end - end -end diff --git a/qa/spec/support/matchers/have_file.rb b/qa/spec/support/matchers/have_file.rb deleted file mode 100644 index 2ae295d5ca2..00000000000 --- a/qa/spec/support/matchers/have_file.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Matchers - module HaveFile - RSpec::Matchers.define :have_file do |file| - match do |page_object| - page_object.has_file?(file) - end - - match_when_negated do |page_object| - page_object.has_no_file?(file) - end - end - end -end diff --git a/qa/spec/support/matchers/have_file_content.rb b/qa/spec/support/matchers/have_file_content.rb deleted file mode 100644 index e42ece6d59e..00000000000 --- a/qa/spec/support/matchers/have_file_content.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Matchers - module HaveFileContent - RSpec::Matchers.define :have_file_content do |file_content, file_number| - match do |page_object| - page_object.has_file_content?(file_content, file_number) - end - - match_when_negated do |page_object| - page_object.has_no_file_content?(file_content, file_number) - end - end - end -end diff --git a/qa/spec/support/matchers/have_issue.rb b/qa/spec/support/matchers/have_issue.rb deleted file mode 100644 index 7ef30f22726..00000000000 --- a/qa/spec/support/matchers/have_issue.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Matchers - module HaveIssue - RSpec::Matchers.define :have_issue do |issue| - match do |page_object| - page_object.has_issue?(issue) - end - - match_when_negated do |page_object| - page_object.has_no_issue?(issue) - end - end - end -end diff --git a/qa/spec/support/matchers/have_job.rb b/qa/spec/support/matchers/have_job.rb deleted file mode 100644 index 89829915fce..00000000000 --- a/qa/spec/support/matchers/have_job.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Matchers - module HaveJob - RSpec::Matchers.define :have_job do |job| - match do |page_object| - page_object.has_job?(job) - end - - match_when_negated do |page_object| - page_object.has_no_job?(job) - end - end - end -end diff --git a/qa/spec/support/matchers/have_matcher.rb b/qa/spec/support/matchers/have_matcher.rb new file mode 100644 index 00000000000..43ae27f8796 --- /dev/null +++ b/qa/spec/support/matchers/have_matcher.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +module Matchers + PREDICATE_TARGETS = %w[ + element + file_content + assignee + child_pipeline + content + design + file + issue + job + package + pipeline + related_issue_item + snippet_description + ].each do |predicate| + RSpec::Matchers.define "have_#{predicate}" do |*args, **kwargs| + match do |page_object| + page_object.public_send("has_#{predicate}?", *args, **kwargs) # rubocop:disable GitlabSecurity/PublicSend + end + + match_when_negated do |page_object| + page_object.public_send("has_no_#{predicate}?", *args, **kwargs) # rubocop:disable GitlabSecurity/PublicSend + end + end + end +end diff --git a/qa/spec/support/matchers/have_package.rb b/qa/spec/support/matchers/have_package.rb deleted file mode 100644 index 86e9bfee4d1..00000000000 --- a/qa/spec/support/matchers/have_package.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Matchers - module HavePackage - RSpec::Matchers.define :have_package do |package| - match do |page_object| - page_object.has_package?(package) - end - - match_when_negated do |page_object| - page_object.has_no_package?(package) - end - end - end -end diff --git a/qa/spec/support/matchers/have_pipeline.rb b/qa/spec/support/matchers/have_pipeline.rb deleted file mode 100644 index 2bfd49d671a..00000000000 --- a/qa/spec/support/matchers/have_pipeline.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Matchers - module HavePipeline - RSpec::Matchers.define :have_pipeline do - match do |page_object| - page_object.has_pipeline? - end - - match_when_negated do |page_object| - page_object.has_no_pipeline? - end - end - end -end diff --git a/qa/spec/support/matchers/have_related_issue_item.rb b/qa/spec/support/matchers/have_related_issue_item.rb deleted file mode 100644 index 89403f2422a..00000000000 --- a/qa/spec/support/matchers/have_related_issue_item.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Matchers - module HaveRelatedIssueItem - RSpec::Matchers.define :have_related_issue_item do - match do |page_object| - page_object.has_related_issue_item? - end - - match_when_negated do |page_object| - page_object.has_no_related_issue_item? - end - end - end -end diff --git a/qa/spec/support/matchers/have_snippet_description.rb b/qa/spec/support/matchers/have_snippet_description.rb deleted file mode 100644 index 7c407aefc83..00000000000 --- a/qa/spec/support/matchers/have_snippet_description.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Matchers - module HaveSnippetDescription - RSpec::Matchers.define :have_snippet_description do |description| - match do |page_object| - page_object.has_snippet_description?(description) - end - - match_when_negated do |page_object| - page_object.has_no_snippet_description? - end - end - end -end -- cgit v1.2.3