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 CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b27bc15efc9ef02cdac9c19415638b241c327929
4
- data.tar.gz: 051ad78469fee6ab6d34d7a27c687edf15c31aa6
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ODhlM2YyNzM4ZjkwYmUwZDNhMTliNWEzYzM4NzFkOGE3ZDg4NDlhMA==
5
+ data.tar.gz: !binary |-
6
+ MjE4MjhiZmE5ZWY2MWI4ZTcxMmQ5YzNlMjgzZTg0NTQ1ZGFiOTE4MA==
5
7
  SHA512:
6
- metadata.gz: ff5719ce35f903b3cf9146f9dba1f293f7bfdd7f081750333ec1dafb13c85dd3e799e6d66c14f8740a63c0577ba7f2bae8364dfc1a5d2ec1823805d4db8659d9
7
- data.tar.gz: 0c0b1d6d25328740b32f1a5bc577189e100e7cbf35871a4d36744274fdfcaa5c22bcf8a2111e97567c696a758687e6ba260c7c6f58cc349c2147c5b75baae725
8
+ metadata.gz: !binary |-
9
+ ODIyYmVjYjViN2MxYjRlYzI5ZTUyMGE4Y2U0ODNhZmE2YmFhZWNkMDM1ZGVi
10
+ NDM4ZDI2ZGFiODlmMWM4NGI5NzQxODAwNGE2ZGZkYTJlZTBkNDQwYzczYmZj
11
+ Mzg4YWYwMGJlNWU2N2U0MjE1ZTIyMTlkMjNkMzk4Yzk2YzYxN2U=
12
+ data.tar.gz: !binary |-
13
+ M2U3MzdkM2RjNWUyZmFlN2NiYTQ0ZjUzMzFmMDJiNjljMDRjMjBiMzY4MjA4
14
+ N2UxNDEwN2NmNzQzNjA5ZTRhOWNiMWY4NDhkNDgwZDczMDcyNjNmZjIyOTZj
15
+ MGE1NjlkMzFiZjkyMzEzODBjYzJmNTMxYjI1YjViMzZmNzg5Njg=
@@ -10,10 +10,11 @@ rvm:
10
10
  - 2.0.0
11
11
  - 1.9.3
12
12
  - jruby-19mode
13
+ - jruby-head
13
14
  matrix:
14
15
  allow_failures:
15
16
  - rvm: jruby-19mode
16
- - rvm: rbx-19mode
17
+ - rvm: jruby-head
17
18
  before_install:
18
19
  - "export DISPLAY=:99.0"
19
20
  - "sh -e /etc/init.d/xvfb start"
@@ -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 'httpi'
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?
@@ -1,7 +1,6 @@
1
1
  require 'vcr'
2
2
  require 'capybara'
3
3
  require 'site_prism'
4
- require 'webmock'
5
4
 
6
5
  require 'site_prism_vcr/version'
7
6
  require 'site_prism_vcr/element'
@@ -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{|cassette| inserted_names.include?(cassette.name) }
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
@@ -1,3 +1,3 @@
1
1
  module SPV
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
  end
@@ -20,5 +20,4 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_dependency 'site_prism', '~> 2.6'
22
22
  spec.add_dependency 'vcr', '~> 2.9.0'
23
- spec.add_dependency 'webmock'
24
23
  end
@@ -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
@@ -1,5 +1,7 @@
1
1
  require 'bundler/setup'
2
2
 
3
+ require 'webmock'
4
+
3
5
  require 'rspec'
4
6
  require 'coveralls'
5
7
 
@@ -10,7 +10,6 @@ Dir['./spec/support/site_prism/pages/**/*.rb'].sort.each {|f| require f }
10
10
 
11
11
  Capybara.app = TestApp
12
12
  Capybara.default_driver = :selenium
13
- HTTPI.log = false
14
13
 
15
14
  Capybara.server_port = Server.find_available_port
16
15
 
@@ -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 'httpi'
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
- HTTPI.get(
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
- HTTPI.get(
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.2.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-01-26 00:00:00.000000000 Z
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
- - ".gitignore"
63
- - ".rspec"
64
- - ".travis.yml"
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: []