Class: Vigia::Config
- Inherits:
-
Object
- Object
- Vigia::Config
- Defined in:
- lib/vigia/config.rb
Instance Attribute Summary collapse
-
#adapter ⇒ Object
Returns the value of attribute adapter.
-
#custom_examples ⇒ Object
Returns the value of attribute custom_examples.
-
#custom_examples_paths ⇒ Object
Returns the value of attribute custom_examples_paths.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#hooks ⇒ Object
Returns the value of attribute hooks.
-
#host ⇒ Object
Returns the value of attribute host.
-
#http_client_class ⇒ Object
Returns the value of attribute http_client_class.
-
#internal_hosts ⇒ Object
Returns the value of attribute internal_hosts.
-
#load_default_examples ⇒ Object
Returns the value of attribute load_default_examples.
-
#rspec_config_block ⇒ Object
Returns the value of attribute rspec_config_block.
-
#source_file ⇒ Object
Returns the value of attribute source_file.
-
#stderr ⇒ Object
Returns the value of attribute stderr.
-
#stdout ⇒ Object
Returns the value of attribute stdout.
Instance Method Summary collapse
- #add_custom_examples_on(filter, name) ⇒ Object
- #after_context(&block) ⇒ Object
- #after_group(&block) ⇒ Object
- #before_context(&block) ⇒ Object
- #before_group(&block) ⇒ Object
- #extend_context(&block) ⇒ Object
- #extend_group(&block) ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #rspec_config(&block) ⇒ Object
- #store_hook(rspec_class, filter, block) ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/vigia/config.rb', line 6 def initialize @host = nil @source_file = nil @rspec_config_block = nil @load_default_examples = true @internal_hosts = [] @headers = {} @custom_examples_paths = [] @custom_examples = [] @hooks = [] @stderr = $stderr @stdout = $stdout @adapter = Vigia::Adapters::Blueprint @http_client_class = Vigia::HttpClient::RestClient end |
Instance Attribute Details
#adapter ⇒ Object
Returns the value of attribute adapter.
4 5 6 |
# File 'lib/vigia/config.rb', line 4 def adapter @adapter end |
#custom_examples ⇒ Object
Returns the value of attribute custom_examples.
3 4 5 |
# File 'lib/vigia/config.rb', line 3 def custom_examples @custom_examples end |
#custom_examples_paths ⇒ Object
Returns the value of attribute custom_examples_paths.
3 4 5 |
# File 'lib/vigia/config.rb', line 3 def custom_examples_paths @custom_examples_paths end |
#headers ⇒ Object
Returns the value of attribute headers.
3 4 5 |
# File 'lib/vigia/config.rb', line 3 def headers @headers end |
#hooks ⇒ Object
Returns the value of attribute hooks.
4 5 6 |
# File 'lib/vigia/config.rb', line 4 def hooks @hooks end |
#host ⇒ Object
Returns the value of attribute host.
3 4 5 |
# File 'lib/vigia/config.rb', line 3 def host @host end |
#http_client_class ⇒ Object
Returns the value of attribute http_client_class.
3 4 5 |
# File 'lib/vigia/config.rb', line 3 def http_client_class @http_client_class end |
#internal_hosts ⇒ Object
Returns the value of attribute internal_hosts.
4 5 6 |
# File 'lib/vigia/config.rb', line 4 def internal_hosts @internal_hosts end |
#load_default_examples ⇒ Object
Returns the value of attribute load_default_examples.
4 5 6 |
# File 'lib/vigia/config.rb', line 4 def load_default_examples @load_default_examples end |
#rspec_config_block ⇒ Object
Returns the value of attribute rspec_config_block.
4 5 6 |
# File 'lib/vigia/config.rb', line 4 def rspec_config_block @rspec_config_block end |
#source_file ⇒ Object
Returns the value of attribute source_file.
3 4 5 |
# File 'lib/vigia/config.rb', line 3 def source_file @source_file end |
#stderr ⇒ Object
Returns the value of attribute stderr.
4 5 6 |
# File 'lib/vigia/config.rb', line 4 def stderr @stderr end |
#stdout ⇒ Object
Returns the value of attribute stdout.
4 5 6 |
# File 'lib/vigia/config.rb', line 4 def stdout @stdout end |
Instance Method Details
#add_custom_examples_on(filter, name) ⇒ Object
28 29 30 |
# File 'lib/vigia/config.rb', line 28 def add_custom_examples_on(filter, name) @custom_examples << { filter: filter, name: name } end |
#after_context(&block) ⇒ Object
52 53 54 |
# File 'lib/vigia/config.rb', line 52 def after_context(&block) store_hook(Vigia::Sail::Context, :after, block) end |
#after_group(&block) ⇒ Object
40 41 42 |
# File 'lib/vigia/config.rb', line 40 def after_group(&block) store_hook(Vigia::Sail::GroupInstance, :after, block) end |
#before_context(&block) ⇒ Object
48 49 50 |
# File 'lib/vigia/config.rb', line 48 def before_context(&block) store_hook(Vigia::Sail::Context, :before, block) end |
#before_group(&block) ⇒ Object
36 37 38 |
# File 'lib/vigia/config.rb', line 36 def before_group(&block) store_hook(Vigia::Sail::GroupInstance, :before, block) end |
#extend_context(&block) ⇒ Object
56 57 58 |
# File 'lib/vigia/config.rb', line 56 def extend_context(&block) store_hook(Vigia::Sail::Context, :extend, block) end |
#extend_group(&block) ⇒ Object
44 45 46 |
# File 'lib/vigia/config.rb', line 44 def extend_group(&block) store_hook(Vigia::Sail::GroupInstance, :extend, block) end |
#rspec_config(&block) ⇒ Object
32 33 34 |
# File 'lib/vigia/config.rb', line 32 def rspec_config(&block) @rspec_config_block = block end |
#store_hook(rspec_class, filter, block) ⇒ Object
60 61 62 |
# File 'lib/vigia/config.rb', line 60 def store_hook(rspec_class, filter, block) @hooks << { rspec_class: rspec_class, filter: filter, block: block } end |
#validate! ⇒ Object
22 23 24 25 26 |
# File 'lib/vigia/config.rb', line 22 def validate! raise("You have to provide a host value in config or in the Apib") unless host true end |