vcr 2.4.0 → 2.5.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 (85) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +3 -0
  3. data/.travis.yml +2 -0
  4. data/CHANGELOG.md +31 -0
  5. data/Gemfile +1 -2
  6. data/Gemfile.lock +63 -46
  7. data/README.md +5 -2
  8. data/features/cassettes/allow_unused_http_interactions.feature +1 -1
  9. data/features/cassettes/automatic_re_recording.feature +1 -1
  10. data/features/cassettes/decompress.feature +3 -3
  11. data/features/cassettes/dynamic_erb.feature +2 -2
  12. data/features/cassettes/exclusive.feature +1 -1
  13. data/features/cassettes/naming.feature +1 -1
  14. data/features/cassettes/no_cassette.feature +6 -3
  15. data/features/cassettes/persistence.feature +1 -1
  16. data/features/cassettes/update_content_length_header.feature +1 -1
  17. data/features/configuration/allow_http_connections_when_no_cassette.feature +1 -1
  18. data/features/configuration/cassette_library_dir.feature +1 -1
  19. data/features/configuration/debug_logging.feature +5 -5
  20. data/features/configuration/filter_sensitive_data.feature +2 -2
  21. data/features/configuration/hook_into.feature +4 -7
  22. data/features/getting_started.md +2 -2
  23. data/features/hooks/before_playback.feature +5 -5
  24. data/features/hooks/before_record.feature +5 -5
  25. data/features/middleware/rack.feature +2 -2
  26. data/features/record_modes/all.feature +1 -1
  27. data/features/record_modes/new_episodes.feature +1 -1
  28. data/features/record_modes/none.feature +1 -1
  29. data/features/record_modes/once.feature +1 -1
  30. data/features/request_matching/custom_matcher.feature +1 -1
  31. data/features/request_matching/headers.feature +0 -2
  32. data/features/request_matching/playback_repeats.feature +1 -1
  33. data/features/request_matching/uri_without_param.feature +1 -1
  34. data/features/support/env.rb +1 -0
  35. data/features/test_frameworks/cucumber.feature +8 -8
  36. data/features/test_frameworks/rspec_macro.feature +2 -2
  37. data/features/test_frameworks/rspec_metadata.feature +1 -1
  38. data/gemfiles/typhoeus_old.gemfile +1 -1
  39. data/gemfiles/typhoeus_old.gemfile.lock +31 -57
  40. data/lib/vcr/cassette/migrator.rb +8 -1
  41. data/lib/vcr/configuration.rb +9 -2
  42. data/lib/vcr/library_hooks/excon.rb +2 -184
  43. data/lib/vcr/library_hooks/typhoeus.rb +1 -1
  44. data/lib/vcr/library_hooks/typhoeus_0.4.rb +4 -0
  45. data/lib/vcr/library_hooks/webmock.rb +1 -1
  46. data/lib/vcr/middleware/excon.rb +226 -0
  47. data/lib/vcr/version.rb +1 -1
  48. data/spec/acceptance/threading_spec.rb +28 -0
  49. data/spec/monkey_patches.rb +3 -7
  50. data/spec/quality_spec.rb +1 -1
  51. data/spec/spec_helper.rb +7 -4
  52. data/spec/support/http_library_adapters.rb +4 -3
  53. data/spec/support/shared_example_groups/excon.rb +22 -0
  54. data/spec/support/shared_example_groups/hook_into_http_library.rb +46 -46
  55. data/spec/support/shared_example_groups/request_hooks.rb +8 -8
  56. data/spec/vcr/cassette/erb_renderer_spec.rb +5 -5
  57. data/spec/vcr/cassette/http_interaction_list_spec.rb +52 -40
  58. data/spec/vcr/cassette/migrator_spec.rb +11 -11
  59. data/spec/vcr/cassette/persisters/file_system_spec.rb +11 -11
  60. data/spec/vcr/cassette/persisters_spec.rb +2 -2
  61. data/spec/vcr/cassette/serializers_spec.rb +13 -12
  62. data/spec/vcr/cassette_spec.rb +58 -58
  63. data/spec/vcr/configuration_spec.rb +43 -31
  64. data/spec/vcr/deprecations_spec.rb +3 -3
  65. data/spec/vcr/errors_spec.rb +25 -25
  66. data/spec/vcr/extensions/net_http_response_spec.rb +7 -7
  67. data/spec/vcr/library_hooks/excon_spec.rb +7 -85
  68. data/spec/vcr/library_hooks/fakeweb_spec.rb +15 -13
  69. data/spec/vcr/library_hooks/faraday_spec.rb +4 -4
  70. data/spec/vcr/library_hooks/typhoeus_0.4_spec.rb +5 -0
  71. data/spec/vcr/library_hooks/typhoeus_spec.rb +3 -3
  72. data/spec/vcr/library_hooks/webmock_spec.rb +13 -5
  73. data/spec/vcr/library_hooks_spec.rb +9 -9
  74. data/spec/vcr/middleware/faraday_spec.rb +10 -10
  75. data/spec/vcr/middleware/rack_spec.rb +20 -15
  76. data/spec/vcr/request_ignorer_spec.rb +3 -3
  77. data/spec/vcr/request_matcher_registry_spec.rb +88 -61
  78. data/spec/vcr/structs_spec.rb +85 -85
  79. data/spec/vcr/test_frameworks/cucumber_spec.rb +7 -7
  80. data/spec/vcr/test_frameworks/rspec_spec.rb +10 -10
  81. data/spec/vcr/util/hooks_spec.rb +20 -20
  82. data/spec/vcr/util/internet_connection_spec.rb +2 -2
  83. data/spec/vcr_spec.rb +50 -48
  84. data/vcr.gemspec +4 -4
  85. metadata +308 -372
