vcr 2.7.0 → 2.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +8 -8
  2. data/.rspec +1 -1
  3. data/.travis.yml +4 -0
  4. data/CHANGELOG.md +29 -0
  5. data/CONTRIBUTING.md +0 -13
  6. data/Gemfile +1 -3
  7. data/Gemfile.lock +13 -22
  8. data/README.md +7 -1
  9. data/Rakefile +10 -6
  10. data/cucumber.yml +2 -2
  11. data/features/request_matching/body_as_json.feature +90 -0
  12. data/features/support/env.rb +1 -1
  13. data/gemfiles/typhoeus_old.gemfile +2 -3
  14. data/gemfiles/typhoeus_old.gemfile.lock +32 -38
  15. data/lib/vcr.rb +1 -1
  16. data/lib/vcr/errors.rb +22 -2
  17. data/lib/vcr/library_hooks/excon.rb +16 -1
  18. data/lib/vcr/library_hooks/webmock.rb +1 -1
  19. data/lib/vcr/middleware/excon.rb +55 -58
  20. data/lib/vcr/middleware/excon/legacy_methods.rb +1 -1
  21. data/lib/vcr/request_matcher_registry.rb +18 -0
  22. data/lib/vcr/test_frameworks/rspec.rb +2 -2
  23. data/lib/vcr/version.rb +1 -1
  24. data/script/ci.sh +1 -2
  25. data/spec/monkey_patches.rb +3 -2
  26. data/spec/spec_helper.rb +1 -2
  27. data/spec/support/shared_example_groups/excon.rb +28 -9
  28. data/spec/support/shared_example_groups/request_hooks.rb +1 -1
  29. data/spec/vcr/cassette/persisters/file_system_spec.rb +2 -2
  30. data/spec/vcr/cassette_spec.rb +7 -7
  31. data/spec/vcr/configuration_spec.rb +13 -13
  32. data/spec/vcr/errors_spec.rb +23 -0
  33. data/spec/vcr/library_hooks/excon_spec.rb +15 -0
  34. data/spec/vcr/library_hooks/fakeweb_spec.rb +1 -1
  35. data/spec/vcr/library_hooks_spec.rb +8 -8
  36. data/spec/vcr/middleware/faraday_spec.rb +1 -1
  37. data/spec/vcr/middleware/rack_spec.rb +1 -1
  38. data/spec/vcr/request_ignorer_spec.rb +2 -2
  39. data/spec/vcr/request_matcher_registry_spec.rb +59 -33
  40. data/spec/vcr/structs_spec.rb +2 -2
  41. data/spec/vcr/test_frameworks/cucumber_spec.rb +1 -1
  42. data/spec/vcr/test_frameworks/rspec_spec.rb +1 -1
  43. data/spec/vcr/util/hooks_spec.rb +5 -5
  44. data/spec/vcr/version_spec.rb +20 -4
  45. data/spec/vcr_spec.rb +7 -7
  46. metadata +4 -3
  47. data/.limited_red +0 -1
@@ -458,11 +458,11 @@ module VCR
458
458
  valid_types.each do |type|
459
459
  describe "##{type}?" do
460
460
  it "returns true if the type is set to :#{type}" do
461
- expect(Request::Typed.new(double, type).send("#{type}?")).to be_true
461
+ expect(Request::Typed.new(double, type).send("#{type}?")).to be true
462
462
  end
463
463
 
464
464
  it "returns false if the type is set to :other" do
465
- expect(Request::Typed.new(double, :other).send("#{type}?")).to be_false
465
+ expect(Request::Typed.new(double, :other).send("#{type}?")).to be false
466
466
  end
467
467
  end
468
468
  end
@@ -82,7 +82,7 @@ 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
- expect(original_options).to have(2).items
85
+ expect(original_options.size).to eq(2)
86
86
  expect(original_options[:use_scenario_name]).to eq(true)
87
87
  expect(original_options[:record]).to eq(:none)
88
88
  end
@@ -44,7 +44,7 @@ describe VCR::RSpec::Macros do
44
44
  describe '#use_vcr_cassette' do
45
45
  def self.perform_test(context_name, expected_cassette_name, *args, &block)
46
46
  context context_name do
47
- after(:each) do
47
+ after(:each) do |example|
48
48
  if example.metadata[:test_ejection]
49
49
  expect(VCR.current_cassette).to be_nil
50
50
  end
@@ -6,7 +6,7 @@ describe VCR::Hooks::FilteredHook do
6
6
  called = false
7
7
  subject.hook = lambda { called = true }
8
8
  subject.conditionally_invoke
9
- expect(called).to be_true
9
+ expect(called).to be true
10
10
  end
11
11
 
12
12
  it 'forwards the given arguments to the hook' 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
- expect(called).to 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,7 +36,7 @@ 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
- expect(called).to be_false
39
+ expect(called).to be false
40
40
  end
41
41
 
42
42
  it 'forwards arguments to the filters' do
@@ -70,7 +70,7 @@ describe VCR::Hooks::FilteredHook do
70
70
  subject.hook = lambda { }
71
71
  subject.filters = [double(:to_proc => lambda { filter_called = true })]
72
72
  subject.conditionally_invoke
