site_prism.vcr 0.0.1 → 0.1.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.
Files changed (48) hide show
  1. checksums.yaml +5 -13
  2. data/.travis.yml +1 -0
  3. data/CHANGELOG.md +78 -0
  4. data/Gemfile +2 -0
  5. data/README.md +61 -24
  6. data/TODO.md +28 -40
  7. data/lib/site_prism_vcr/applier.rb +20 -6
  8. data/lib/site_prism_vcr/dsl/adjuster.rb +40 -19
  9. data/lib/site_prism_vcr/dsl/initial_adjuster.rb +1 -1
  10. data/lib/site_prism_vcr/element.rb +8 -5
  11. data/lib/site_prism_vcr/fixture.rb +0 -1
  12. data/lib/site_prism_vcr/options.rb +12 -1
  13. data/lib/site_prism_vcr/patches/element_container.rb +4 -0
  14. data/lib/site_prism_vcr/patches/page.rb +25 -27
  15. data/lib/site_prism_vcr/version.rb +1 -1
  16. data/site_prism.vcr.gemspec +2 -2
  17. data/spec/integration/elements/apply_spec.rb +100 -0
  18. data/spec/integration/elements/events/click_spec.rb +20 -0
  19. data/spec/integration/{immediate_http_interactions/page_load_on_click_spec.rb → pages/custom_event_spec.rb} +5 -3
  20. data/spec/integration/{immediate_http_interactions/page_load_spec.rb → pages/load_spec.rb} +13 -9
  21. data/spec/spec_helper.rb +3 -0
  22. data/spec/support/shared/integration/custom_fixtures.rb +17 -0
  23. data/spec/support/shared/integration/exchange.rb +1 -1
  24. data/spec/support/shared/integration/home_path.rb +1 -1
  25. data/spec/support/shared/integration/waiter.rb +37 -25
  26. data/spec/support/site_prism/pages/home.rb +7 -0
  27. data/spec/support/site_prism/pages/{immediate_http_interactions → page_load}/home_path.rb +1 -1
  28. data/spec/support/site_prism/pages/{immediate_http_interactions → page_load}/one_request.rb +1 -1
  29. data/spec/support/site_prism/pages/{immediate_http_interactions → page_load}/subpage.rb +1 -1
  30. data/spec/support/site_prism/pages/{immediate_http_interactions → page_load}/two_requests.rb +1 -1
  31. data/spec/support/site_prism/pages/{immediate_http_interactions → page_load}/waiter_without_fixtures_ejection.rb +1 -1
  32. data/spec/unit/applier_spec.rb +74 -56
  33. data/spec/unit/dsl/adjuster_spec.rb +58 -47
  34. data/spec/unit/dsl/initial_adjuster_spec.rb +18 -12
  35. data/spec/unit/element_spec.rb +11 -13
  36. data/spec/unit/fixtures/handler_spec.rb +7 -2
  37. data/spec/unit/fixtures/manager_spec.rb +20 -4
  38. data/spec/unit/fixtures/modifiers/home_path_spec.rb +14 -3
  39. data/spec/unit/fixtures/modifiers/path_spec.rb +9 -3
  40. data/spec/unit/fixtures/tmp_keeper_spec.rb +1 -1
  41. data/spec/unit/fixtures_spec.rb +5 -5
  42. data/spec/unit/options_spec.rb +35 -1
  43. data/spec/unit/patches/element_container_spec.rb +25 -12
  44. data/spec/unit/patches/page_spec.rb +23 -30
  45. data/spec/unit/waiter_spec.rb +16 -4
  46. metadata +30 -30
  47. data/spec/integration/http_interactions_on_even/click_spec.rb +0 -75
  48. data/spec/unit/element_container_spec.rb +0 -48
@@ -1,3 +1,3 @@
1
1
  module SPV
2
- VERSION = '0.0.1'
2
+ VERSION = '0.1.0'
3
3
  end
@@ -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.4'
22
- spec.add_dependency 'vcr', '~> 2.6.0'
21
+ spec.add_dependency 'site_prism', '~> 2.5'
22
+ spec.add_dependency 'vcr', '~> 2.8.0'
23
23
  spec.add_dependency 'webmock'
24
24
  end
