site_prism.vcr 0.2.0 → 0.3.0
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 +13 -5
- data/.travis.yml +2 -1
- data/CHANGELOG.md +12 -0
- data/Gemfile +3 -1
- data/TODO.md +0 -22
- data/lib/site_prism_vcr.rb +0 -1
- data/lib/site_prism_vcr/fixtures/manager.rb +7 -1
- data/lib/site_prism_vcr/version.rb +1 -1
- data/site_prism.vcr.gemspec +0 -1
- data/spec/integration/elements/apply_spec.rb +4 -0
- data/spec/integration/pages/load_spec.rb +4 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/spec_integration_helper.rb +0 -1
- data/spec/support/shared/integration/waiter.rb +22 -0
- data/spec/support/test_app/test_app.rb +10 -3
- metadata +11 -25
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ODhlM2YyNzM4ZjkwYmUwZDNhMTliNWEzYzM4NzFkOGE3ZDg4NDlhMA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MjE4MjhiZmE5ZWY2MWI4ZTcxMmQ5YzNlMjgzZTg0NTQ1ZGFiOTE4MA==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ODIyYmVjYjViN2MxYjRlYzI5ZTUyMGE4Y2U0ODNhZmE2YmFhZWNkMDM1ZGVi
|
10
|
+
NDM4ZDI2ZGFiODlmMWM4NGI5NzQxODAwNGE2ZGZkYTJlZTBkNDQwYzczYmZj
|
11
|
+
Mzg4YWYwMGJlNWU2N2U0MjE1ZTIyMTlkMjNkMzk4Yzk2YzYxN2U=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
M2U3MzdkM2RjNWUyZmFlN2NiYTQ0ZjUzMzFmMDJiNjljMDRjMjBiMzY4MjA4
|
14
|
+
N2UxNDEwN2NmNzQzNjA5ZTRhOWNiMWY4NDhkNDgwZDczMDcyNjNmZjIyOTZj
|
15
|
+
MGE1NjlkMzFiZjkyMzEzODBjYzJmNTMxYjI1YjViMzZmNzg5Njg=
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
# 0.3.0
|
2
|
+
|
3
|
+
* fixed an issue with recording new cassettes.
|
4
|
+
* BREAKING CHANGE: Webmock was removed from the dependencies. Any library supported by VCR can be used for stubbing HTTP interactions.
|
5
|
+
* added functionality to receive list of default cassettes from an instance of the page:
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
@dashboard_page.vcr_cassettes # ['cars', 'f1/ferrari']
|
9
|
+
```
|
10
|
+
|
11
|
+
All shorcut paths are replaced with corresponding paths.
|
12
|
+
|
1
13
|
# 0.2.0
|
2
14
|
|
3
15
|
* fixed code for ejecting cassettes from Vcr. Now SitePrism.Vcr ejects only cassettes injected by itself, any other cassettes which are injected outside of this library won't be touched.
|
data/Gemfile
CHANGED
@@ -4,10 +4,12 @@ source 'https://rubygems.org'
|
|
4
4
|
gemspec
|
5
5
|
|
6
6
|
gem 'sinatra'
|
7
|
-
gem '
|
7
|
+
gem 'httpclient'
|
8
8
|
gem 'capybara', '~> 2.4'
|
9
9
|
gem 'sandi_meter'
|
10
10
|
|
11
|
+
gem 'webmock'
|
12
|
+
|
11
13
|
gem 'rspec', '~> 3'
|
12
14
|
gem 'selenium-webdriver', '~> 2'
|
13
15
|
gem 'coveralls', require: false
|
data/TODO.md
CHANGED
@@ -1,27 +1,5 @@
|
|
1
1
|
# TODO
|
2
2
|
|
3
|
-
## Release 0.3.0
|
4
|
-
|
5
|
-
1. Add code not to remove one specific cassete from VCR
|
6
|
-
2. Find better names for `vcr_options_for_load` and `adjust_parent_vcr_options` methods.
|
7
|
-
3. Think about using DCI:
|
8
|
-
```ruby
|
9
|
-
class SPV:Page < SitePrism:Page
|
10
|
-
def load_and_apply_vcr(*args, &block)
|
11
|
-
shift_event { load(*args) }.apply_vcr(&block)
|
12
|
-
end
|
13
|
-
|
14
|
-
def shift_event(&block)
|
15
|
-
vcr_applier.shift_event(&block)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
```
|
19
|
-
4. Add possibility to get a defined cassettes for a page or section:
|
20
|
-
```ruby
|
21
|
-
@dashboard_page.vcr_cassettes # returns a defined cassetted for this page
|
22
|
-
@form_section.vcr_cassettes # returns a defined cassetted for this section
|
23
|
-
```
|
24
|
-
|
25
3
|
## Things to think over
|
26
4
|
|
27
5
|
1. Should we add the integration tests for page load to make sure 2 HTTP requests will be handled properly?
|
data/lib/site_prism_vcr.rb
CHANGED
@@ -50,7 +50,13 @@ module SPV
|
|
50
50
|
inserted_names = @fixtures.map(&:name)
|
51
51
|
|
52
52
|
# TODO: find better way, may be some pull request to the VCR?
|
53
|
-
VCR.send(:cassettes).delete_if
|
53
|
+
VCR.send(:cassettes).delete_if do |cassette|
|
54
|
+
if remove = inserted_names.include?(cassette.name)
|
55
|
+
cassette.eject
|
56
|
+
end
|
57
|
+
|
58
|
+
remove
|
59
|
+
end
|
54
60
|
end
|
55
61
|
end # class Manager
|
56
62
|
end # class Fixtures
|
data/site_prism.vcr.gemspec
CHANGED
@@ -75,6 +75,10 @@ feature 'Elements > Apply Vcr' do
|
|
75
75
|
end
|
76
76
|
|
77
77
|
context 'waiters' do
|
78
|
+
it_behaves_like 'when cassettes are ejected by the waiter' do
|
79
|
+
let(:actor) { shift_click_event_to(:link_with_one_request) }
|
80
|
+
end
|
81
|
+
|
78
82
|
it_behaves_like 'when a default waiter does not eject fixtures' do
|
79
83
|
let(:actor) { shift_click_event_to(:link_without_ejecting_fixtures) }
|
80
84
|
end
|
@@ -45,6 +45,10 @@ feature 'Pages > Load' do
|
|
45
45
|
end
|
46
46
|
|
47
47
|
context 'waiters' do
|
48
|
+
it_behaves_like 'when cassettes are ejected by the waiter' do
|
49
|
+
let(:actor) { PageLoad::OneRequestPage.new }
|
50
|
+
end
|
51
|
+
|
48
52
|
it_behaves_like 'when a default waiter does not eject fixtures' do
|
49
53
|
let(:actor) { PageLoad::WaiterWithoutFixturesEjectionPage.new }
|
50
54
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -84,4 +84,26 @@ shared_examples 'when options are redefined for waiters' do
|
|
84
84
|
['Ned Stark', 'Robb Stark'],
|
85
85
|
['robb_stark', 'ned_stark']
|
86
86
|
end
|
87
|
+
end
|
88
|
+
|
89
|
+
shared_examples 'when cassettes are ejected by the waiter' do
|
90
|
+
let(:path_to_fixture) {
|
91
|
+
VCR.configuration.cassette_library_dir + '/newly_recorded.yml'
|
92
|
+
}
|
93
|
+
|
94
|
+
before do
|
95
|
+
actor.public_send(action_method) do
|
96
|
+
fixtures ['newly_recorded']
|
97
|
+
|
98
|
+
replace
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
after do
|
103
|
+
File.unlink(path_to_fixture) if File.exists?(path_to_fixture)
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'stores a new cassette' do
|
107
|
+
expect(File.exists?(path_to_fixture)).to be_truthy
|
108
|
+
end
|
87
109
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'httpclient'
|
2
2
|
require 'sinatra/base'
|
3
3
|
|
4
4
|
class TestApp < Sinatra::Base
|
@@ -31,7 +31,7 @@ class TestApp < Sinatra::Base
|
|
31
31
|
get '/max.json' do
|
32
32
|
content_type :json
|
33
33
|
|
34
|
-
|
34
|
+
http_request(
|
35
35
|
"http://#{request.host}:#{request.port}/api/cat/max"
|
36
36
|
).body
|
37
37
|
end
|
@@ -39,7 +39,7 @@ class TestApp < Sinatra::Base
|
|
39
39
|
get '/felix.json' do
|
40
40
|
content_type :json
|
41
41
|
|
42
|
-
|
42
|
+
http_request(
|
43
43
|
"http://#{request.host}:#{request.port}/api/cat/felix"
|
44
44
|
).body
|
45
45
|
end
|
@@ -61,4 +61,11 @@ class TestApp < Sinatra::Base
|
|
61
61
|
cat_name: 'Felix'
|
62
62
|
}.to_json
|
63
63
|
end
|
64
|
+
|
65
|
+
def http_request(url)
|
66
|
+
client = HTTPClient.new
|
67
|
+
client.get(
|
68
|
+
url
|
69
|
+
)
|
70
|
+
end
|
64
71
|
end
|
metadata
CHANGED
@@ -1,57 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: site_prism.vcr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.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: 2015-
|
11
|
+
date: 2015-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: site_prism
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '2.6'
|
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
26
|
version: '2.6'
|
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
33
|
version: 2.9.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
40
|
version: 2.9.0
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: webmock
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
41
|
description: This gem integrates VCR library into SitePrism
|
56
42
|
email:
|
57
43
|
- nesterukd@gmail.com
|
@@ -59,9 +45,9 @@ executables: []
|
|
59
45
|
extensions: []
|
60
46
|
extra_rdoc_files: []
|
61
47
|
files:
|
62
|
-
-
|
63
|
-
-
|
64
|
-
-
|
48
|
+
- .gitignore
|
49
|
+
- .rspec
|
50
|
+
- .travis.yml
|
65
51
|
- CHANGELOG.md
|
66
52
|
- Gemfile
|
67
53
|
- LICENSE.txt
|
@@ -155,12 +141,12 @@ require_paths:
|
|
155
141
|
- lib
|
156
142
|
required_ruby_version: !ruby/object:Gem::Requirement
|
157
143
|
requirements:
|
158
|
-
- -
|
144
|
+
- - ! '>='
|
159
145
|
- !ruby/object:Gem::Version
|
160
146
|
version: '0'
|
161
147
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
148
|
requirements:
|
163
|
-
- -
|
149
|
+
- - ! '>='
|
164
150
|
- !ruby/object:Gem::Version
|
165
151
|
version: '0'
|
166
152
|
requirements: []
|