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 'qa/qa/specs/helpers/context_formatter.rb')
-rw-r--r--qa/qa/specs/helpers/context_formatter.rb68
1 files changed, 0 insertions, 68 deletions
diff --git a/qa/qa/specs/helpers/context_formatter.rb b/qa/qa/specs/helpers/context_formatter.rb
deleted file mode 100644
index 26db7c3b67e..00000000000
--- a/qa/qa/specs/helpers/context_formatter.rb
+++ /dev/null
@@ -1,68 +0,0 @@
-# frozen_string_literal: true
-
-require 'rspec/core'
-require "rspec/core/formatters/base_formatter"
-
-module QA
- module Specs
- module Helpers
- class ContextFormatter < ::RSpec::Core::Formatters::BaseFormatter
- include ContextSelector
-
- ::RSpec::Core::Formatters.register(
- self,
- :example_group_started,
- :example_started
- )
-
- # Starts example group
- # @param [RSpec::Core::Notifications::GroupNotification] example_group_notification
- # @return [void]
- def example_group_started(example_group_notification)
- set_skip_metadata(example_group_notification.group)
- end
-
- # Starts example
- # @param [RSpec::Core::Notifications::ExampleNotification] example_notification
- # @return [void]
- def example_started(example_notification)
- example = example_notification.example
-
- # if skip propagated from example_group, do not reset skip metadata
- set_skip_metadata(example_notification.example) unless example.metadata[:skip]
- end
-
- private
-
- # Skip example_group or example
- #
- # @param [<RSpec::Core::ExampleGroup, RSpec::Core::Example>] example
- # @return [void]
- def set_skip_metadata(example)
- return skip_only(example.metadata) if example.metadata.key?(:only)
- return skip_except(example.metadata) if example.metadata.key?(:except)
- end
-
- # Skip based on 'only' condition
- #
- # @param [Hash] metadata
- # @return [void]
- def skip_only(metadata)
- return if context_matches?(metadata[:only])
-
- metadata[:skip] = 'Test is not compatible with this environment or pipeline'
- end
-
- # Skip based on 'except' condition
- #
- # @param [Hash] metadata
- # @return [void]
- def skip_except(metadata)
- return unless except?(metadata[:except])
-
- metadata[:skip] = 'Test is excluded in this job'
- end
- end
- end
- end
-end