@@ -0,0 +1,100 @@
1
+ require 'spec_integration_helper'
2
+
3
+ feature 'Elements > Apply Vcr' do
4
+ # It may be any other event, we use click event
5
+ # because it is the simplest one
6
+ def shift_click_event(link)
7
+ link.shift_event { link.click }
8
+ end
9
+
10
+ def shift_click_event_to(link_name)
11
+ link = test_app_page.public_send(link_name)
12
+ shift_click_event(link)
13
+ end
14
+
15
+ let(:cat_owner) { test_app_page.cat_owner }
16
+ let(:test_app_page) { HomePage.new }
17
+ let(:action_method) { :apply_vcr }
18
+
19
+ before do
20
+ test_app_page.load
21
+ end
22
+
23
+ context 'clicks and handles one HTTP request' do
24
+ before do
25
+ shift_click_event_to(:link_with_one_request).apply_vcr
26
+ end
27
+
28
+ it 'applies a default fixture' do
29
+ expect(test_app_page.cat_owner).to have_content('Ned Stark')
30
+ end
31
+ end
32
+
33
+ context 'when VCR is associated with already defined elements' do
34
+ before do
35
+ shift_click_event_to(:link_without_vcr).apply_vcr
36
+ end
37
+
38
+ it 'applies a default fixture' do
39
+ expect(test_app_page.cat_owner).to have_content('Ned Stark')
40
+ end
41
+ end
42
+
43
+ context 'when there is a delay between clicking and doing an HTTP request' do
44
+ before do
45
+ shift_click_event_to(:link_with_one_request_and_delay).apply_vcr
46
+ end
47
+
48
+ it 'applies a fixture and waits for results' do
49
+ expect(cat_owner).to have_content('Ned Stark')
50
+ end
51
+ end
52
+
53
+ # TODO: should we write the same test for the page load?
54
+ context 'when an user clicks on the link which causes 2 HTTP requests' do
55
+ before do
56
+ shift_click_event_to(:link_with_2_requests).apply_vcr
57
+ end
58
+
59
+ it 'applies 2 fixtures' do
60
+ expect(cat_owner).to have_content('Ned Stark')
61
+ expect(cat_owner).to have_content('Robb Stark')
62
+ end
63
+ end
64
+
65
+ it_behaves_like 'when a custom fixture is applied' do
66
+ let(:actor) { shift_click_event_to(:link_with_one_request) }
67
+
68
+ context 'when clicks again without specifying a custom fixture' do
69
+ it 'uses a default fixture again' do
70
+ actor.apply_vcr
71
+
72
+ expect(cat_owner).to have_content('Ned Stark')
73
+ end
74
+ end
75
+ end
76
+
77
+ context 'waiters' do
78
+ it_behaves_like 'when a default waiter does not eject fixtures' do
79
+ let(:actor) { shift_click_event_to(:link_without_ejecting_fixtures) }
80
+ end
81
+
82
+ it_behaves_like 'when options are redefined for waiters' do
83
+ let(:actor) { shift_click_event_to(:link_with_2_requests) }
84
+ end
85
+
86
+ it_behaves_like 'custom waiters' do
87
+ let(:actor) { shift_click_event_to(:link_with_2_requests) }
88
+ end
89
+ end
90
+
91
+ it_behaves_like 'when a home path is define' do
92
+ let(:actor_with_home_path) { shift_click_event_to(:link_with_home_path) }
93
+ let(:actor_without_home_path) { shift_click_event_to(:link_with_one_request) }
94
+ end
95
+
96
+ it_behaves_like 'when a default fixture is exchanged' do
97
+ let(:actor_with_home_path) { shift_click_event_to(:link_with_home_path) }
98
+ let(:actor_without_home_path) { shift_click_event_to(:link_with_2_requests) }
99
+ end
100
+ end
@@ -0,0 +1,20 @@
1
+ require 'spec_integration_helper'
2
+
3
+ feature 'Elements > Events > Click' do
4
+ let(:cat_owner) { test_app_page.cat_owner }
5
+ let(:test_app_page) { HomePage.new }
6
+
7
+ before do
8
+ test_app_page.load
9
+ end
10
+
11
+ context 'applies and handles HTTP request' do
12
+ before do
13
+ test_app_page.link_with_one_request.click_and_apply_vcr
14
+ end
15
+
16
+ it 'applies a default fixture' do
17
+ expect(test_app_page.cat_owner).to have_content('Ned Stark')
18
+ end
19
+ end
20
+ end
@@ -1,13 +1,15 @@
1
1
  require 'spec_integration_helper'
