module Gitlab::QA::Runtime::Scenario

Singleton approach to global test scenario arguments.

Public Instance Methods

attributes() click to toggle source
# File lib/gitlab/qa/runtime/scenario.rb, line 12
def attributes
  @attributes ||= {}
end
define(attribute, value) click to toggle source
# File lib/gitlab/qa/runtime/scenario.rb, line 16
def define(attribute, value)
  attributes.store(attribute.to_sym, value)

  define_singleton_method(attribute) do
    attributes[attribute.to_sym].tap do |value|
      if value.to_s.empty?
        raise ArgumentError, "Empty `#{attribute}` attribute!"
      end
    end
  end
end
method_missing(name, *) click to toggle source

rubocop:disable Style/MethodMissing

# File lib/gitlab/qa/runtime/scenario.rb, line 29
def method_missing(name, *)
  raise ArgumentError, "Scenario attribute `#{name}` not defined!"
end