site_prism.vcr 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.travis.yml +1 -0
- data/CHANGELOG.md +78 -0
- data/Gemfile +2 -0
- data/README.md +61 -24
- data/TODO.md +28 -40
- data/lib/site_prism_vcr/applier.rb +20 -6
- data/lib/site_prism_vcr/dsl/adjuster.rb +40 -19
- data/lib/site_prism_vcr/dsl/initial_adjuster.rb +1 -1
- data/lib/site_prism_vcr/element.rb +8 -5
- data/lib/site_prism_vcr/fixture.rb +0 -1
- data/lib/site_prism_vcr/options.rb +12 -1
- data/lib/site_prism_vcr/patches/element_container.rb +4 -0
- data/lib/site_prism_vcr/patches/page.rb +25 -27
- data/lib/site_prism_vcr/version.rb +1 -1
- data/site_prism.vcr.gemspec +2 -2
- data/spec/integration/elements/apply_spec.rb +100 -0
- data/spec/integration/elements/events/click_spec.rb +20 -0
- data/spec/integration/{immediate_http_interactions/page_load_on_click_spec.rb → pages/custom_event_spec.rb} +5 -3
- data/spec/integration/{immediate_http_interactions/page_load_spec.rb → pages/load_spec.rb} +13 -9
- data/spec/spec_helper.rb +3 -0
- data/spec/support/shared/integration/custom_fixtures.rb +17 -0
- data/spec/support/shared/integration/exchange.rb +1 -1
- data/spec/support/shared/integration/home_path.rb +1 -1
- data/spec/support/shared/integration/waiter.rb +37 -25
- data/spec/support/site_prism/pages/home.rb +7 -0
- data/spec/support/site_prism/pages/{immediate_http_interactions → page_load}/home_path.rb +1 -1
- data/spec/support/site_prism/pages/{immediate_http_interactions → page_load}/one_request.rb +1 -1
- data/spec/support/site_prism/pages/{immediate_http_interactions → page_load}/subpage.rb +1 -1
- data/spec/support/site_prism/pages/{immediate_http_interactions → page_load}/two_requests.rb +1 -1
- data/spec/support/site_prism/pages/{immediate_http_interactions → page_load}/waiter_without_fixtures_ejection.rb +1 -1
- data/spec/unit/applier_spec.rb +74 -56
- data/spec/unit/dsl/adjuster_spec.rb +58 -47
- data/spec/unit/dsl/initial_adjuster_spec.rb +18 -12
- data/spec/unit/element_spec.rb +11 -13
- data/spec/unit/fixtures/handler_spec.rb +7 -2
- data/spec/unit/fixtures/manager_spec.rb +20 -4
- data/spec/unit/fixtures/modifiers/home_path_spec.rb +14 -3
- data/spec/unit/fixtures/modifiers/path_spec.rb +9 -3
- data/spec/unit/fixtures/tmp_keeper_spec.rb +1 -1
- data/spec/unit/fixtures_spec.rb +5 -5
- data/spec/unit/options_spec.rb +35 -1
- data/spec/unit/patches/element_container_spec.rb +25 -12
- data/spec/unit/patches/page_spec.rb +23 -30
- data/spec/unit/waiter_spec.rb +16 -4
- metadata +30 -30
- data/spec/integration/http_interactions_on_even/click_spec.rb +0 -75
- data/spec/unit/element_container_spec.rb +0 -48
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: site_prism.vcr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitriy Nesteryuk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10
|
11
|
+
date: 2013-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: site_prism
|
@@ -16,40 +16,40 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.5'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '2.
|
26
|
+
version: '2.5'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: vcr
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.
|
33
|
+
version: 2.8.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.
|
40
|
+
version: 2.8.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: webmock
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: This gem integrates VCR library into SitePrism
|
@@ -62,6 +62,7 @@ files:
|
|
62
62
|
- .gitignore
|
63
63
|
- .rspec
|
64
64
|
- .travis.yml
|
65
|
+
- CHANGELOG.md
|
65
66
|
- Gemfile
|
66
67
|
- LICENSE.txt
|
67
68
|
- README.md
|
@@ -96,9 +97,10 @@ files:
|
|
96
97
|
- spec/fixtures/jon_snow.yml
|
97
98
|
- spec/fixtures/ned_stark.yml
|
98
99
|
- spec/fixtures/robb_stark.yml
|
99
|
-
- spec/integration/
|
100
|
-
- spec/integration/
|
101
|
-
- spec/integration/
|
100
|
+
- spec/integration/elements/apply_spec.rb
|
101
|
+
- spec/integration/elements/events/click_spec.rb
|
102
|
+
- spec/integration/pages/custom_event_spec.rb
|
103
|
+
- spec/integration/pages/load_spec.rb
|
102
104
|
- spec/spec_helper.rb
|
103
105
|
- spec/spec_integration_helper.rb
|
104
106
|
- spec/support/shared/integration/custom_fixtures.rb
|
@@ -107,11 +109,11 @@ files:
|
|
107
109
|
- spec/support/shared/integration/waiter.rb
|
108
110
|
- spec/support/site_prism/pages/base.rb
|
109
111
|
- spec/support/site_prism/pages/home.rb
|
110
|
-
- spec/support/site_prism/pages/
|
111
|
-
- spec/support/site_prism/pages/
|
112
|
-
- spec/support/site_prism/pages/
|
113
|
-
- spec/support/site_prism/pages/
|
114
|
-
- spec/support/site_prism/pages/
|
112
|
+
- spec/support/site_prism/pages/page_load/home_path.rb
|
113
|
+
- spec/support/site_prism/pages/page_load/one_request.rb
|
114
|
+
- spec/support/site_prism/pages/page_load/subpage.rb
|
115
|
+
- spec/support/site_prism/pages/page_load/two_requests.rb
|
116
|
+
- spec/support/site_prism/pages/page_load/waiter_without_fixtures_ejection.rb
|
115
117
|
- spec/support/site_prism/sections/console_block.rb
|
116
118
|
- spec/support/test_app/public/jquery.min.js
|
117
119
|
- spec/support/test_app/public/test.js
|
@@ -120,7 +122,6 @@ files:
|
|
120
122
|
- spec/unit/applier_spec.rb
|
121
123
|
- spec/unit/dsl/adjuster_spec.rb
|
122
124
|
- spec/unit/dsl/initial_adjuster_spec.rb
|
123
|
-
- spec/unit/element_container_spec.rb
|
124
125
|
- spec/unit/element_spec.rb
|
125
126
|
- spec/unit/fixture_spec.rb
|
126
127
|
- spec/unit/fixtures/converter_spec.rb
|
@@ -145,17 +146,17 @@ require_paths:
|
|
145
146
|
- lib
|
146
147
|
required_ruby_version: !ruby/object:Gem::Requirement
|
147
148
|
requirements:
|
148
|
-
- -
|
149
|
+
- - '>='
|
149
150
|
- !ruby/object:Gem::Version
|
150
151
|
version: '0'
|
151
152
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
153
|
requirements:
|
153
|
-
- -
|
154
|
+
- - '>='
|
154
155
|
- !ruby/object:Gem::Version
|
155
156
|
version: '0'
|
156
157
|
requirements: []
|
157
158
|
rubyforge_project:
|
158
|
-
rubygems_version: 2.1.
|
159
|
+
rubygems_version: 2.1.11
|
159
160
|
signing_key:
|
160
161
|
specification_version: 4
|
161
162
|
summary: VCR and SitePrism are awesome libraries. But, it is a bit difficult to work
|
@@ -171,9 +172,10 @@ test_files:
|
|
171
172
|
- spec/fixtures/jon_snow.yml
|
172
173
|
- spec/fixtures/ned_stark.yml
|
173
174
|
- spec/fixtures/robb_stark.yml
|
174
|
-
- spec/integration/
|
175
|
-
- spec/integration/
|
176
|
-
- spec/integration/
|
175
|
+
- spec/integration/elements/apply_spec.rb
|
176
|
+
- spec/integration/elements/events/click_spec.rb
|
177
|
+
- spec/integration/pages/custom_event_spec.rb
|
178
|
+
- spec/integration/pages/load_spec.rb
|
177
179
|
- spec/spec_helper.rb
|
178
180
|
- spec/spec_integration_helper.rb
|
179
181
|
- spec/support/shared/integration/custom_fixtures.rb
|
@@ -182,11 +184,11 @@ test_files:
|
|
182
184
|
- spec/support/shared/integration/waiter.rb
|
183
185
|
- spec/support/site_prism/pages/base.rb
|
184
186
|
- spec/support/site_prism/pages/home.rb
|
185
|
-
- spec/support/site_prism/pages/
|
186
|
-
- spec/support/site_prism/pages/
|
187
|
-
- spec/support/site_prism/pages/
|
188
|
-
- spec/support/site_prism/pages/
|
189
|
-
- spec/support/site_prism/pages/
|
187
|
+
- spec/support/site_prism/pages/page_load/home_path.rb
|
188
|
+
- spec/support/site_prism/pages/page_load/one_request.rb
|
189
|
+
- spec/support/site_prism/pages/page_load/subpage.rb
|
190
|
+
- spec/support/site_prism/pages/page_load/two_requests.rb
|
191
|
+
- spec/support/site_prism/pages/page_load/waiter_without_fixtures_ejection.rb
|
190
192
|
- spec/support/site_prism/sections/console_block.rb
|
191
193
|
- spec/support/test_app/public/jquery.min.js
|
192
194
|
- spec/support/test_app/public/test.js
|
@@ -195,7 +197,6 @@ test_files:
|
|
195
197
|
- spec/unit/applier_spec.rb
|
196
198
|
- spec/unit/dsl/adjuster_spec.rb
|
197
199
|
- spec/unit/dsl/initial_adjuster_spec.rb
|
198
|
-
- spec/unit/element_container_spec.rb
|
199
200
|
- spec/unit/element_spec.rb
|
200
201
|
- spec/unit/fixture_spec.rb
|
201
202
|
- spec/unit/fixtures/converter_spec.rb
|
@@ -210,4 +211,3 @@ test_files:
|
|
210
211
|
- spec/unit/patches/page_spec.rb
|
211
212
|
- spec/unit/vcr_helpers_spec.rb
|
212
213
|
- spec/unit/waiter_spec.rb
|
213
|
-
has_rdoc:
|
@@ -1,75 +0,0 @@
|
|
1
|
-
require 'spec_integration_helper'
|
2
|
-
|
3
|
-
feature 'Http interactions on event > Click' do
|
4
|
-
let(:cat_owner) { test_app_page.cat_owner }
|
5
|
-
let(:test_app_page) { HomePage.new }
|
6
|
-
let(:action_method) { :click_and_apply_vcr }
|
7
|
-
|
8
|
-
before do
|
9
|
-
test_app_page.load
|
10
|
-
end
|
11
|
-
|
12
|
-
context 'clicks and handles one HTTP request' do
|
13
|
-
before do
|
14
|
-
test_app_page.link_with_one_request.click_and_apply_vcr
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'applies a default fixture' do
|
18
|
-
expect(test_app_page.cat_owner).to have_content('Ned Stark')
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
context 'when there is a delay between clicking and doing an HTTP request' do
|
23
|
-
before do
|
24
|
-
test_app_page.link_with_one_request_and_delay.click_and_apply_vcr
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'applies a fixture and the test waits for results' do
|
28
|
-
expect(cat_owner).to have_content('Ned Stark')
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
# TODO: should we write the same test for the page load?
|
33
|
-
context 'when an user clicks on the link which causes 2 HTTP requests' do
|
34
|
-
before do
|
35
|
-
test_app_page.link_with_2_requests.click_and_apply_vcr
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'applies 2 fixtures' do
|
39
|
-
expect(cat_owner).to have_content('Ned Stark')
|
40
|
-
expect(cat_owner).to have_content('Robb Stark')
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
it_behaves_like 'when a custom fixture is applied' do
|
45
|
-
let(:actor) { test_app_page.link_with_one_request }
|
46
|
-
|
47
|
-
context 'when clicks again without specifying a custom fixture' do
|
48
|
-
it 'uses a default fixture again' do
|
49
|
-
actor.click_and_apply_vcr
|
50
|
-
|
51
|
-
expect(cat_owner).to have_content('Ned Stark')
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
context 'waiters' do
|
57
|
-
it_behaves_like 'when a default waiter does not eject fixtures' do
|
58
|
-
let(:actor) { test_app_page.link_without_ejecting_fixtures }
|
59
|
-
end
|
60
|
-
|
61
|
-
it_behaves_like 'custom waiters' do
|
62
|
-
let(:actor) { test_app_page.link_with_2_requests }
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
it_behaves_like 'when a home path is define' do
|
67
|
-
let(:actor_with_home_path) { test_app_page.link_with_home_path }
|
68
|
-
let(:actor_without_home_path) { test_app_page.link_with_one_request }
|
69
|
-
end
|
70
|
-
|
71
|
-
it_behaves_like 'when a default fixture is exchanged' do
|
72
|
-
let(:actor_with_home_path) { test_app_page.link_with_home_path }
|
73
|
-
let(:actor_without_home_path) { test_app_page.link_with_2_requests }
|
74
|
-
end
|
75
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
class TestPageWithElement
|
4
|
-
extend SitePrism::ElementContainer
|
5
|
-
|
6
|
-
class << self
|
7
|
-
def element(*); end
|
8
|
-
end
|
9
|
-
|
10
|
-
def el_with_options
|
11
|
-
'original element with options'
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_el; end
|
15
|
-
|
16
|
-
element_with_vcr(:el_with_options, '#selector', fixtures: 'some fixtures') {}
|
17
|
-
end
|
18
|
-
|
19
|
-
describe SitePrism::ElementContainer do
|
20
|
-
describe '.element_with_vcr' do
|
21
|
-
it 'calls the original element method with given arguments' do
|
22
|
-
expect(TestPageWithElement).to receive(:element).with(
|
23
|
-
:test_el,
|
24
|
-
'#test_selector',
|
25
|
-
visible: false
|
26
|
-
)
|
27
|
-
|
28
|
-
TestPageWithElement.instance_eval do
|
29
|
-
element_with_vcr :test_el, '#test_selector', visible: false
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
context 'when a method for getting an element is called' do
|
34
|
-
let(:page) { TestPageWithElement.new }
|
35
|
-
let(:vcr_el) { 'vcr element' }
|
36
|
-
|
37
|
-
subject { page.el_with_options }
|
38
|
-
|
39
|
-
it 'initializes a new instance of an element with empty options' do
|
40
|
-
expect(SPV::Element).to receive(:new).with(
|
41
|
-
'original element with options', page
|
42
|
-
).and_return(vcr_el)
|
43
|
-
|
44
|
-
expect(subject).to eq(vcr_el)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|