2
2
 
3
- feature 'Immediate Http interactions > Page load on click' do
4
- let(:one_request_page) { ImmediateHttpInteractions::OneRequestPage.new }
3
+ feature 'Pages > Load > Custom event' do
4
+ let(:one_request_page) { PageLoad::OneRequestPage.new }
5
5
 
6
6
  before do
7
7
  index_page = HomePage.new
8
8
  index_page.load
9
9
 
10
- one_request_page.apply_vcr proc { index_page.link_to_go_to_another_page.click }
10
+ one_request_page.shift_event {
11
+ index_page.link_to_go_to_another_page.click
12
+ }.apply_vcr
11
13
  end
12
14
 
13
15
  it 'loads fixtures on opening a page by click on a link' do
@@ -1,8 +1,8 @@
1
1
  require 'spec_integration_helper'
2
2
 
3
- feature 'Immediate Http interactions > Page load' do
3
+ feature 'Pages > Load' do
4
4
  let(:cat_owner) { test_app_page.cat_owner }
5
- let(:test_app_page) { ImmediateHttpInteractions::OneRequestPage.new }
5
+ let(:test_app_page) { PageLoad::OneRequestPage.new }
6
6
  let(:action_method) { :load_and_apply_vcr }
7
7
 
8
8
  context 'when one default fixture is defined' do
@@ -20,7 +20,7 @@ feature 'Immediate Http interactions > Page load' do
20
20
  end
21
21
 
22
22
  context 'when a subpage inherits a page with a defined vcr options' do
23
- let(:test_app_page) { ImmediateHttpInteractions::SubPage.new }
23
+ let(:test_app_page) { PageLoad::SubPage.new }
24
24
 
25
25
  it 'subpage inherits the defined options for its parent page' do
26
26
  test_app_page.load_and_apply_vcr
@@ -35,22 +35,26 @@ feature 'Immediate Http interactions > Page load' do
35
35
 
36
36
  context 'waiters' do
37
37
  it_behaves_like 'when a default waiter does not eject fixtures' do
38
- let(:actor) { ImmediateHttpInteractions::WaiterWithoutFixturesEjectionPage.new }
38
+ let(:actor) { PageLoad::WaiterWithoutFixturesEjectionPage.new }
39
+ end
40
+
41
+ it_behaves_like 'when options are redefined for waiters' do
42
+ let(:actor) { PageLoad::TwoRequestsPage.new }
39
43
  end
40
44
 
41
45
  it_behaves_like 'custom waiters' do
42
- let(:actor) { ImmediateHttpInteractions::TwoRequestsPage.new }
46
+ let(:actor) { PageLoad::TwoRequestsPage.new }
43
47
  let(:test_app_page) { actor }
44
48
  end
45
49
  end
46
50
 
47
51
  it_behaves_like 'when a home path is define' do
48
- let(:actor_with_home_path) { ImmediateHttpInteractions::HomePathPage.new }
49
- let(:actor_without_home_path) { ImmediateHttpInteractions::OneRequestPage.new }
52
+ let(:actor_with_home_path) { PageLoad::HomePathPage.new }
53
+ let(:actor_without_home_path) { PageLoad::OneRequestPage.new }
50
54
  end
51
55
 
52
56
  it_behaves_like 'when a default fixture is exchanged' do
53
- let(:actor_without_home_path) { ImmediateHttpInteractions::TwoRequestsPage.new }
54
- let(:actor_with_home_path) { ImmediateHttpInteractions::HomePathPage.new }
57
+ let(:actor_without_home_path) { PageLoad::TwoRequestsPage.new }
58
+ let(:actor_with_home_path) { PageLoad::HomePathPage.new }
55
59
  end
56
60
  end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'bundler/setup'
2
2
 
3
3
  require 'rspec'
4
+ require 'rspec/fire'
4
5
  require 'coveralls'
5
6
 
6
7
  require 'site_prism.vcr'
@@ -11,6 +12,8 @@ RSpec.configure do |config|
11
12
  config.expect_with :rspec do |c|
12
13
  c.syntax = :expect
13
14
  end