@@ -21,13 +21,13 @@ describe VCR::CucumberTags do
21
21
  end
22
22
 
23
23
  def test_tag(cassette_attribute, tag, expected_value, scenario=current_scenario)
24
- VCR.current_cassette.should be_nil
24
+ expect(VCR.current_cassette).to be_nil
25
25
 
26
26
  before_blocks_for_tags[tag].call(scenario)
27
- VCR.current_cassette.send(cassette_attribute).should eq(expected_value)
27
+ expect(VCR.current_cassette.send(cassette_attribute)).to eq(expected_value)
28
28
  after_blocks_for_tags[tag].call(scenario)
29
29
 
30
- VCR.current_cassette.should be_nil
30
+ expect(VCR.current_cassette).to be_nil
31
31
  end
32
32
 
33
33
  %w(tags tag).each do |tag_method|
@@ -82,9 +82,9 @@ describe VCR::CucumberTags do
82
82
  subject.send(tag_method, 'tag1', original_options)
83
83
  before_blocks_for_tags['tag1'].call(current_scenario)
84
84
 
85
- original_options.should have(2).items
86
- original_options[:use_scenario_name].should eq(true)
87
- original_options[:record].should eq(:none)
85
+ expect(original_options).to have(2).items
86
+ expect(original_options[:use_scenario_name]).to eq(true)
87
+ expect(original_options[:record]).to eq(:none)
88
88
  end
89
89
 
90
90
  it "works properly when multiple scenarios use the tag" do
@@ -101,7 +101,7 @@ describe VCR::CucumberTags do
101
101
  it 'returns the list of cucumber tags' do
102
102
  subject.tags 'tag1', 'tag2'
103
103
  subject.tags 'tag3', 'tag4'
104
- described_class.tags[-4, 4].should eq(%w(@tag1 @tag2 @tag3 @tag4))
104
+ expect(described_class.tags[-4, 4]).to eq(%w(@tag1 @tag2 @tag3 @tag4))
105
105
  end
106
106
  end
107
107
  end
