Class: SPV::DSL::Adjuster
- Inherits:
-
InitialAdjuster
- Object
- InitialAdjuster
- SPV::DSL::Adjuster
- Defined in:
- lib/site_prism_vcr/dsl/adjuster.rb
Overview
This class extends SPV::DSL::InitialAdjuster with new methods which can be used in a block for manipulating fixtures before applying them.
Defined Under Namespace
Classes: Action
Instance Method Summary collapse
-
#exchange(old_fixtures, new_fixtures) ⇒ void
Exchanges certain default fixtures with another fixtures.
-
#initialize(options, fixtures) ⇒ Adjuster
constructor
A new instance of Adjuster.
-
#prepare_fixtures ⇒ SPV::Fixtures
Performs the replace action when no explicit action is defined in a block for manipulating fixtures before applying them.
-
#replace ⇒ void
Defines the replace action as an action which will be performed over cassettes while adjusting cassettes.
-
#union ⇒ void
Defines the union action as an action which will be performed over cassettes while adjusting cassettes.
-
#waiter_options(options) ⇒ void
Redefines default waiter options or if default waiter options is not defined, it defines new options for a waiter.
Methods inherited from InitialAdjuster
#fixtures, #home_path, #path, #shortcut_path, #waiter
Constructor Details
Instance Method Details
#exchange(old_fixtures, new_fixtures) ⇒ void
This method returns an undefined value.
Exchanges certain default fixtures with another fixtures.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/site_prism_vcr/dsl/adjuster.rb', line 63 def exchange(old_fixtures, new_fixtures) home_path_modifier = Fixtures::Modifiers::ShortcutPath.new(@options) old_fixtures = [old_fixtures] unless old_fixtures.is_a?(Array) new_fixtures = [new_fixtures] unless new_fixtures.is_a?(Array) old_fixtures, new_fixtures = @fixtures_handler.handle_set_raws( old_fixtures, new_fixtures, [home_path_modifier] ) @fixtures = @fixtures.exchange( old_fixtures, new_fixtures ) end |
#prepare_fixtures ⇒ SPV::Fixtures
Performs the replace action when no explicit action is defined in a block for manipulating fixtures before applying them. Otherwise, performs a defined action (union or replace).
101 102 103 104 105 106 |
# File 'lib/site_prism_vcr/dsl/adjuster.rb', line 101 def prepare_fixtures @fixtures.public_send( @action.action, @tmp_keeper.fixtures ) end |
#replace ⇒ void
This method returns an undefined value.
Defines the replace action as an action which will be performed over cassettes while adjusting cassettes.
Example:
@page.details_link.click_and_apply_vcr do
fixtures ['no_found']
replace
end
In this case ‘no_found’ cassette will be used instead of default cassettes defined for ‘details_link’.
30 31 32 |
# File 'lib/site_prism_vcr/dsl/adjuster.rb', line 30 def replace @action.action = :replace end |
#union ⇒ void
This method returns an undefined value.
Defines the union action as an action which will be performed over cassettes while adjusting cassettes.
Example:
@page.details_link.click_and_apply_vcr do
fixtures ['no_found']
union
end
In this case ‘no_found’ cassette will be used a long with default cassettes.
49 50 51 |
# File 'lib/site_prism_vcr/dsl/adjuster.rb', line 49 def union @action.action = :union end |
#waiter_options(options) ⇒ void
This method returns an undefined value.
Redefines default waiter options or if default waiter options is not defined, it defines new options for a waiter. This method doesn’t redefine all default options, it redefines only options passed in a hash.
90 91 92 |
# File 'lib/site_prism_vcr/dsl/adjuster.rb', line 90 def () @options.() end |