73
- expect(filter_called).to 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
- expect(override_called).to be_true
102
+ expect(override_called).to be true
103
103
  end
104
104
 
105
105
  describe '#clear_hooks' do
@@ -4,8 +4,24 @@ describe "VCR.version" do
4
4
  subject { VCR.version }
5
5
 
6
6
  it { should =~ /\A\d+\.\d+\.\d+(\.\w+)?\z/ }
7
- its(:parts) { should be_instance_of(Array) }
8
- its(:major) { should be_instance_of(Fixnum) }
9
- its(:minor) { should be_instance_of(Fixnum) }
10
- its(:patch) { should be_instance_of(Fixnum) }
7
+
8
+ describe '#parts' do
9
+ subject { super().parts }
10
+ it { should be_instance_of(Array) }
11
+ end
12
+
13
+ describe '#major' do
14
+ subject { super().major }
15
+ it { should be_instance_of(Fixnum) }
16
+ end
17
+
18
+ describe '#minor' do
19
+ subject { super().minor }
20
+ it { should be_instance_of(Fixnum) }
21
+ end
22
+
23
+ describe '#patch' do
24
+ subject { super().patch }
25
+ it { should be_instance_of(Fixnum) }
26
+ end
11
27
  end
@@ -77,7 +77,7 @@ describe VCR do
77
77
  it 'yields' do
78
78
  yielded = false
79
79
  VCR.use_cassette(:cassette_test, &lambda { yielded = true })
80
- expect(yielded).to be_true
80
+ expect(yielded).to be true
81
81
  end
82
82
 
83
83
  it 'yields the cassette instance if the block expects an argument' do
@@ -133,13 +133,13 @@ describe VCR do
133
133
  it 'returns true if the cassette is recording' do
134
134
  VCR.insert_cassette('foo', :record => :all)
135
135
  expect(VCR.current_cassette).to be_recording
136
- expect(VCR.real_http_connections_allowed?).to be_true
136
+ expect(VCR.real_http_connections_allowed?).to be true
137
137
  end
138
138
 
139
139
  it 'returns false if the cassette is not recording' do
140
140
  VCR.insert_cassette('foo', :record => :none)
141
141
  expect(VCR.current_cassette).not_to be_recording
142
- expect(VCR.real_http_connections_allowed?).to be_false
142
+ expect(VCR.real_http_connections_allowed?).to be false
143
143
  end
144
144
  end
145
145
 
@@ -151,19 +151,19 @@ describe VCR do
151
151
  it 'returns true if the allow_http_connections_when_no_cassette option is set to true' do
152
152
  expect(VCR).to be_turned_on
153
153
  VCR.configure { |c| c.allow_http_connections_when_no_cassette = true }
154
- expect(VCR.real_http_connections_allowed?).to be_true
154
+ expect(VCR.real_http_connections_allowed?).to be true
155
155
  end
156
156
 
157
157
  it 'returns true if VCR is turned off' do
158
158
  VCR.turn_off!
159
159
  VCR.configure { |c| c.allow_http_connections_when_no_cassette = false }
160
- expect(VCR.real_http_connections_allowed?).to be_true
160
+ expect(VCR.real_http_connections_allowed?).to be true
161
161
  end
162
162
 
163
163
  it 'returns false if the allow_http_connections_when_no_cassette option is set to false and VCR is turned on' do
164
164
  expect(VCR).to be_turned_on
165
165
  VCR.configure { |c| c.allow_http_connections_when_no_cassette = false }
166
- expect(VCR.real_http_connections_allowed?).to be_false
166
+ expect(VCR.real_http_connections_allowed?).to be false
167
167
  end
168
168
  end
169
169
  end
@@ -306,7 +306,7 @@ describe VCR do
306
306
  expect(VCR.current_cassette).to be_nil
307
307
  end
308
308
 
309
- expect(yielded).to be_true
309
+ expect(yielded).to be true
310
310
  end
311
311
  end
312
312
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vcr
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.0
4
+ version: 2.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Myron Marston
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-31 00:00:00.000000000 Z
11
+ date: 2013-11-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: VCR provides a simple API to record and replay your test suite's HTTP
14
14
  interactions. It works with a variety of HTTP client libraries, HTTP stubbing libraries
@@ -21,7 +21,6 @@ files:
21
21
  - .gemtest
22
22
  - .gitignore
23
23
  - .gitmodules
24
- - .limited_red
25
24
  - .rspec
26
25
  - .travis.yml
27
26
  - .yardopts
@@ -76,6 +75,7 @@ files:
76
75
  - features/record_modes/once.feature
77
76
  - features/request_matching/README.md
78
77
  - features/request_matching/body.feature
78
+ - features/request_matching/body_as_json.feature
79
79
  - features/request_matching/custom_matcher.feature
80
80
  - features/request_matching/headers.feature
81
81
  - features/request_matching/host.feature
@@ -254,6 +254,7 @@ test_files:
254
254
  - features/record_modes/once.feature
255
255
  - features/request_matching/README.md
256
256
  - features/request_matching/body.feature
257
+ - features/request_matching/body_as_json.feature
257
258
  - features/request_matching/custom_matcher.feature
258
259
  - features/request_matching/headers.feature
259
260
  - features/request_matching/host.feature
@@ -1 +0,0 @@
1
- project name: vcr