Class: Qualspec::Suite::Behavior
- Inherits:
-
Object
- Object
- Qualspec::Suite::Behavior
- Defined in:
- lib/qualspec/suite/behavior.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#scenarios_list ⇒ Object
readonly
Returns the value of attribute scenarios_list.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, &block) ⇒ Behavior
constructor
A new instance of Behavior.
- #scenario(name, &block) ⇒ Object
Constructor Details
#initialize(name, &block) ⇒ Behavior
Returns a new instance of Behavior.
8 9 10 11 12 13 |
# File 'lib/qualspec/suite/behavior.rb', line 8 def initialize(name, &block) @name = name @scenarios_list = [] instance_eval(&block) if block_given? # rubocop:disable Style/EvalWithLocation -- DSL pattern requires eval end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/qualspec/suite/behavior.rb', line 6 def name @name end |
#scenarios_list ⇒ Object (readonly)
Returns the value of attribute scenarios_list.
6 7 8 |
# File 'lib/qualspec/suite/behavior.rb', line 6 def scenarios_list @scenarios_list end |
Class Method Details
.clear! ⇒ Object
32 33 34 |
# File 'lib/qualspec/suite/behavior.rb', line 32 def clear! @registry = {} end |
.define(name, &block) ⇒ Object
24 25 26 |
# File 'lib/qualspec/suite/behavior.rb', line 24 def define(name, &block) registry[name.to_sym] = new(name, &block) end |
.find(name) ⇒ Object
28 29 30 |
# File 'lib/qualspec/suite/behavior.rb', line 28 def find(name) registry[name.to_sym] || raise(Qualspec::Error, "Behavior '#{name}' not found") end |
.registry ⇒ Object
20 21 22 |
# File 'lib/qualspec/suite/behavior.rb', line 20 def registry @registry ||= {} end |