Class: Lopata::Configuration
- Inherits:
-
Object
- Object
- Lopata::Configuration
- Defined in:
- lib/lopata/configuration.rb
Overview
Stores runtime configuration information
Instance Attribute Summary collapse
-
#default_role ⇒ Symbol?
User role to be used in scenario if not specified.
-
#env ⇒ Symbol
Environment code.
-
#keep ⇒ Boolean
Keep generated test data after scenarios running.
-
#role_descriptions ⇒ Hash{Symbol => String}
Map or role codes to role name.
Instance Method Summary collapse
-
#add_observer(observer) ⇒ Object
Add an observer to the set Lopata to be used for this run.
-
#after_scenario(*steps, &block) ⇒ Object
Defines ‘after scenario’ steps.
-
#before_scenario(*steps, &block) ⇒ Object
Defines ‘before scenario’ steps.
-
#before_start(&block) ⇒ Object
Add the hook to be called before scenarios running The block will be called after framework initialization and before scenarios parsing.
-
#initialize ⇒ Configuration
constructor
Build an object to store runtime configuration options and set defaults.
Constructor Details
#initialize ⇒ Configuration
Build an object to store runtime configuration options and set defaults
8 9 10 11 12 13 14 15 |
# File 'lib/lopata/configuration.rb', line 8 def initialize @before_start_hooks = [] @before_scenario_steps = [] @after_scenario_steps = [] @observers = [Lopata::Observers::ConsoleOutputObserver.new] @role_descriptions = {} @env = :qa end |
Instance Attribute Details
#default_role ⇒ Symbol?
Returns user role to be used in scenario if not specified.
104 105 106 |
# File 'lib/lopata/configuration.rb', line 104 def default_role @default_role end |
#env ⇒ Symbol
Returns environment code. Default is :qa.
109 110 111 |
# File 'lib/lopata/configuration.rb', line 109 def env @env end |
#keep ⇒ Boolean
Returns keep generated test data after scenarios running. Default is false Set to true for keeping generated data. Use ‘lopata –keep’ modifier to set keep mode on running.
116 117 118 |
# File 'lib/lopata/configuration.rb', line 116 def keep @keep end |
#role_descriptions ⇒ Hash{Symbol => String}
Returns map or role codes to role name.
100 101 102 |
# File 'lib/lopata/configuration.rb', line 100 def role_descriptions @role_descriptions end |
Instance Method Details
#add_observer(observer) ⇒ Object
Add an observer to the set Lopata to be used for this run.
76 77 78 |
# File 'lib/lopata/configuration.rb', line 76 def add_observer(observer) @observers << observer end |
#after_scenario(*steps, &block) ⇒ Object
Defines ‘after scenario’ steps. Given steps will be runned after each scenario in context of scenario. It may be shared step names, and|or block.
63 64 65 66 |
# File 'lib/lopata/configuration.rb', line 63 def after_scenario(*steps, &block) after_scenario_steps.append(*steps) unless steps.empty? after_scenario_steps.append(block) if block_given? end |
#before_scenario(*steps, &block) ⇒ Object
Defines ‘before scenario’ steps. Given steps will be runned before each scenario in context of scenario. It may be shared step names, and|or block.
47 48 49 50 |
# File 'lib/lopata/configuration.rb', line 47 def before_scenario(*steps, &block) before_scenario_steps.append(*steps) unless steps.empty? before_scenario_steps.append(block) if block_given? end |
#before_start(&block) ⇒ Object
Add the hook to be called before scenarios running The block will be called after framework initialization and before scenarios parsing. It usually allow to require and initialize the libraries used for project testing.
27 28 29 |
# File 'lib/lopata/configuration.rb', line 27 def before_start(&block) @before_start_hooks << block end |