Class: Gurke::Configuration
- Inherits:
-
Object
- Object
- Gurke::Configuration
- Defined in:
- lib/gurke/configuration.rb
Defined Under Namespace
Classes: Hook, HookSet, Inclusion
Instance Attribute Summary collapse
-
#default_retries ⇒ Object
How often a scenario is retries on failure by default.
-
#flaky_retries ⇒ Object
How often a scenario marked as flaky is retries.
Instance Method Summary collapse
-
#after(action = :scenario, opts = nil) { ... } ⇒ Object
Define a after filter running after given action.
- #around(action = :scenario, opts = nil, &block) ⇒ Object
-
#before(action = :scenario, opts = nil) { ... } ⇒ Object
Define a before filter running before given action.
- #hooks ⇒ Object private
-
#include(mod, opts = {}) ⇒ Object
Include given module into all or specific features or scenarios.
- #inclusions ⇒ Object private
-
#initialize ⇒ Configuration
constructor
private
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Configuration.
8 9 10 11 |
# File 'lib/gurke/configuration.rb', line 8 def initialize @default_retries = 0 @flaky_retries = 1 end |
Instance Attribute Details
#default_retries ⇒ Object
How often a scenario is retries on failure by default.
Defaults to none (0).
18 19 20 |
# File 'lib/gurke/configuration.rb', line 18 def default_retries @default_retries end |
#flaky_retries ⇒ Object
How often a scenario marked as flaky is retries.
Defaults to one (1).
24 25 26 |
# File 'lib/gurke/configuration.rb', line 24 def flaky_retries @flaky_retries end |
Instance Method Details
#after(action = :scenario, opts = nil) { ... } ⇒ Object
Define a after filter running after given action.
62 63 64 65 66 |
# File 'lib/gurke/configuration.rb', line 62 def after(action = :scenario, opts = nil, &block) raise ArgumentError.new "Unknown hook: #{action}" unless hooks[action] hooks[action].append :after, Hook.new(opts, &block) end |
#around(action = :scenario, opts = nil, &block) ⇒ Object
44 45 46 47 48 |
# File 'lib/gurke/configuration.rb', line 44 def around(action = :scenario, opts = nil, &block) raise ArgumentError.new "Unknown hook: #{action}" unless hooks[action] hooks[action].append :around, Hook.new(opts, &block) end |
#before(action = :scenario, opts = nil) { ... } ⇒ Object
Define a before filter running before given action.
38 39 40 41 42 |
# File 'lib/gurke/configuration.rb', line 38 def before(action = :scenario, opts = nil, &block) raise ArgumentError.new "Unknown hook: #{action}" unless hooks[action] hooks[action].append :before, Hook.new(opts, &block) end |
#hooks ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/gurke/configuration.rb', line 87 def hooks @hooks ||= begin hooks = { features: HookSet.new, feature: HookSet.new, scenario: HookSet.new, step: HookSet.new, system: HookSet.new, } hooks[:each] = hooks[:scenario] hooks end end |
#include(mod, opts = {}) ⇒ Object
Include given module into all or specific features or scenarios.
77 78 79 |
# File 'lib/gurke/configuration.rb', line 77 def include(mod, opts = {}) inclusions << Inclusion.new(mod, opts) end |
#inclusions ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
82 83 84 |
# File 'lib/gurke/configuration.rb', line 82 def inclusions @inclusions ||= [] end |