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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-08-19 12:08:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-08-19 12:08:42 +0300
commitb76ae638462ab0f673e5915986070518dd3f9ad3 (patch)
treebdab0533383b52873be0ec0eb4d3c66598ff8b91 /qa/spec/specs/helpers
parent434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff)
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'qa/spec/specs/helpers')
-rw-r--r--qa/spec/specs/helpers/context_selector_spec.rb28
-rw-r--r--qa/spec/specs/helpers/quarantine_spec.rb28
2 files changed, 16 insertions, 40 deletions
diff --git a/qa/spec/specs/helpers/context_selector_spec.rb b/qa/spec/specs/helpers/context_selector_spec.rb
index f0250103008..cbdbe6698ae 100644
--- a/qa/spec/specs/helpers/context_selector_spec.rb
+++ b/qa/spec/specs/helpers/context_selector_spec.rb
@@ -2,29 +2,25 @@
require 'rspec/core/sandbox'
-RSpec.configure do |c|
- c.around do |ex|
+RSpec.describe QA::Specs::Helpers::ContextSelector do
+ include Helpers::StubENV
+ include QA::Specs::Helpers::RSpec
+
+ around do |ex|
+ QA::Runtime::Scenario.define(:gitlab_address, 'https://staging.gitlab.com')
+
RSpec::Core::Sandbox.sandboxed do |config|
+ config.formatter = QA::Specs::Helpers::ContextFormatter
+
# If there is an example-within-an-example, we want to make sure the inner example
# does not get a reference to the outer example (the real spec) if it calls
# something like `pending`
config.before(:context) { RSpec.current_example = nil }
-
config.color_mode = :off
ex.run
end
end
-end
-
-RSpec.describe QA::Specs::Helpers::ContextSelector do
- include Helpers::StubENV
- include QA::Specs::Helpers::RSpec
-
- before do
- QA::Runtime::Scenario.define(:gitlab_address, 'https://staging.gitlab.com')
- described_class.configure_rspec
- end
describe '.context_matches?' do
it 'returns true when url has .com' do
@@ -104,7 +100,6 @@ RSpec.describe QA::Specs::Helpers::ContextSelector do
context 'with different environment set' do
before do
QA::Runtime::Scenario.define(:gitlab_address, 'https://gitlab.com')
- described_class.configure_rspec
end
it 'does not run against production' do
@@ -239,7 +234,6 @@ RSpec.describe QA::Specs::Helpers::ContextSelector do
context 'without CI_PROJECT_NAME set' do
before do
stub_env('CI_PROJECT_NAME', nil)
- described_class.configure_rspec
end
it 'runs on any pipeline' do
@@ -273,7 +267,6 @@ RSpec.describe QA::Specs::Helpers::ContextSelector do
context 'when a pipeline triggered from the default branch runs in gitlab-qa' do
before do
stub_env('CI_PROJECT_NAME', 'gitlab-qa')
- described_class.configure_rspec
end
it 'runs on default branch pipelines' do
@@ -310,7 +303,6 @@ RSpec.describe QA::Specs::Helpers::ContextSelector do
context 'with CI_PROJECT_NAME set' do
before do
stub_env('CI_PROJECT_NAME', 'NIGHTLY')
- described_class.configure_rspec
end
it 'runs on designated pipeline' do
@@ -353,7 +345,6 @@ RSpec.describe QA::Specs::Helpers::ContextSelector do
context 'without CI_JOB_NAME set' do
before do
stub_env('CI_JOB_NAME', nil)
- described_class.configure_rspec
end
context 'when excluding contexts' do
@@ -396,7 +387,6 @@ RSpec.describe QA::Specs::Helpers::ContextSelector do
context 'with CI_JOB_NAME set' do
before do
stub_env('CI_JOB_NAME', 'ee:instance-image')
- described_class.configure_rspec
end
context 'when excluding contexts' do
diff --git a/qa/spec/specs/helpers/quarantine_spec.rb b/qa/spec/specs/helpers/quarantine_spec.rb
index 45754a09b17..548a8510988 100644
--- a/qa/spec/specs/helpers/quarantine_spec.rb
+++ b/qa/spec/specs/helpers/quarantine_spec.rb
@@ -2,9 +2,14 @@
require 'rspec/core/sandbox'
-RSpec.configure do |c|
- c.around do |ex|
+RSpec.describe QA::Specs::Helpers::Quarantine do
+ include Helpers::StubENV
+ include QA::Specs::Helpers::RSpec
+
+ around do |ex|
RSpec::Core::Sandbox.sandboxed do |config|
+ config.formatter = QA::Specs::Helpers::QuarantineFormatter
+
# If there is an example-within-an-example, we want to make sure the inner example
# does not get a reference to the outer example (the real spec) if it calls
# something like `pending`
@@ -15,18 +20,9 @@ RSpec.configure do |c|
ex.run
end
end
-end
-
-RSpec.describe QA::Specs::Helpers::Quarantine do
- include Helpers::StubENV
- include QA::Specs::Helpers::RSpec
describe '.skip_or_run_quarantined_contexts' do
context 'with no tag focused' do
- before do
- described_class.configure_rspec
- end
-
it 'skips before hooks of quarantined contexts' do
executed_hooks = []
@@ -66,7 +62,6 @@ RSpec.describe QA::Specs::Helpers::Quarantine do
context 'with :quarantine focused' do
before do
- described_class.configure_rspec
RSpec.configure do |c|
c.filter_run :quarantine
end
@@ -110,10 +105,6 @@ RSpec.describe QA::Specs::Helpers::Quarantine do
describe '.skip_or_run_quarantined_tests_or_contexts' do
context 'with no tag focused' do
- before do
- described_class.configure_rspec
- end
-
it 'skips quarantined tests' do
group = describe_successfully do
it('is pending', :quarantine) {}
@@ -135,7 +126,6 @@ RSpec.describe QA::Specs::Helpers::Quarantine do
context 'with environment set' do
before do
QA::Runtime::Scenario.define(:gitlab_address, 'https://staging.gitlab.com')
- described_class.configure_rspec
end
context 'no pipeline specified' do
@@ -168,7 +158,6 @@ RSpec.describe QA::Specs::Helpers::Quarantine do
shared_examples 'skipped in project' do |project|
before do
stub_env('CI_PROJECT_NAME', project)
- described_class.configure_rspec
end
it "is skipped in #{project}" do
@@ -209,7 +198,6 @@ RSpec.describe QA::Specs::Helpers::Quarantine do
context 'with :quarantine focused' do
before do
- described_class.configure_rspec
RSpec.configure do |c|
c.filter_run :quarantine
end
@@ -234,7 +222,6 @@ RSpec.describe QA::Specs::Helpers::Quarantine do
context 'with a non-quarantine tag focused' do
before do
- described_class.configure_rspec
RSpec.configure do |c|
c.filter_run :foo
end
@@ -277,7 +264,6 @@ RSpec.describe QA::Specs::Helpers::Quarantine do
context 'with :quarantine and non-quarantine tags focused' do
before do
- described_class.configure_rspec
RSpec.configure do |c|
c.filter_run :foo, :bar, :quarantine
end