site_prism.vcr 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/CHANGELOG.md +33 -13
- data/Gemfile +9 -14
- data/README.md +14 -0
- data/TODO.md +10 -14
- data/lib/site_prism_vcr/applier.rb +11 -10
- data/lib/site_prism_vcr/dsl/adjuster.rb +28 -4
- data/lib/site_prism_vcr/dsl/initial_adjuster.rb +4 -1
- data/lib/site_prism_vcr/fixture.rb +19 -9
- data/lib/site_prism_vcr/fixtures/converter.rb +4 -4
- data/lib/site_prism_vcr/fixtures/handler.rb +7 -5
- data/lib/site_prism_vcr/fixtures/manager.rb +4 -4
- data/lib/site_prism_vcr/fixtures/modifiers/base.rb +11 -0
- data/lib/site_prism_vcr/fixtures/modifiers/home_path.rb +4 -6
- data/lib/site_prism_vcr/fixtures/modifiers/path.rb +5 -7
- data/lib/site_prism_vcr/fixtures/modifiers/relative_path.rb +21 -0
- data/lib/site_prism_vcr/fixtures.rb +2 -2
- data/lib/site_prism_vcr/options.rb +27 -2
- data/lib/site_prism_vcr/version.rb +1 -1
- data/lib/site_prism_vcr/waiter.rb +6 -0
- data/lib/site_prism_vcr.rb +1 -0
- data/site_prism.vcr.gemspec +3 -3
- data/spec/fixtures/arya_stark.yml +21 -27
- data/spec/fixtures/custom/blank.yml +21 -27
- data/spec/fixtures/custom/bran_stark.yml +21 -27
- data/spec/fixtures/custom/daenerys_targaryen.yml +21 -27
- data/spec/fixtures/jon_snow.yml +21 -27
- data/spec/fixtures/ned_stark.yml +21 -27
- data/spec/fixtures/robb_stark.yml +21 -27
- data/spec/spec_helper.rb +6 -0
- data/spec/spec_integration_helper.rb +16 -6
- data/spec/support/server.rb +8 -0
- data/spec/support/shared/integration/custom_fixtures.rb +5 -2
- data/spec/support/shared/integration/exchange.rb +11 -1
- data/spec/support/shared/integration/home_path.rb +14 -0
- data/spec/support/test_app/test_app.rb +30 -12
- data/spec/unit/applier_spec.rb +6 -13
- data/spec/unit/dsl/adjuster_spec.rb +78 -47
- data/spec/unit/dsl/initial_adjuster_spec.rb +14 -3
- data/spec/unit/fixture_spec.rb +43 -6
- data/spec/unit/fixtures/manager_spec.rb +31 -12
- data/spec/unit/fixtures/modifiers/path_spec.rb +2 -2
- data/spec/unit/fixtures/modifiers/relative_path_spec.rb +23 -0
- data/spec/unit/waiter_spec.rb +65 -31
- metadata +25 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f845bb94c87768204915d967e5f1264c2bea7e05
|
4
|
+
data.tar.gz: 1bbc6bbef92b1f871b85709dacf9b5c0288d3254
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd19a64df6381ccb647ce83099b3589074efb45a8a0cf41cb40357ab3557113ccdb92a5a36f6b2935c827fd336f6a2793faca4f100ebab59f8678ad2294d82b8
|
7
|
+
data.tar.gz: 954c82bb43f16351b039a853850ad00e9a300f9696fc8c8ea87aee3752b348be9cd7084dd803349e68d9c5352217619ce5f303d0cc5fcd65dc34c49de205229d
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,33 @@
|
|
1
|
-
#
|
1
|
+
# 0.1.1
|
2
2
|
|
3
|
-
|
3
|
+
* fixed the issue with using replace and union actions in one block.
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
```ruby
|
6
|
+
self.some_link.click_and_apply_vcr do
|
7
|
+
fixtures ['test', 'test2']
|
8
|
+
union
|
9
|
+
fixtures ['test3']
|
10
|
+
replace
|
11
|
+
end
|
12
|
+
```
|
13
|
+
|
14
|
+
In some cases it may have leaded to unexpected behavior.
|
15
|
+
* internal improvements
|
16
|
+
* upgraded dependencies. Now gem depends on Vcr 2.9.2 and SitePrism 2.6.
|
17
|
+
* added possibility to use relative path with a home path.
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
self.some_link.click_and_apply_vcr do
|
21
|
+
home_path 'custom'
|
22
|
+
|
23
|
+
fixtures ['~/../test'] # '~' indicates a home path which is defined above in this block
|
24
|
+
end
|
25
|
+
```
|
26
|
+
|
27
|
+
# 0.1.0
|
28
|
+
|
29
|
+
* upgraded dependencies. Now gem depends on Vcr 2.8.0 and SitePrism 2.5.
|
30
|
+
* BREAKING CHANGE: re-factored the way how Vcr cassettes could be applying for any event of a page.
|
7
31
|
Before that change we had to use ugly way
|
8
32
|
|
9
33
|
```ruby
|
@@ -24,9 +48,7 @@
|
|
24
48
|
end
|
25
49
|
```
|
26
50
|
|
27
|
-
|
28
|
-
|
29
|
-
* the issue with defining an action to be done over cassettes in the adjusting block. Now even if an action is defined before a list of cassettes, the adjusting block will be performed properly
|
51
|
+
* fixed the issue with defining an action to be done over cassettes in the adjusting block. Now even if an action is defined before a list of cassettes, the adjusting block will be performed properly
|
30
52
|
|
31
53
|
```ruby
|
32
54
|
@products_page.cars_dropdown.click_and_apply_vcr do
|
@@ -35,9 +57,7 @@
|
|
35
57
|
end
|
36
58
|
```
|
37
59
|
|
38
|
-
|
39
|
-
|
40
|
-
* possibility to apply Vcr cassettes for any event of an element. [Roman Rott and Dmitriy Nesteryuk]
|
60
|
+
* added possibility to apply Vcr cassettes for any event of an element. [Roman Rott and Dmitriy Nesteryuk]
|
41
61
|
|
42
62
|
```ruby
|
43
63
|
@products_page.cars_dropdown.shift_event{
|
@@ -47,7 +67,7 @@
|
|
47
67
|
end
|
48
68
|
```
|
49
69
|
|
50
|
-
* possibility to link Vcr with already defined elements, it will be helpful in case they are inherited
|
70
|
+
* added possibility to link Vcr with already defined elements, it will be helpful in case they are inherited
|
51
71
|
|
52
72
|
```ruby
|
53
73
|
class CarsPage < TransportPage
|
@@ -60,7 +80,7 @@
|
|
60
80
|
@page.transport_details_link.click_and_apply_vcr
|
61
81
|
```
|
62
82
|
|
63
|
-
* possibility to redefine default options for a default waiter
|
83
|
+
* added possibility to redefine default options for a default waiter
|
64
84
|
|
65
85
|
```ruby
|
66
86
|
class ProductsPage < SitePrism::Page
|
@@ -75,4 +95,4 @@
|
|
75
95
|
@page.details_link.click_and_apply_vcr do
|
76
96
|
waiter_options(eject_cassettes: true) # redefines default options
|
77
97
|
end
|
78
|
-
```
|
98
|
+
```
|
data/Gemfile
CHANGED
@@ -3,17 +3,12 @@ source 'https://rubygems.org'
|
|
3
3
|
# Specify your gem's dependencies in site_prism.vcr.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
gem 'rspec-fire'
|
16
|
-
gem 'selenium-webdriver'
|
17
|
-
gem 'coveralls', require: false
|
18
|
-
end
|
19
|
-
|
6
|
+
gem 'sinatra'
|
7
|
+
gem 'httpi'
|
8
|
+
gem 'capybara-firebug'
|
9
|
+
gem 'sandi_meter'
|
10
|
+
|
11
|
+
gem 'rspec', '~> 2.14.1'
|
12
|
+
gem 'rspec-fire'
|
13
|
+
gem 'selenium-webdriver', '~> 2.41.0'
|
14
|
+
gem 'coveralls', require: false
|
data/README.md
CHANGED
@@ -147,6 +147,20 @@ class ProductsPage < SitePrism::Page
|
|
147
147
|
end
|
148
148
|
```
|
149
149
|
|
150
|
+
Sometimes you need to specify a cassette which lies in a parent directory of a home path, in this case you can use a relative path with a home path:
|
151
|
+
|
152
|
+
```ruby
|
153
|
+
class ProductsPage < SitePrism::Page
|
154
|
+
element_with_vcr \
|
155
|
+
:car_details_link,
|
156
|
+
'#car_details' do
|
157
|
+
home_path 'cars/small'
|
158
|
+
|
159
|
+
fixture ['~/../ford']
|
160
|
+
end
|
161
|
+
end
|
162
|
+
```
|
163
|
+
|
150
164
|
### Applying VCR cassettes on click
|
151
165
|
|
152
166
|
Cassettes can be applied on a click event:
|
data/TODO.md
CHANGED
@@ -1,23 +1,16 @@
|
|
1
1
|
# TODO
|
2
2
|
|
3
|
-
## Release 0.1.
|
3
|
+
## Release 0.1.2
|
4
4
|
|
5
|
-
1.
|
6
|
-
2.
|
7
|
-
3.
|
8
|
-
4. Think about renaming current integration tests on acceptance tests and create new integration tests which will test integration between classes without involving a browser. It will solve a lot of issues with shared tests to check the same things for pages and elements. In acceptance tests we will test very basic stuffs.
|
9
|
-
5. We should freeze an instance of SPV::Fixtures to make sure it is not mutable, otherwise, there may be situation when default fixtures will be corrupted.
|
10
|
-
6. We should disable double defining actions in the adjusting block:
|
5
|
+
1. Think how to avoid monkey patching to add stuffs to SitePrism
|
6
|
+
2. Change code to use DI with build (http://solnic.eu/2013/12/17/the-world-needs-another-post-about-dependency-injection-in-ruby.html)
|
7
|
+
3. Think about using something like:
|
11
8
|
|
12
9
|
```ruby
|
13
|
-
|
14
|
-
fixtures ['test', 'test2']
|
15
|
-
union
|
16
|
-
fixtures ['test3']
|
17
|
-
replace
|
18
|
-
end
|
10
|
+
~/../bundle_offerings
|
19
11
|
```
|
20
|
-
|
12
|
+
|
13
|
+
when define a path to a fixture, for that we can use a standard class Pathname of Ruby.
|
21
14
|
|
22
15
|
## Release 0.2.0
|
23
16
|
|
@@ -25,6 +18,7 @@ It will lead to mess.
|
|
25
18
|
2. When we eject fixtures from Vcr we should eject only fixtures inserted into Vcr by one specific fixtures manager (See SPV#eject)
|
26
19
|
3. Make this gem working on JRuby (since we eject all VCR cassettes, it may be not thread safe)
|
27
20
|
4. Think about creating set of fixtures which can be exchanged by a name of set. It will be very helpful when you have to exchange a set of fixtures.
|
21
|
+
5. Add code to not remove one specific cassete from VCR
|
28
22
|
|
29
23
|
## Should be implemented?
|
30
24
|
|
@@ -55,5 +49,7 @@ It will lead to mess.
|
|
55
49
|
3. Should we add a test for testing to HTTP requests on page load?
|
56
50
|
4. Should be Options class immutable?
|
57
51
|
5. May be it makes sense to separately keep path from the name of a fixture? See SPV::Fixture class
|
52
|
+
6. Think about renaming current integration tests on acceptance tests and create new integration tests which will test integration between classes without involving a browser. It will solve a lot of issues with shared tests to check the same things for pages and elements. In acceptance tests we will test very basic stuffs.
|
53
|
+
7. May be SPV::Fixtures::TmpKeeper is redundant and SPV::Fixtures can be used as a tmp keeper of fixtures?
|
58
54
|
|
59
55
|
|
@@ -35,11 +35,7 @@ module SPV
|
|
35
35
|
#
|
36
36
|
# @return [void]
|
37
37
|
def apply_vcr(&block)
|
38
|
-
|
39
|
-
raise EventError.new(
|
40
|
-
'Event is not shifted, before applying Vcr you have to shift event with "shift_event" method'
|
41
|
-
)
|
42
|
-
end
|
38
|
+
verify_define_event!
|
43
39
|
|
44
40
|
options = @options.clone_options
|
45
41
|
|
@@ -56,13 +52,18 @@ module SPV
|
|
56
52
|
|
57
53
|
@event_action.call
|
58
54
|
|
59
|
-
|
55
|
+
Waiter.wait(
|
60
56
|
@node,
|
61
57
|
@fixtures_manager,
|
62
58
|
options
|
63
59
|
)
|
64
|
-
|
65
|
-
@waiter.wait
|
66
60
|
end
|
67
|
-
|
68
|
-
|
61
|
+
|
62
|
+
private
|
63
|
+
def verify_define_event!
|
64
|
+
raise EventError.new(
|
65
|
+
'Event is not shifted, before applying Vcr you have to shift event with "shift_event" method'
|
66
|
+
) if @event_action.nil?
|
67
|
+
end
|
68
|
+
end # class Applier
|
69
|
+
end # module SPV
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module SPV
|
2
2
|
module DSL
|
3
|
+
class DoubleActionError < StandardError; end
|
4
|
+
|
3
5
|
# This class extends SPV::DSL::InitialAdjuster with new methods
|
4
6
|
# which can be used in a block for manipulating fixtures before applying them.
|
5
7
|
class Adjuster < InitialAdjuster
|
@@ -7,7 +9,7 @@ module SPV
|
|
7
9
|
super options
|
8
10
|
|
9
11
|
@options, @fixtures = options, fixtures
|
10
|
-
@action = :replace
|
12
|
+
@action = Action.new(:replace)
|
11
13
|
end
|
12
14
|
|
13
15
|
# Defines the replace action as an action which
|
@@ -26,7 +28,7 @@ module SPV
|
|
26
28
|
#
|
27
29
|
# @api public
|
28
30
|
def replace
|
29
|
-
@action = :replace
|
31
|
+
@action.action = :replace
|
30
32
|
end
|
31
33
|
|
32
34
|
# Defines the union action as an action which
|
@@ -45,7 +47,7 @@ module SPV
|
|
45
47
|
#
|
46
48
|
# @api public
|
47
49
|
def union
|
48
|
-
@action = :union
|
50
|
+
@action.action = :union
|
49
51
|
end
|
50
52
|
|
51
53
|
# Exchanges certain default fixtures with another fixtures.
|
@@ -91,13 +93,35 @@ module SPV
|
|
91
93
|
|
92
94
|
# Performs the replace action when no explicit action is defined
|
93
95
|
# in a block for manipulating fixtures before applying them.
|
96
|
+
# Otherwise, performs a defined action (union or replace).
|
94
97
|
#
|
95
98
|
# @return [SPV::Fixtures] A set of prepared fixtures.
|
96
99
|
#
|
97
100
|
# @api public
|
98
101
|
def prepare_fixtures
|
99
|
-
@fixtures.public_send(
|
102
|
+
@fixtures.public_send(
|
103
|
+
@action.action,
|
104
|
+
@tmp_keeper.fixtures
|
105
|
+
)
|
100
106
|
end
|
107
|
+
|
108
|
+
# @private
|
109
|
+
class Action
|
110
|
+
attr_reader :action
|
111
|
+
|
112
|
+
def initialize(default_action)
|
113
|
+
@defined_actions, @action = Set.new, default_action
|
114
|
+
end
|
115
|
+
|
116
|
+
def action=(val)
|
117
|
+
@action = val
|
118
|
+
@defined_actions << val
|
119
|
+
|
120
|
+
raise SPV::DSL::DoubleActionError.new(
|
121
|
+
'You cannot use "replace" and "union" actions together. It may lead to unexpected behavior.'
|
122
|
+
) if @defined_actions.size == 2
|
123
|
+
end
|
124
|
+
end # class Action
|
101
125
|
end # class Adjuster
|
102
126
|
end # module DSL
|
103
127
|
end # module SPV
|
@@ -19,7 +19,10 @@ module SPV
|
|
19
19
|
def fixtures(list)
|
20
20
|
prepared_fixtures = @fixtures_handler.handle_raw(
|
21
21
|
list,
|
22
|
-
[
|
22
|
+
[
|
23
|
+
Fixtures::Modifiers::HomePath.new(@options),
|
24
|
+
Fixtures::Modifiers::RelativePath.new(@options)
|
25
|
+
]
|
23
26
|
)
|
24
27
|
|
25
28
|
@tmp_keeper.add_fixtures(prepared_fixtures)
|
@@ -1,19 +1,29 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
1
3
|
module SPV
|
2
|
-
# Keeps a path to fixture and options which should be
|
4
|
+
# Keeps a path to a fixture and options which should be
|
3
5
|
# passed to Vcr while inserting a cassette
|
4
6
|
class Fixture
|
5
|
-
attr_accessor :
|
7
|
+
attr_accessor :options, :path
|
6
8
|
|
7
9
|
def initialize(name, vcr_options = {})
|
8
|
-
|
10
|
+
path = Pathname.new(name)
|
11
|
+
|
12
|
+
@fixture_name = path.basename
|
13
|
+
@path = path.dirname
|
14
|
+
@options = vcr_options
|
15
|
+
end
|
16
|
+
|
17
|
+
def name
|
18
|
+
(self.path + @fixture_name).to_path
|
9
19
|
end
|
10
20
|
|
11
|
-
def
|
12
|
-
|
21
|
+
def path=(val)
|
22
|
+
@path = Pathname.new(val)
|
13
23
|
end
|
14
24
|
|
15
25
|
def set_home_path(home_path)
|
16
|
-
self.
|
26
|
+
self.path = self.path.to_path.gsub(/\A(\~\/|\~)/, home_path)
|
17
27
|
end
|
18
28
|
|
19
29
|
def has_link_to_home_path?
|
@@ -22,7 +32,7 @@ module SPV
|
|
22
32
|
|
23
33
|
# Returns a name without a link to a home path
|
24
34
|
def clean_name
|
25
|
-
|
35
|
+
@fixture_name.to_path
|
26
36
|
end
|
27
|
-
end
|
28
|
-
end
|
37
|
+
end # class Fixture
|
38
|
+
end # module SPV
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module SPV
|
2
|
-
# Converts
|
2
|
+
# Converts list with fixture names into list of
|
3
3
|
# SPV::Fixture objects.
|
4
4
|
class Fixtures
|
5
5
|
class Converter
|
@@ -12,6 +12,6 @@ module SPV
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
15
|
+
end # class Converter
|
16
|
+
end # class Fixtures
|
17
|
+
end # module SPV
|
@@ -1,7 +1,9 @@
|
|
1
1
|
module SPV
|
2
2
|
class Fixtures
|
3
|
-
# Prepares incoming raw fixtures to be used for inserting
|
4
|
-
# into VCR
|
3
|
+
# Prepares incoming raw list of fixtures to be used for inserting
|
4
|
+
# into VCR.
|
5
|
+
#
|
6
|
+
# Applies a given list of modifiers to list of fixtures.
|
5
7
|
class Handler
|
6
8
|
def initialize(options, convertor = Converter)
|
7
9
|
@options = options
|
@@ -26,6 +28,6 @@ module SPV
|
|
26
28
|
handle_raw fixtures_raw, modifiers
|
27
29
|
end
|
28
30
|
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
31
|
+
end # class Handler
|
32
|
+
end # class Fixtures
|
33
|
+
end # module SPV
|
@@ -9,7 +9,7 @@ module SPV
|
|
9
9
|
|
10
10
|
# Injects given fixtures to Vcr.
|
11
11
|
#
|
12
|
-
# @param fixtures [
|
12
|
+
# @param fixtures [SPV::Fixtures] List of fixtures.
|
13
13
|
#
|
14
14
|
# @return [void]
|
15
15
|
#
|
@@ -33,6 +33,6 @@ module SPV
|
|
33
33
|
def eject
|
34
34
|
SPV::Helpers.eject_all_cassettes
|
35
35
|
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
36
|
+
end # class Manager
|
37
|
+
end # class Fixtures
|
38
|
+
end # module SPV
|
@@ -1,13 +1,11 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
|
1
3
|
module SPV
|
2
4
|
class Fixtures
|
3
5
|
module Modifiers
|
4
6
|
# It takes a fixture and replaces "~/" with
|
5
|
-
# a defined home path
|
6
|
-
class HomePath
|
7
|
-
def initialize(options)
|
8
|
-
@options = options
|
9
|
-
end
|
10
|
-
|
7
|
+
# a defined home path.
|
8
|
+
class HomePath < Base
|
11
9
|
def modify(fixture)
|
12
10
|
if fixture.has_link_to_home_path?
|
13
11
|
if @options.home_path
|
@@ -1,12 +1,10 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
|
1
3
|
module SPV
|
2
4
|
class Fixtures
|
3
5
|
module Modifiers
|
4
|
-
# It takes a fixture and adds a path to it
|
5
|
-
class Path
|
6
|
-
def initialize(options)
|
7
|
-
@options = options
|
8
|
-
end
|
9
|
-
|
6
|
+
# It takes a fixture and adds a path to it.
|
7
|
+
class Path < Base
|
10
8
|
def modify(fixture)
|
11
9
|
if fixture.has_link_to_home_path?
|
12
10
|
raise HomePathError.new(
|
@@ -19,7 +17,7 @@ module SPV
|
|
19
17
|
path = @options.path
|
20
18
|
path = path + '/' unless path[-1, 1] == '/'
|
21
19
|
|
22
|
-
fixture.
|
20
|
+
fixture.path = path
|
23
21
|
end
|
24
22
|
end
|
25
23
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
require_relative 'base'
|
3
|
+
|
4
|
+
module SPV
|
5
|
+
class Fixtures
|
6
|
+
module Modifiers
|
7
|
+
# It allows to move up through a hierarchy of directories.
|
8
|
+
#
|
9
|
+
# Example:
|
10
|
+
# ~/../some_fixture
|
11
|
+
#
|
12
|
+
class RelativePath < Base
|
13
|
+
def modify(fixture)
|
14
|
+
path = Pathname.new(fixture.path)
|
15
|
+
|
16
|
+
fixture.path = path.cleanpath.to_path
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -1,4 +1,7 @@
|
|
1
1
|
module SPV
|
2
|
+
# Keeps options which are used to identify path to fixtures
|
3
|
+
# and options for a waiter which holds execution until expectation
|
4
|
+
# has been met.
|
2
5
|
class Options
|
3
6
|
attr_accessor :waiter, :waiter_options, :home_path
|
4
7
|
|
@@ -8,16 +11,34 @@ module SPV
|
|
8
11
|
end
|
9
12
|
end
|
10
13
|
|
14
|
+
# Defines path to fixtures.
|
15
|
+
#
|
16
|
+
# @param val [String] Path to fixtures.
|
17
|
+
#
|
18
|
+
# @return [void]
|
19
|
+
#
|
20
|
+
# @api private
|
11
21
|
def home_path=(val)
|
12
22
|
val << '/' unless val[-1, 1] == '/'
|
13
23
|
|
14
24
|
@home_path = val
|
15
25
|
end
|
16
26
|
|
27
|
+
# Returns a copy of itself.
|
28
|
+
#
|
29
|
+
# @return [SPV::Options]
|
30
|
+
#
|
31
|
+
# @api private
|
17
32
|
def clone_options
|
18
33
|
dup
|
19
34
|
end
|
20
35
|
|
36
|
+
# Returns options of a waiter in a hash format.
|
37
|
+
# If no options are defined, returns an empty hash.
|
38
|
+
#
|
39
|
+
# @return [Hash]
|
40
|
+
#
|
41
|
+
# @api private
|
21
42
|
def waiter_options
|
22
43
|
@waiter_options || {}
|
23
44
|
end
|
@@ -26,8 +47,12 @@ module SPV
|
|
26
47
|
#
|
27
48
|
# If waiter's options are not defined yet, it will define waiter options
|
28
49
|
# with a given hash.
|
50
|
+
#
|
51
|
+
# @return [void]
|
52
|
+
#
|
53
|
+
# @api private
|
29
54
|
def merge_waiter_options!(options)
|
30
55
|
self.waiter_options = self.waiter_options.merge(options)
|
31
56
|
end
|
32
|
-
end
|
33
|
-
end
|
57
|
+
end # class Options
|
58
|
+
end # module SPV
|
@@ -1,5 +1,11 @@
|
|
1
1
|
module SPV
|
2
2
|
class Waiter
|
3
|
+
def self.wait(node, fixtures_manager, options)
|
4
|
+
waiter = new(node, fixtures_manager, options)
|
5
|
+
waiter.wait
|
6
|
+
waiter
|
7
|
+
end
|
8
|
+
|
3
9
|
def initialize(node, fixtures_manager, options)
|
4
10
|
@node, @waiter_method = node, options.waiter
|
5
11
|
@fixtures_manager = fixtures_manager
|
data/lib/site_prism_vcr.rb
CHANGED
@@ -14,6 +14,7 @@ require 'site_prism_vcr/fixtures/manager'
|
|
14
14
|
require 'site_prism_vcr/fixtures/handler'
|
15
15
|
require 'site_prism_vcr/fixtures/modifiers/path'
|
16
16
|
require 'site_prism_vcr/fixtures/modifiers/home_path'
|
17
|
+
require 'site_prism_vcr/fixtures/modifiers/relative_path'
|
17
18
|
require 'site_prism_vcr/options'
|
18
19
|
require 'site_prism_vcr/options_with_path'
|
19
20
|
require 'site_prism_vcr/dsl/initial_adjuster'
|
data/site_prism.vcr.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ['nesterukd@gmail.com']
|
11
11
|
spec.description = 'This gem integrates VCR library into SitePrism'
|
12
12
|
spec.summary = 'VCR and SitePrism are awesome libraries. But, it is a bit difficult to work with them without some bridge between them. This gem combines these 2 libraries to provide a better way for stubbing external API request which your application is doing. This gem will be very helpful for developers which have an application working with an external API.'
|
13
|
-
spec.homepage = '
|
13
|
+
spec.homepage = 'http://github.com/dnesteryuk/site_prism.vcr'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_dependency 'site_prism', '~> 2.
|
22
|
-
spec.add_dependency 'vcr', '~> 2.
|
21
|
+
spec.add_dependency 'site_prism', '~> 2.6'
|
22
|
+
spec.add_dependency 'vcr', '~> 2.9.0'
|
23
23
|
spec.add_dependency 'webmock'
|
24
24
|
end
|