15
+
16
+ config.include(RSpec::Fire)
14
17
  end
15
18
 
16
19
  VCR.configure do |c|
@@ -29,4 +29,21 @@ shared_examples 'when a custom fixture is applied' do
29
29
  expect(cat_owner).to have_content('Robert Baratheon')
30
30
  end
31
31
  end
32
+
33
+ context 'when "replace" action is defined before defining fixtures to be used for replacing' do
34
+ before do
35
+ actor.public_send(action_method) do
36
+ replace
37
+ path 'custom', ['daenerys_targaryen']
38
+ end
39
+ end
40
+
41
+ after do
42
+ SPV::Helpers.eject_all_cassettes
43
+ end
44
+
45
+ it 'uses custom fixture anyway' do
46
+ expect(cat_owner).to have_content('Daenerys Targaryen')
47
+ end
48
+ end
32
49
  end
@@ -35,7 +35,7 @@ shared_examples 'when a default fixture is exchanged' do
35
35
  end
36
36
 
37
37
  it 'uses the exchanged fixture with specified erb variables' do
38
-
38
+ expect(cat_owner).to have_content('Robert Baratheon')
39
39
  end
40
40
  end
41
41
  end
@@ -1,7 +1,7 @@
1
1
  shared_examples 'when a home path is define' do
2
2
  shared_examples 'expects the custom fixture on the page' do
3
3
  it 'applies a stored fixture in the directory defined in the home path' do
4
- expect(test_app_page.cat_owner).to have_content('Bran Stark')
4
+ expect(cat_owner).to have_content('Bran Stark')
5
5
  end
6
6
  end
7
7
 
@@ -1,3 +1,23 @@
1
+ shared_examples 'when cassettes are not ejected' do |texts, cassettes|
2
+ after do
3
+ SPV::Helpers.eject_all_cassettes
4
+ end
5
+
6
+ it 'uses a default waiter' do
7
+ texts.each do |expected_text|
8
+ expect(cat_owner).to have_content(expected_text)
9
+ end
10
+ end
11
+
12
+ it 'VCR contains all cassettes' do
13
+ cassettes.each do |expected_cassette|
14
+ expect(VCR.eject_cassette.name).to eq(expected_cassette)
15
+ end
16
+
17
+ expect(VCR.eject_cassette).to be_nil
18
+ end
19
+ end
20
+
1
21
  shared_examples 'custom waiters' do
2
22
  context 'when a waiter is redefined' do
3
23
  before do
@@ -36,20 +56,9 @@ shared_examples 'custom waiters' do
36
56
  end
37
57
  end
38
58
 
39
- after do
40
- SPV::Helpers.eject_all_cassettes
41
- end
42
-
43
- it 'uses a custom waiter' do
44
- expect(cat_owner).to have_content('Arya Stark')
45
- expect(cat_owner).to have_content('Jon Snow')
46
- end
47
-
48
- it 'VCR contains all cassettes' do
49
- expect(VCR.eject_cassette.name).to eq('jon_snow')
50
- expect(VCR.eject_cassette.name).to eq('arya_stark')
51
- expect(VCR.eject_cassette).to be_nil
52
- end
59
+ it_behaves_like 'when cassettes are not ejected',
60
+ ['Arya Stark', 'Jon Snow'],
61
+ ['jon_snow', 'arya_stark']
53
62
  end
54
63
  end
55
64
 
@@ -58,18 +67,21 @@ shared_examples 'when a default waiter does not eject fixtures' do
58
67
  actor.public_send(action_method)
59
68
  end
60
69
 
61
- after do
62
- SPV::Helpers.eject_all_cassettes
63
- end
70
+ it_behaves_like 'when cassettes are not ejected',
71
+ ['Ned Stark', 'Robb Stark'],
72
+ ['robb_stark', 'ned_stark']
73
+ end
64
74
 
65
- it 'uses a default waiter' do
66
- expect(cat_owner).to have_content('Ned Stark')
67
- expect(cat_owner).to have_content('Robb Stark')
68
- end
75
+ shared_examples 'when options are redefined for waiters' do
76
+ context 'when the option to not eject default fixtures is passed' do
77
+ before do
78
+ actor.public_send(action_method) do
79
+ waiter_options(eject_cassettes: false)
80
+ end
81
+ end
69
82
 
