Module: Gitlab::QA::Runtime::Scenario
- Extended by:
- Scenario
- Included in:
- Scenario
- Defined in:
- lib/gitlab/qa/runtime/scenario.rb
Overview
Singleton approach to global test scenario arguments.
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name) ⇒ Object
26
27
28
|
# File 'lib/gitlab/qa/runtime/scenario.rb', line 26
def method_missing(name, *)
raise ArgumentError, "Scenario attribute `#{name}` not defined!"
end
|
Instance Method Details
#attributes ⇒ Object
12
13
14
|
# File 'lib/gitlab/qa/runtime/scenario.rb', line 12
def attributes
@attributes ||= {}
end
|
#define(attribute, value) ⇒ Object
16
17
18
19
20
21
22
23
24
|
# 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|
raise ArgumentError, "Empty `#{attribute}` attribute!" if value.to_s.empty?
end
end
end
|