Module: Cukedep::HookDSL
- Defined in:
- lib/cukedep/hook-dsl.rb
Overview
Mix-in module that defines the DSL (Domain-Specific Language) for specifying Cukedep hooks. A hook is a custom code block that is executed when a pre-defined Cukedep event occurs.
Constant Summary collapse
- ValidHookScopes =
%i[all each].freeze
Instance Attribute Summary collapse
-
#after_hooks ⇒ Object
readonly
Returns the value of attribute after_hooks.
-
#before_hooks ⇒ Object
readonly
Returns the value of attribute before_hooks.
Instance Method Summary collapse
-
#after_cuke(aScope, &aBlock) ⇒ Object
This method registers the code block to execute before a Cucumber invocation.
-
#before_cuke(aScope, &aBlock) ⇒ Object
This method registers the code block to execute before a Cucumber invocation.
Instance Attribute Details
#after_hooks ⇒ Object (readonly)
Returns the value of attribute after_hooks.
13 14 15 |
# File 'lib/cukedep/hook-dsl.rb', line 13 def after_hooks @after_hooks end |
#before_hooks ⇒ Object (readonly)
Returns the value of attribute before_hooks.
12 13 14 |
# File 'lib/cukedep/hook-dsl.rb', line 12 def before_hooks @before_hooks end |
Instance Method Details
#after_cuke(aScope, &aBlock) ⇒ Object
This method registers the code block to execute before a Cucumber invocation.
26 27 28 29 30 |
# File 'lib/cukedep/hook-dsl.rb', line 26 def after_cuke(aScope, &aBlock) kind = :after scope = validated_scope(kind, aScope) register_hook(kind, scope, aBlock) if block_given? end |
#before_cuke(aScope, &aBlock) ⇒ Object
This method registers the code block to execute before a Cucumber invocation.
18 19 20 21 22 |
# File 'lib/cukedep/hook-dsl.rb', line 18 def before_cuke(aScope, &aBlock) kind = :before scope = validated_scope(kind, aScope) register_hook(kind, scope, aBlock) if block_given? end |