70
- it 'VCR contains all cassettes' do
71
- expect(VCR.eject_cassette.name).to eq('robb_stark')
72
- expect(VCR.eject_cassette.name).to eq('ned_stark')
73
- expect(VCR.eject_cassette).to be_nil
83
+ it_behaves_like 'when cassettes are not ejected',
84
+ ['Ned Stark', 'Robb Stark'],
85
+ ['robb_stark', 'ned_stark']
74
86
  end
75
87
  end
@@ -41,4 +41,11 @@ class HomePage < BasePage
41
41
  fixtures ['ned_stark', 'robb_stark']
42
42
  waiter({eject_cassettes: false}, &:wait_for_ned_stark_and_robb_stark)
43
43
  end
44
+
45
+ element :link_without_vcr, '#link_with_one_request'
46
+
47
+ link_vcr_with_element :link_without_vcr do
48
+ fixtures ['ned_stark']
49
+ waiter &:wait_for_cat_owner
50
+ end
44
51
  end
@@ -1,6 +1,6 @@
1
1
  require_relative '../base'
2
2
 
3
- module ImmediateHttpInteractions
3
+ module PageLoad
4
4
  class HomePathPage < BasePage
5
5
  set_url '/immediate-http-interactions/one-request'
6
6
  set_url_matcher /immediate\-http\-interactions\/one\-request/
@@ -1,6 +1,6 @@
1
1
  require_relative '../base'
2
2
 
3
- module ImmediateHttpInteractions
3
+ module PageLoad
4
4
  class OneRequestPage < BasePage
5
5
  set_url '/immediate-http-interactions/one-request?cat={cat}'
6
6
  set_url_matcher /immediate\-http\-interactions\/one\-request/
@@ -1,6 +1,6 @@
1
1
  require_relative './one_request'
2
2
 
3
- module ImmediateHttpInteractions
3
+ module PageLoad
4
4
  class SubPage < OneRequestPage
5
5
  set_url '/immediate-http-interactions/one-request'
6
6
  end
@@ -1,6 +1,6 @@
1
1
  require_relative '../base'
2
2
 
3
- module ImmediateHttpInteractions
3
+ module PageLoad
4
4
  class TwoRequestsPage < BasePage
5
5
  set_url '/immediate-http-interactions/two-requests'
6
6
 
@@ -1,6 +1,6 @@
1
1
  require_relative '../base'
2
2
 
3
- module ImmediateHttpInteractions
3
+ module PageLoad
4
4
  class WaiterWithoutFixturesEjectionPage < BasePage
5
5
  set_url '/immediate-http-interactions/two-requests'
6
6
 
@@ -1,11 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe SPV::Applier do
4
- let(:node) { double }
5
- let(:options) { double }
6
- let(:fixtures_manager) { double(inject: true) }
7
- let(:fixtures) { double }
8
- let(:initial_adjuster) { double(prepared_fixtures: fixtures) }
4
+ let(:node) { double('node of DOM') }
5
+ let(:options) { instance_double('SPV::Options') }
6
+ let(:fixtures_manager) { instance_double('SPV::Fixtures::Manager', inject: true) }
7
+ let(:fixtures) { double('fixtures') }
8
+ let(:initial_adjuster) do
9
+ instance_double(
10
+ 'SPV::DSL::InitialAdjuster',
11
+ prepare_fixtures: fixtures
12
+ )
13
+ end
9
14
 
10
15
  before do
11
16
  SPV::Options.stub(:new).and_return(options)
@@ -50,7 +55,7 @@ describe SPV::Applier do
50
55
  end
51
56
 
52
57
  it 'receives the fixtures container' do
53
- expect(initial_adjuster).to receive(:prepared_fixtures)
58
+ expect(initial_adjuster).to receive(:prepare_fixtures)
54
59
 
55
60
  subject
56
61
  end
@@ -64,71 +69,84 @@ describe SPV::Applier do
64
69
  end
65
70
  end
66
71
 
67
- describe '#apply' do
68
- let(:cloned_options) { 'cloned options' }
69
- let(:options) { double(clone_options: cloned_options) }
70
- let(:waiter) { double(wait: true) }
71
- let(:prepared_fixtures) { 'prepared_fixtures by adjuster' }
72
-
73
- let(:adjuster) do
74
- double(
75
- mymeth: true,
76
- fixtures: true,
77
- replace: true,
78
- prepared_fixtures: prepared_fixtures
79
- )
80
- end
81
-
72
+ describe '#apply_vcr' do
73
+ let(:node) { double('node of DOM', click: true) }
82
74
  subject(:applier) { described_class.new(node) { } }
