Class: SPV::DSL::InitialAdjuster
- Inherits:
-
Object
- Object
- SPV::DSL::InitialAdjuster
- Defined in:
- lib/site_prism_vcr/dsl/initial_adjuster.rb
Overview
This class provides DSL which is used while defining fixtures and applying them.
Direct Known Subclasses
Instance Method Summary collapse
-
#fixtures(list) ⇒ void
Defines fixtures which will be inserted into VCR.
-
#home_path(path) ⇒ void
Defines a home path to fixtures.
-
#initialize(options) ⇒ InitialAdjuster
constructor
A new instance of InitialAdjuster.
-
#path(path, fixture_names) ⇒ void
Applies a given path to list of fixtures and defines those fixtures to be inserted into VCR.
-
#prepare_fixtures ⇒ SPV::Fixtures
Returns set of prepared fixtures.
-
#shortcut_path(name, path) ⇒ void
Defines a shortcut path to fixtures.
-
#waiter(waiter_options = nil) { ... } ⇒ void
Defines a waiter which will be used for waiting until all HTTP interactions have finished.
Constructor Details
Instance Method Details
#fixtures(list) ⇒ void
This method returns an undefined value.
Defines fixtures which will be inserted into VCR.
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/site_prism_vcr/dsl/initial_adjuster.rb', line 19 def fixtures(list) prepared_fixtures = @fixtures_handler.handle_raw( list, [ Fixtures::Modifiers::ShortcutPath.new(@options), Fixtures::Modifiers::RelativePath.new(@options) ] ) @tmp_keeper.add_fixtures(prepared_fixtures) end |
#home_path(path) ⇒ void
This method returns an undefined value.
Defines a home path to fixtures. Later this path can be used for defining fixtures.
Example:
home_path 'cassettes/cars/ford'
fixtures['~/car']
43 44 45 |
# File 'lib/site_prism_vcr/dsl/initial_adjuster.rb', line 43 def home_path(path) @options.add_shortcut_path('~', path) end |
#path(path, fixture_names) ⇒ void
This method returns an undefined value.
Applies a given path to list of fixtures and defines those fixtures to be inserted into VCR.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/site_prism_vcr/dsl/initial_adjuster.rb', line 75 def path(path, fixture_names) = OptionsWithPath.new(@options) .path = path path_modifier = Fixtures::Modifiers::Path.new() home_path_modifier = Fixtures::Modifiers::ShortcutPath.new() prepared_fixtures = @fixtures_handler.handle_raw( fixture_names, [ path_modifier, home_path_modifier ] ) @tmp_keeper.add_fixtures(prepared_fixtures) end |
#prepare_fixtures ⇒ SPV::Fixtures
Returns set of prepared fixtures.
115 116 117 |
# File 'lib/site_prism_vcr/dsl/initial_adjuster.rb', line 115 def prepare_fixtures Fixtures.new(@tmp_keeper.fixtures) end |
#shortcut_path(name, path) ⇒ void
This method returns an undefined value.
Defines a shortcut path to fixtures. Later this path can be used for defining fixtures.
Example:
shortcut_path 'ford', 'cassettes/cars/ford'
fixtures[':ford/car']
60 61 62 |
# File 'lib/site_prism_vcr/dsl/initial_adjuster.rb', line 60 def shortcut_path(name, path) @options.add_shortcut_path(name, path) end |
#waiter(waiter_options = nil) { ... } ⇒ void
This method returns an undefined value.
Defines a waiter which will be used for waiting until all HTTP interactions have finished.
105 106 107 108 |
# File 'lib/site_prism_vcr/dsl/initial_adjuster.rb', line 105 def waiter( = nil, &block) @options.waiter = block @options. = end |