@@ -9,7 +9,7 @@ describe VCR::RSpec::Metadata, :skip_vcr_reset do
9
9
  context 'an example group', :vcr do
10
10
  context 'with a nested example group' do
11
11
  it 'uses a cassette for any examples' do
12
- VCR.current_cassette.name.split('/').should eq([
12
+ expect(VCR.current_cassette.name.split('/')).to eq([
13
13
  'VCR::RSpec::Metadata',
14
14
  'an example group',
15
15
  'with a nested example group',
@@ -21,20 +21,20 @@ describe VCR::RSpec::Metadata, :skip_vcr_reset do
21
21
 
22
22
  context 'with the cassette name overridden at the example group level', :vcr => { :cassette_name => 'foo' } do
23
23
  it 'overrides the cassette name for an example' do
24
- VCR.current_cassette.name.should eq('foo')
24
+ expect(VCR.current_cassette.name).to eq('foo')
25
25
  end
26
26
 
27
27
  it 'overrides the cassette name for another example' do
28
- VCR.current_cassette.name.should eq('foo')
28
+ expect(VCR.current_cassette.name).to eq('foo')
29
29
  end
30
30
  end
31
31
 
32
32
  it 'allows the cassette name to be overriden', :vcr => { :cassette_name => 'foo' } do
33
- VCR.current_cassette.name.should eq('foo')
33
+ expect(VCR.current_cassette.name).to eq('foo')
34
34
  end
35
35
 
36
36
  it 'allows the cassette options to be set', :vcr => { :match_requests_on => [:method] } do
37
- VCR.current_cassette.match_requests_on.should eq([:method])
37
+ expect(VCR.current_cassette.match_requests_on).to eq([:method])
38
38
  end
39
39
  end
40
40
 
@@ -46,18 +46,18 @@ describe VCR::RSpec::Macros do
46
46
  context context_name do
47
47
  after(:each) do
48
48
  if example.metadata[:test_ejection]
49
- VCR.current_cassette.should be_nil
49
+ expect(VCR.current_cassette).to be_nil
50
50
  end
51
51
  end
52
52
 
53
53
  use_vcr_cassette(*args)
54
54
 
55
55
  it 'ejects the cassette in an after hook', :test_ejection do
56
- VCR.current_cassette.should be_a(VCR::Cassette)
56
+ expect(VCR.current_cassette).to be_a(VCR::Cassette)
57
57
  end
58
58
 
59
59
  it "creates a cassette named '#{expected_cassette_name}" do
60
- VCR.current_cassette.name.should eq(expected_cassette_name)
60
+ expect(VCR.current_cassette.name).to eq(expected_cassette_name)
61
61
  end
62
62
 
63
63
  module_eval(&block) if block
@@ -68,7 +68,7 @@ describe VCR::RSpec::Macros do
68
68
 
69
69
  perform_test 'when called with an explicit name and some options', 'explicit_name', 'explicit_name', :match_requests_on => [:method, :host] do
70
70
  it 'uses the provided cassette options' do
71
- VCR.current_cassette.match_requests_on.should eq([:method, :host])
71
+ expect(VCR.current_cassette.match_requests_on).to eq([:method, :host])
72
72
  end
73
73
  end
74
74
 
@@ -76,7 +76,7 @@ describe VCR::RSpec::Macros do
76
76
 
77
77
  perform_test 'when called with some options', 'VCR::RSpec::Macros/#use_vcr_cassette/when called with some options', :match_requests_on => [:method, :host] do
78
78
  it 'uses the provided cassette options' do
79
- VCR.current_cassette.match_requests_on.should eq([:method, :host])
79
+ expect(VCR.current_cassette.match_requests_on).to eq([:method, :host])
80
80
  end
81
81
  end
82
82
  end
@@ -6,21 +6,21 @@ describe VCR::Hooks::FilteredHook do
6
6
  called = false
7
7
  subject.hook = lambda { called = true }
8
8
  subject.conditionally_invoke
9
- called.should be_true
9
+ expect(called).to be_true
10
10
  end
11
11
 
12
12
  it 'forwards the given arguments to the hook' do
13
13
  args = nil
14
14
  subject.hook = lambda { |a, b| args = [a, b] }
15
15
  subject.conditionally_invoke(3, 5)
16
- args.should eq([3, 5])
16
+ expect(args).to eq([3, 5])
17
17
  end
18
18
 
19
19
  it 'forwards only as many arguments as the hook block accepts' do
20
20
  args = nil
21
21
  subject.hook = lambda { |a| args = [a] }
22
22
  subject.conditionally_invoke(3, 5)
23
- args.should eq([3])
23
+ expect(args).to eq([3])
24
24
  end
25
25
 
26
26
  it 'does not invoke the hook if all of the filters return false' do
@@ -28,7 +28,7 @@ describe VCR::Hooks::FilteredHook do
28
28
  subject.hook = lambda { called = true }
29
29
  subject.filters = lambda { false }
30
30
  subject.conditionally_invoke
31
- called.should be_false
31
+ expect(called).to be_false
32
32
  end
33
33
 
34
34
  it 'does not invoke the hook if any of the filters returns false' do
@@ -36,21 +36,21 @@ describe VCR::Hooks::FilteredHook do
36
36
  subject.hook = lambda { called = true }
37
37
  subject.filters = [lambda { false }, lambda { true }]
38
38
  subject.conditionally_invoke
39
- called.should be_false
39
+ expect(called).to be_false
40
40
  end
41
41
 
42
42
  it 'forwards arguments to the filters' do
43
43
  filter_args = nil
44
44
  subject.filters = lambda { |a, b| filter_args = [a, b]; false }
45
45
  subject.conditionally_invoke(3, 5)
46
- filter_args.should eq([3, 5])
46
+ expect(filter_args).to eq([3, 5])
47
47
  end
48
48
 
49
49
  it 'handles splat args properly' do
50
50
  filter_args = nil
51
51
  subject.filters = lambda { |*args| filter_args = args; false }
52
52
  subject.conditionally_invoke(3, 5)
53
- filter_args.should eq([3, 5])
53
+ expect(filter_args).to eq([3, 5])
54
54
  end
55
55
 
56
56
  it 'forwards only as many arguments as the filter blocks accept' do
@@ -61,8 +61,8 @@ describe VCR::Hooks::FilteredHook do
61
61
  ]
62
62
 
63
63
  subject.conditionally_invoke(3, 5)
64
- args1.should eq([3])
65
- args2.should eq([3, 5])
64
+ expect(args1).to eq([3])
65
+ expect(args2).to eq([3, 5])
66
66
  end
67
67
 
68
68
  it '#to_procs the filter objects' do
@@ -70,7 +70,7 @@ describe VCR::Hooks::FilteredHook do
70
70
  subject.hook = lambda { }
71
71
  subject.filters = [stub(:to_proc => lambda { filter_called = true })]
72
72
  subject.conditionally_invoke
73
- filter_called.should be_true
73
+ expect(filter_called).to be_true
74
74
  end
75
75
  end
76
76
  end
@@ -99,7 +99,7 @@ describe VCR::Hooks do
99
99
  end
100
100
 
101
101
  subject.before_foo { }
102
- override_called.should be_true
102
+ expect(override_called).to be_true
103
103
  end
104
104
 
105
105
  describe '#clear_hooks' do
@@ -107,7 +107,7 @@ describe VCR::Hooks do
107
107
  subject.before_foo { invocations << :callback }
108
108
  subject.clear_hooks
109
109
  subject.invoke_hook(:before_foo)
110
- invocations.should be_empty
110
+ expect(invocations).to be_empty
111
111
  end
112
112
  end
113
113
 
@@ -116,42 +116,42 @@ describe VCR::Hooks do
116
116
  subject.before_foo { invocations << :callback_1 }
117
117
  subject.before_foo { invocations << :callback_2 }
118
118
 
119
- invocations.should be_empty
119
+ expect(invocations).to be_empty
120
120
  subject.invoke_hook(:before_foo)
121
- invocations.should eq([:callback_1, :callback_2])
121
+ expect(invocations).to eq([:callback_1, :callback_2])
122
122
  end
123
123
 
124
124
  it 'maps the return value of each callback' do
125
125
  subject.before_foo { 17 }
126
126
  subject.before_foo { 12 }
127
- subject.invoke_hook(:before_foo).should eq([17, 12])
127
+ expect(subject.invoke_hook(:before_foo)).to eq([17, 12])
128
128
  end
129
129
 
130
130
  it 'does not invoke any filtered callbacks' do
131
131
  subject.before_foo(:real?) { invocations << :blue_callback }
132
132
  subject.invoke_hook(:before_foo, stub(:real? => false))
133
- invocations.should be_empty
133
+ expect(invocations).to be_empty
134
134
  end
135
135
 
136
136
  it 'invokes them in reverse order if the hook was defined with :prepend' do
137
137
  subject.before_bar { 17 }
138
138
  subject.before_bar { 12 }
139
- subject.invoke_hook(:before_bar).should eq([12, 17])
139
+ expect(subject.invoke_hook(:before_bar)).to eq([12, 17])
140
140
  end
141
141
  end
142
142
 
143
143
  describe "#has_hooks_for?" do
144
144
  it 'returns false when given an unrecognized hook name' do
145
- subject.should_not have_hooks_for(:abcd)
145
+ expect(subject).not_to have_hooks_for(:abcd)
146
146
  end
147
147
 
148
148
  it 'returns false when given the name of a defined hook that has no registered callbacks' do
149
- subject.should_not have_hooks_for(:before_foo)
149
+ expect(subject).not_to have_hooks_for(:before_foo)
150
150
  end
151
151
 
152
152
  it 'returns true when given the name of a defined hook that has registered callbacks' do
153
153
  subject.before_foo { }
154
- subject.should have_hooks_for(:before_foo)
154
+ expect(subject).to have_hooks_for(:before_foo)
155
155
  end
156
156
  end
157
157
  end
@@ -13,7 +13,7 @@ describe VCR::InternetConnection do
13
13
  context 'when pinging example.com succeeds' do
14
14
  it 'returns true' do
15
15
  stub_pingecho_with(true)
16
- described_class.should be_available
16
+ expect(described_class).to be_available
17
17
  end
18
18
 
19
19
  it 'memoizes the value so no extra pings are made' do
@@ -25,7 +25,7 @@ describe VCR::InternetConnection do
25
25
  context 'when pinging example.com fails' do
26
26
  it 'returns false' do
27
27
  stub_pingecho_with(false)
28
- described_class.should_not be_available
28
+ expect(described_class).not_to be_available
29
29
  end
30
30
 
31
31
  it 'memoizes the value so no extra pings are made' do
@@ -7,14 +7,14 @@ describe VCR do
7
7
 
8
8
  describe '.insert_cassette' do
9
9
  it 'creates a new cassette' do
10
- insert_cassette.should be_instance_of(VCR::Cassette)
10
+ expect(insert_cassette).to be_instance_of(VCR::Cassette)
11
11
  end
12
12
 
13
13
  it 'takes over as the #current_cassette' do
14
14
  orig_cassette = VCR.current_cassette
15
15
  new_cassette = insert_cassette
16
- new_cassette.should_not eq(orig_cassette)
17
- VCR.current_cassette.should eq(new_cassette)
16
+ expect(new_cassette).not_to eq(orig_cassette)
17
+ expect(VCR.current_cassette).to eq(new_cassette)
18
18
  end
19
19
 
20
20
  it 'raises an error if the stack of inserted cassettes already contains a cassette with the same name' do
@@ -34,7 +34,7 @@ describe VCR do
34
34
 
35
35
  it 'returns the ejected cassette' do
36
36
  cassette = insert_cassette
37
- VCR.eject_cassette.should eq(cassette)
37
+ expect(VCR.eject_cassette).to eq(cassette)
38
38
  end
39
39
 
40
40
  it 'returns the #current_cassette to the previous one' do
@@ -49,15 +49,15 @@ describe VCR do
49
49
 
50
50
  VCR.eject_cassette
51
51
 
52
- current.should be(cassette)
53
- VCR.current_cassette.should_not be(cassette)
52
+ expect(current).to be(cassette)
53
+ expect(VCR.current_cassette).not_to be(cassette)
54
54
  end
55
55
 
56
56
  it 'properly pops the cassette off the stack even if an error occurs' do
57
57
  cassette = insert_cassette
58
58
  cassette.stub(:eject) { raise "boom" }
59
59
  expect { VCR.eject_cassette }.to raise_error("boom")
60
- VCR.current_cassette.should be_nil
60
+ expect(VCR.current_cassette).to be_nil
61
61
  end
62
62
  end
63
63
 
@@ -71,19 +71,19 @@ describe VCR do
71
71
  it 'yields' do
72
72
  yielded = false
73
73
  VCR.use_cassette(:cassette_test, &lambda { yielded = true })
74
- yielded.should be_true
74
+ expect(yielded).to be_true
75
75
  end
76
76
 
77
77
  it 'yields the cassette instance if the block expects an argument' do
78
78
  VCR.use_cassette('name', :record => :new_episodes, &lambda do |cassette|
79
- cassette.should equal(VCR.current_cassette)
79
+ expect(cassette).to equal(VCR.current_cassette)
80
80
  end)
81
81
  end
82
82
 
83
83
  it 'yields the cassette instance if the block expects a variable number of args' do
84
84
  VCR.use_cassette('name', :record => :new_episodes) do |*args|
85
- args.size.should eq(1)
86
- args.first.should equal(VCR.current_cassette)
85
+ expect(args.size).to eq(1)
86
+ expect(args.first).to equal(VCR.current_cassette)
87
87
  end
88
88
  end
89
89
 
@@ -113,12 +113,12 @@ describe VCR do
113
113
  describe '.http_interactions' do
114
114
  it 'returns the current_cassette.http_interactions when there is a current cassette' do
115
115
  cassette = VCR.insert_cassette("a cassette")
116
- VCR.http_interactions.should be(cassette.http_interactions)
116
+ expect(VCR.http_interactions).to be(cassette.http_interactions)
117
117
  end
118
118
 
119
119
  it 'returns a null list when there is no current cassette' do
120
- VCR.current_cassette.should be_nil
121
- VCR.http_interactions.should be(VCR::Cassette::HTTPInteractionList::NullList)
120
+ expect(VCR.current_cassette).to be_nil
121
+ expect(VCR.http_interactions).to be(VCR::Cassette::HTTPInteractionList::NullList)
122
122
  end
123
123
  end
124
124
 
@@ -126,82 +126,84 @@ describe VCR do
126
126
  context 'when a cassette is inserted' do
127
127
  it 'returns true if the cassette is recording' do
128
128
  VCR.insert_cassette('foo', :record => :all)
129
- VCR.current_cassette.should be_recording
130
- VCR.real_http_connections_allowed?.should be_true
129
+ expect(VCR.current_cassette).to be_recording
130
+ expect(VCR.real_http_connections_allowed?).to be_true
131
131
  end
132
132
 
133
133
  it 'returns false if the cassette is not recording' do
134
134
  VCR.insert_cassette('foo', :record => :none)
135
- VCR.current_cassette.should_not be_recording
136
- VCR.real_http_connections_allowed?.should be_false
135
+ expect(VCR.current_cassette).not_to be_recording
136
+ expect(VCR.real_http_connections_allowed?).to be_false
137
137
  end
138
138
  end
139
139
 
140
140
  context 'when no cassette is inserted' do
141
- before(:each) { VCR.current_cassette.should be_nil }
141
+ before(:each) do
142
+ expect(VCR.current_cassette).to be_nil
143
+ end
142
144
 
143
145
  it 'returns true if the allow_http_connections_when_no_cassette option is set to true' do
144
- VCR.should be_turned_on
146
+ expect(VCR).to be_turned_on
145
147
  VCR.configure { |c| c.allow_http_connections_when_no_cassette = true }
146
- VCR.real_http_connections_allowed?.should be_true
148
+ expect(VCR.real_http_connections_allowed?).to be_true
147
149
  end
148
150
 
149
151
  it 'returns true if VCR is turned off' do
150
152
  VCR.turn_off!
151
153
  VCR.configure { |c| c.allow_http_connections_when_no_cassette = false }
152
- VCR.real_http_connections_allowed?.should be_true
154
+ expect(VCR.real_http_connections_allowed?).to be_true
153
155
  end
154
156
 
155
157
  it 'returns false if the allow_http_connections_when_no_cassette option is set to false and VCR is turned on' do
156
- VCR.should be_turned_on
158
+ expect(VCR).to be_turned_on
157
159
  VCR.configure { |c| c.allow_http_connections_when_no_cassette = false }
158
- VCR.real_http_connections_allowed?.should be_false
160
+ expect(VCR.real_http_connections_allowed?).to be_false
159
161
  end
160
162
  end
161
163
  end
162
164
 
163
165
  describe '.request_matchers' do
164
166
  it 'always returns the same memoized request matcher registry instance' do
165
- VCR.request_matchers.should be_a(VCR::RequestMatcherRegistry)
166
- VCR.request_matchers.should be(VCR.request_matchers)
167
+ expect(VCR.request_matchers).to be_a(VCR::RequestMatcherRegistry)
168
+ expect(VCR.request_matchers).to be(VCR.request_matchers)
167
169
  end
168
170
  end
169
171
 
170
172
  describe '.request_ignorer' do
171
173
  it 'always returns the same memoized request ignorer instance' do
172
- VCR.request_ignorer.should be_a(VCR::RequestIgnorer)
173
- VCR.request_ignorer.should be(VCR.request_ignorer)
174
+ expect(VCR.request_ignorer).to be_a(VCR::RequestIgnorer)
175
+ expect(VCR.request_ignorer).to be(VCR.request_ignorer)
174
176
  end
175
177
  end
176
178
 
177
179
  describe '.library_hooks' do
178
180
  it 'always returns the same memoized LibraryHooks instance' do
179
- VCR.library_hooks.should be_a(VCR::LibraryHooks)
180
- VCR.library_hooks.should be(VCR.library_hooks)
181
+ expect(VCR.library_hooks).to be_a(VCR::LibraryHooks)
182
+ expect(VCR.library_hooks).to be(VCR.library_hooks)
181
183
  end
182
184
  end
183
185
 
184
186
  describe '.cassette_serializers' do
185
187
  it 'always returns the same memoized cassette serializers instance' do
186
- VCR.cassette_serializers.should be_a(VCR::Cassette::Serializers)
187
- VCR.cassette_serializers.should be(VCR.cassette_serializers)
188
+ expect(VCR.cassette_serializers).to be_a(VCR::Cassette::Serializers)
189
+ expect(VCR.cassette_serializers).to be(VCR.cassette_serializers)
188
190
  end
189
191
  end
190
192
 
191
193
  describe ".cassette_persisters" do
192
194
  it "always returns the same memoized Cassette::Persisters instance" do
193
- VCR.cassette_persisters.should be_a(VCR::Cassette::Persisters)
194
- VCR.cassette_persisters.should be(VCR.cassette_persisters)
195
+ expect(VCR.cassette_persisters).to be_a(VCR::Cassette::Persisters)
196
+ expect(VCR.cassette_persisters).to be(VCR.cassette_persisters)
195
197
  end
196
198
  end
197
199
 
198
200
  describe '.configuration' do
199
201
  it 'returns the configuration object' do
200
- VCR.configuration.should be_a(VCR::Configuration)
202
+ expect(VCR.configuration).to be_a(VCR::Configuration)
201
203
  end
202
204
 
203
205
  it 'memoizes the instance' do
204
- VCR.configuration.should be(VCR.configuration)
206
+ expect(VCR.configuration).to be(VCR.configuration)
205
207
  end
206
208
  end
207
209
 
@@ -211,7 +213,7 @@ describe VCR do
211
213
  VCR.configure do |obj|
212
214
  yielded_object = obj
213
215
  end
214
- yielded_object.should eq(VCR.configuration)
216
+ expect(yielded_object).to eq(VCR.configuration)
215
217
  end
216
218
  end
217
219
 
@@ -221,7 +223,7 @@ describe VCR do
221
223
  VCR.cucumber_tags do |obj|
222
224
  yielded_object = obj
223
225
  end
224
- yielded_object.should be_instance_of(VCR::CucumberTags)
226
+ expect(yielded_object).to be_instance_of(VCR::CucumberTags)
225
227
  end
226
228
  end
227
229
 
@@ -259,7 +261,7 @@ describe VCR do
259
261
  describe '.turn_off!' do
260
262
  it 'indicates it is turned off' do
261
263
  VCR.turn_off!
262
- VCR.should_not be_turned_on
264
+ expect(VCR).not_to be_turned_on
263
265
  end
264
266
 
265
267
  it 'raises an error if a cassette is in use' do
@@ -287,7 +289,7 @@ describe VCR do
287
289
 
288
290
  it 'ignores cassette insertions' do
289
291
  VCR.insert_cassette('foo')
290
- VCR.current_cassette.should be_nil
292
+ expect(VCR.current_cassette).to be_nil
291
293
  end
292
294
 
293
295
  it 'still runs a block passed to use_cassette' do
@@ -295,10 +297,10 @@ describe VCR do
295
297
 
296
298
  VCR.use_cassette('foo') do
297
299
  yielded = true
298
- VCR.current_cassette.should be_nil
300
+ expect(VCR.current_cassette).to be_nil
299
301
  end
300
302
 
301
- yielded.should be_true
303
+ expect(yielded).to be_true
302
304
  end
303
305
  end
304
306
  end
@@ -308,22 +310,22 @@ describe VCR do
308
310
 
309
311
  it 'indicates it is turned on' do
310
312
  VCR.turn_on!
311
- VCR.should be_turned_on
313
+ expect(VCR).to be_turned_on
312
314
  end
313
315
  end
314
316
 
315
317
  describe '.turned_off' do
316
318
  it 'yields with VCR turned off' do
317
- VCR.should be_turned_on
319
+ expect(VCR).to be_turned_on
318
320
  yielded = false
319
321
 
320
322
  VCR.turned_off do
321
323
  yielded = true
322
- VCR.should_not be_turned_on
324
+ expect(VCR).not_to be_turned_on
323
325
  end
324
326
 
325
- yielded.should eq(true)
326
- VCR.should be_turned_on
327
+ expect(yielded).to eq(true)
328
+ expect(VCR).to be_turned_on
327
329
  end
328
330
 
329
331
  it 'passes options through to .turn_off!' do
@@ -335,7 +337,7 @@ describe VCR do
335
337
  describe '.turned_on?' do
336
338
  it 'is on by default' do
337
339
  VCR.send(:initialize_ivars) # clear internal state
338
- VCR.should be_turned_on
340
+ expect(VCR).to be_turned_on
339
341
  end
340
342
  end
341
343
  end