83
75
 
84
- before do
85
- SPV::DSL::Adjuster.stub(:new).and_return(adjuster)
86
- SPV::Waiter.stub(:new).and_return(waiter)
87
- end
76
+ context 'when an event is shifted' do
77
+ let(:cloned_options) { 'cloned options' }
78
+ let(:options) { instance_double('SPV::Options', clone_options: cloned_options) }
79
+ let(:waiter) { instance_double('SPV::Waiter', wait: true) }
80
+ let(:prepared_fixtures) { 'prepared_fixtures by adjuster' }
81
+
82
+ let(:adjuster) do
83
+ instance_double(
84
+ 'DSL::Adjuster',
85
+ fixtures: true,
86
+ prepare_fixtures: prepared_fixtures
87
+ )
88
+ end
88
89
 
89
- it 'initializes the fixtures adjuster with a new instance of options' do
90
- expect(SPV::DSL::Adjuster).to receive(:new).with(
91
- cloned_options,
92
- fixtures
93
- )
90
+ before do
91
+ SPV::DSL::Adjuster.stub(:new).and_return(adjuster)
92
+ SPV::Waiter.stub(:new).and_return(waiter)
94
93
 
95
- applier.apply { }
96
- end
94
+ applier.shift_event { node.click }
95
+ end
97
96
 
98
- it 'calls a given block within the context of the adjuster' do
99
- expect(adjuster).to receive(:mymeth)
97
+ it 'initializes the fixtures adjuster with a new instance of options' do
98
+ expect(SPV::DSL::Adjuster).to receive(:new).with(
99
+ cloned_options,
100
+ fixtures
101
+ )
100
102
 
101
- applier.apply(proc{ mymeth }) {}
102
- end
103
+ applier.apply_vcr
104
+ end
103
105
 
104
- it 'applies fixtures' do
105
- expect(fixtures_manager).to receive(:inject).with(prepared_fixtures)
106
+ context 'when a block is given' do
107
+ it 'calls a given block within the context of the adjuster' do
108
+ expect(adjuster).to receive(:fixtures)
106
109
 
107
- applier.apply { }
108
- end
110
+ applier.apply_vcr { fixtures }
111
+ end
112
+ end
109
113
 
110
- it 'initializes the waiter' do
111
- expect(SPV::Waiter).to receive(:new).with(
112
- node,
113
- fixtures_manager,
114
- cloned_options
115
- ).and_return(waiter)
114
+ it 'applies fixtures' do
115
+ expect(fixtures_manager).to receive(:inject).with(prepared_fixtures)
116
116
 
117
- applier.apply { }
118
- end
117
+ applier.apply_vcr
118
+ end
119
119
 
120
- it 'does the click action over a node' do
121
- expect(node).to receive(:click)
120
+ it 'initializes the waiter' do
121
+ expect(SPV::Waiter).to receive(:new).with(
122
+ node,
123
+ fixtures_manager,
124
+ cloned_options
125
+ ).and_return(waiter)
122
126
 
123
- applier.apply do
124
- node.click
127
+ applier.apply_vcr
125
128
  end
126
- end
127
129
 
128
- it 'waits until all HTTP interactions are finished' do
129
- expect(waiter).to receive(:wait)
130
+ it 'does the click action over a node' do
131
+ expect(node).to receive(:click)
132
+
133
+ applier.apply_vcr
134
+ end
130
135
 
131
- applier.apply { }
136
+ it 'waits until all HTTP interactions are finished' do
137
+ expect(waiter).to receive(:wait)
138
+
139
+ applier.apply_vcr
140
+ end
141
+ end
142
+
143
+ context 'when an event is not shifted' do
144
+ it 'raises an error about no event' do
145
+ expect{ subject.apply_vcr }.to raise_error(
146
+ SPV::Applier::EventError,
147
+ 'Event is not shifted, before applying Vcr you have to shift event with "shift_event" method'
148
+ )
149
+ end
132
150
  end
133
151
  end
134
152
  end