vcr 1.11.1 → 1.11.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/.travis.yml +3 -0
  2. data/CHANGELOG.md +11 -4
  3. data/Gemfile +5 -4
  4. data/Rakefile +23 -4
  5. data/cucumber.yml +2 -2
  6. data/features/cassettes/automatic_re_recording.feature +2 -2
  7. data/features/cassettes/dynamic_erb.feature +2 -2
  8. data/features/cassettes/format.feature +1 -1
  9. data/features/cassettes/naming.feature +1 -1
  10. data/features/cassettes/no_cassette.feature +4 -4
  11. data/features/cassettes/request_matching.feature +5 -5
  12. data/features/cassettes/update_content_length_header.feature +3 -3
  13. data/features/configuration/allow_http_connections_when_no_cassette.feature +3 -3
  14. data/features/configuration/cassette_library_dir.feature +1 -1
  15. data/features/configuration/default_cassette_options.feature +5 -5
  16. data/features/configuration/filter_sensitive_data.feature +6 -6
  17. data/features/configuration/hooks.feature +6 -6
  18. data/features/configuration/ignore_hosts.feature +1 -1
  19. data/features/configuration/ignore_localhost.feature +2 -2
  20. data/features/configuration/stub_with.feature +4 -4
  21. data/features/http_libraries/em_http_request.feature +4 -4
  22. data/features/http_libraries/net_http.feature +10 -10
  23. data/features/middleware/faraday.feature +2 -2
  24. data/features/middleware/rack.feature +2 -2
  25. data/features/record_modes/all.feature +2 -2
  26. data/features/record_modes/new_episodes.feature +2 -2
  27. data/features/record_modes/none.feature +2 -2
  28. data/features/record_modes/once.feature +3 -3
  29. data/features/step_definitions/cli_steps.rb +6 -2
  30. data/features/support/env.rb +5 -8
  31. data/features/support/http_lib_filters.rb +6 -1
  32. data/features/test_frameworks/cucumber.feature +2 -2
  33. data/features/test_frameworks/rspec.feature +2 -2
  34. data/features/test_frameworks/shoulda.feature +13 -10
  35. data/features/test_frameworks/test_unit.feature +12 -9
  36. data/lib/vcr.rb +6 -0
  37. data/lib/vcr/config.rb +7 -1
  38. data/lib/vcr/deprecations/cassette.rb +16 -16
  39. data/lib/vcr/extensions/net_http_response.rb +4 -0
  40. data/lib/vcr/http_stubbing_adapters/common.rb +1 -1
  41. data/lib/vcr/http_stubbing_adapters/fakeweb.rb +6 -0
  42. data/lib/vcr/http_stubbing_adapters/webmock.rb +7 -0
  43. data/lib/vcr/middleware/cassette_arguments.rb +1 -0
  44. data/lib/vcr/structs/http_interaction.rb +1 -0
  45. data/lib/vcr/version.rb +1 -1
  46. data/spec/capture_warnings.rb +42 -0
  47. data/spec/monkey_patches.rb +5 -1
  48. data/spec/spec_helper.rb +2 -1
  49. data/spec/support/shared_example_groups/http_library.rb +19 -19
  50. data/spec/support/shared_example_groups/http_stubbing_adapter.rb +6 -6
  51. data/spec/support/shared_example_groups/ignore_localhost_deprecation.rb +1 -1
  52. data/spec/support/shared_example_groups/normalizers.rb +13 -15
  53. data/spec/support/sinatra_app.rb +2 -0
  54. data/spec/support/vcr_localhost_server.rb +4 -3
  55. data/spec/vcr/cassette/reader_spec.rb +4 -4
  56. data/spec/vcr/cassette_spec.rb +28 -28
  57. data/spec/vcr/config_spec.rb +11 -11
  58. data/spec/vcr/deprecations/cassette_spec.rb +4 -4
  59. data/spec/vcr/deprecations/config_spec.rb +2 -2
  60. data/spec/vcr/deprecations/http_stubbing_adapters/fakeweb_spec.rb +1 -1
  61. data/spec/vcr/extensions/net_http_response_spec.rb +3 -3
  62. data/spec/vcr/extensions/net_http_spec.rb +4 -4
  63. data/spec/vcr/http_stubbing_adapters/excon_spec.rb +5 -5
  64. data/spec/vcr/http_stubbing_adapters/faraday_spec.rb +4 -4
  65. data/spec/vcr/http_stubbing_adapters/multi_object_proxy_spec.rb +4 -4
  66. data/spec/vcr/middleware/cassette_arguments_spec.rb +5 -5
  67. data/spec/vcr/middleware/faraday_spec.rb +3 -3
  68. data/spec/vcr/middleware/rack_spec.rb +4 -4
  69. data/spec/vcr/request_matcher_spec.rb +13 -13
  70. data/spec/vcr/structs/http_interaction_spec.rb +6 -6
  71. data/spec/vcr/structs/request_spec.rb +7 -7
  72. data/spec/vcr/structs/response_spec.rb +5 -5
  73. data/spec/vcr/structs/response_status_spec.rb +2 -2
  74. data/spec/vcr/test_frameworks/cucumber_spec.rb +2 -2
  75. data/spec/vcr/test_frameworks/rspec_spec.rb +6 -7
  76. data/spec/vcr/util/hooks_spec.rb +9 -9
  77. data/spec/vcr_spec.rb +11 -17
  78. data/vcr.gemspec +11 -5
  79. metadata +47 -49
  80. data/features/support/aruba_workaround/aruba_patches.rb +0 -36
  81. data/features/support/aruba_workaround/background_process.rb +0 -4
@@ -32,7 +32,7 @@ describe VCR::Hooks do
32
32
 
33
33
  invocations.should be_empty
34
34
  subject.invoke_hook(:before_foo, :green)
35
- invocations.should == [:callback_1, :callback_2]
35
+ invocations.should eq([:callback_1, :callback_2])
36
36
  end
37
37
 
38
38
  it 'invokes each of the :before_foo callbacks with no tag' do
@@ -40,7 +40,7 @@ describe VCR::Hooks do
40
40
  subject.before_foo { invocations << :no_tag_2 }
41
41
 
42
42
  subject.invoke_hook(:before_foo, :green)
43
- invocations.should == [:no_tag_1, :no_tag_2]
43
+ invocations.should eq([:no_tag_1, :no_tag_2])
44
44
  end
45
45
 
46
46
  it 'does not invoke any callbacks with a different tag' do
@@ -57,7 +57,7 @@ describe VCR::Hooks do
57
57
 
58
58
  invocations.should be_empty
59
59
  subject.invoke_hook(:before_foo, nil)
60
- invocations.should == [:callback_1, :callback_2]
60
+ invocations.should eq([:callback_1, :callback_2])
61
61
  end
62
62
 
63
63
  it 'does not invoke :before_bar callbacks' do
@@ -73,21 +73,21 @@ describe VCR::Hooks do
73
73
  end
74
74
 
75
75
  it 'passes along the provided arguments to the callback' do
76
- subject.before_foo &lambda { |a, b| invocations << [a, b] }
76
+ subject.before_foo(&lambda { |a, b| invocations << [a, b] })
77
77
  subject.invoke_hook(:before_foo, nil, :arg1, :arg2)
78
- invocations.flatten.should == [:arg1, :arg2]
78
+ invocations.flatten.should eq([:arg1, :arg2])
79
79
  end
80
80
 
81
81
  it 'only passes along 1 argument when the block accepts only 1 arguments' do
82
- subject.before_foo &lambda { |a| invocations << a }
82
+ subject.before_foo(&lambda { |a| invocations << a })
83
83
  subject.invoke_hook(:before_foo, nil, :arg1, :arg2)
84
- invocations.flatten.should == [:arg1]
84
+ invocations.flatten.should eq([:arg1])
85
85
  end
86
86
 
87
87
  it 'passes along all arguments when the block accepts a variable number of args' do
88
- subject.before_foo &lambda { |*a| invocations << a }
88
+ subject.before_foo(&lambda { |*a| invocations << a })
89
89
  subject.invoke_hook(:before_foo, nil, :arg1, :arg2)
90
- invocations.flatten.should == [:arg1, :arg2]
90
+ invocations.flatten.should eq([:arg1, :arg2])
91
91
  end
92
92
  end
93
93
  end
data/spec/vcr_spec.rb CHANGED
@@ -13,8 +13,8 @@ describe VCR do
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 == orig_cassette
17
- VCR.current_cassette.should == new_cassette
16
+ new_cassette.should_not eq(orig_cassette)
17
+ VCR.current_cassette.should 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 == cassette
37
+ VCR.eject_cassette.should eq(cassette)
38
38
  end
39
39
 
40
40
  it 'returns the #current_cassette to the previous one' do
@@ -64,7 +64,7 @@ describe VCR do
64
64
 
65
65
  it 'yields the cassette instance if the block expects a variable number of args' do
66
66
  VCR.use_cassette('name', :record => :new_episodes) do |*args|
67
- args.size.should == 1
67
+ args.size.should eq(1)
68
68
  args.first.should equal(VCR.current_cassette)
69
69
  end
70
70
  end
@@ -92,7 +92,7 @@ describe VCR do
92
92
  VCR.config do |obj|
93
93
  yielded_object = obj
94
94
  end
95
- yielded_object.should == VCR::Config
95
+ yielded_object.should eq(VCR::Config)
96
96
  end
97
97
 
98
98
  it "sets http_stubbing_adapter.http_connections_allowed to the configured default" do
@@ -116,7 +116,7 @@ describe VCR do
116
116
  c.ignore_hosts 'example.com', 'example.org'
117
117
  end
118
118
 
119
- VCR::HttpStubbingAdapters::FakeWeb.send(:ignored_hosts).should == %w[example.com example.org]
119
+ VCR::HttpStubbingAdapters::FakeWeb.send(:ignored_hosts).should eq(%w[example.com example.org])
120
120
  end
121
121
  end
122
122
 
@@ -138,10 +138,10 @@ describe VCR do
138
138
 
139
139
  it 'returns a multi object proxy for the configured stubbing libraries when multiple libs are configured', :unless => RUBY_PLATFORM == 'java' do
140
140
  VCR::Config.stub_with :fakeweb, :typhoeus
141
- VCR.http_stubbing_adapter.proxied_objects.should == [
141
+ VCR.http_stubbing_adapter.proxied_objects.should eq([
142
142
  VCR::HttpStubbingAdapters::FakeWeb,
143
143
  VCR::HttpStubbingAdapters::Typhoeus
144
- ]
144
+ ])
145
145
  end
146
146
 
147
147
  {
@@ -152,7 +152,7 @@ describe VCR do
152
152
  }.each do |symbol, klass|
153
153
  it "returns #{klass} for :#{symbol}" do
154
154
  VCR::Config.stub_with symbol
155
- VCR.http_stubbing_adapter.should == klass
155
+ VCR.http_stubbing_adapter.should eq(klass)
156
156
  end
157
157
  end
158
158
 
@@ -296,7 +296,7 @@ describe VCR do
296
296
  VCR.should_not be_turned_on
297
297
  end
298
298
 
299
- yielded.should == true
299
+ yielded.should eq(true)
300
300
  VCR.should be_turned_on
301
301
  end
302
302
 
@@ -308,13 +308,7 @@ describe VCR do
308
308
 
309
309
  describe '.turned_on?' do
310
310
  it 'is on by default' do
311
- # clear internal state
312
- VCR.instance_eval do
313
- instance_variables.each do |var|
314
- remove_instance_variable(var)
315
- end
316
- end
317
-
311
+ VCR.send(:initialize_ivars) # clear internal state
318
312
  VCR.should be_turned_on
319
313
  end
320
314
  end
data/vcr.gemspec CHANGED
@@ -19,11 +19,9 @@ Gem::Specification.new do |s|
19
19
 
20
20
  {
21
21
  'bundler' => '~> 1.0.7',
22
- 'rake' => '~> 0.8.7',
22
+ 'rake' => '~> 0.9.2',
23
23
 
24
24
  'rspec' => '~> 2.6',
25
- 'cucumber' => '~> 0.9.4',
26
- 'aruba' => '0.2.4',
27
25
  'shoulda' => '~> 2.9.2',
28
26
 
29
27
  'fakeweb' => '~> 1.3.0',
@@ -41,10 +39,18 @@ Gem::Specification.new do |s|
41
39
  s.add_development_dependency lib, version
42
40
  end
43
41
 
42
+ # Cucumber 1.0.2 seems to have issues installing on 1.8.6 :(.
44
43
  {
45
- 'patron' => '0.4.9',
44
+ 'cucumber' => '~> 1.0.2',
45
+ 'aruba' => '~> 0.4.6',
46
+ }.each do |lib, version|
47
+ s.add_development_dependency lib, version
48
+ end unless RUBY_VERSION == '1.8.6'
49
+
50
+ {
51
+ 'patron' => '~> 0.4.15',
46
52
  'em-http-request' => '~> 0.3.0',
47
- 'curb' => '0.7.8',
53
+ 'curb' => '~> 0.7.15',
48
54
  'typhoeus' => '~> 0.2.1'
49
55
  }.each do |lib, version|
50
56
  s.add_development_dependency lib, version
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vcr
3
3
  version: !ruby/object:Gem::Version
4
- hash: 57
4
+ hash: 63
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 11
9
- - 1
10
- version: 1.11.1
9
+ - 2
10
+ version: 1.11.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Myron Marston
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-19 00:00:00 Z
18
+ date: 2011-08-29 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  version_requirements: &id001 !ruby/object:Gem::Requirement
@@ -72,12 +72,12 @@ dependencies:
72
72
  requirements:
73
73
  - - ~>
74
74
  - !ruby/object:Gem::Version
75
- hash: 49
75
+ hash: 63
76
76
  segments:
77
77
  - 0
78
- - 8
79
- - 7
80
- version: 0.8.7
78
+ - 9
79
+ - 2
80
+ version: 0.9.2
81
81
  name: rake
82
82
  type: :development
83
83
  prerelease: false
@@ -163,22 +163,6 @@ dependencies:
163
163
  requirement: *id009
164
164
  - !ruby/object:Gem::Dependency
165
165
  version_requirements: &id010 !ruby/object:Gem::Requirement
166
- none: false
167
- requirements:
168
- - - "="
169
- - !ruby/object:Gem::Version
170
- hash: 31
171
- segments:
172
- - 0
173
- - 2
174
- - 4
175
- version: 0.2.4
176
- name: aruba
177
- type: :development
178
- prerelease: false
179
- requirement: *id010
180
- - !ruby/object:Gem::Dependency
181
- version_requirements: &id011 !ruby/object:Gem::Requirement
182
166
  none: false
183
167
  requirements:
184
168
  - - ~>
@@ -192,9 +176,9 @@ dependencies:
192
176
  name: sinatra
193
177
  type: :development
194
178
  prerelease: false
195
- requirement: *id011
179
+ requirement: *id010
196
180
  - !ruby/object:Gem::Dependency
197
- version_requirements: &id012 !ruby/object:Gem::Requirement
181
+ version_requirements: &id011 !ruby/object:Gem::Requirement
198
182
  none: false
199
183
  requirements:
200
184
  - - ~>
@@ -208,9 +192,9 @@ dependencies:
208
192
  name: bundler
209
193
  type: :development
210
194
  prerelease: false
211
- requirement: *id012
195
+ requirement: *id011
212
196
  - !ruby/object:Gem::Dependency
213
- version_requirements: &id013 !ruby/object:Gem::Requirement
197
+ version_requirements: &id012 !ruby/object:Gem::Requirement
214
198
  none: false
215
199
  requirements:
216
200
  - - ~>
@@ -224,6 +208,22 @@ dependencies:
224
208
  name: excon
225
209
  type: :development
226
210
  prerelease: false
211
+ requirement: *id012
212
+ - !ruby/object:Gem::Dependency
213
+ version_requirements: &id013 !ruby/object:Gem::Requirement
214
+ none: false
215
+ requirements:
216
+ - - ~>
217
+ - !ruby/object:Gem::Version
218
+ hash: 3
219
+ segments:
220
+ - 1
221
+ - 7
222
+ - 4
223
+ version: 1.7.4
224
+ name: webmock
225
+ type: :development
226
+ prerelease: false
227
227
  requirement: *id013
228
228
  - !ruby/object:Gem::Dependency
229
229
  version_requirements: &id014 !ruby/object:Gem::Requirement
@@ -231,13 +231,13 @@ dependencies:
231
231
  requirements:
232
232
  - - ~>
233
233
  - !ruby/object:Gem::Version
234
- hash: 51
234
+ hash: 3
235
235
  segments:
236
236
  - 0
237
- - 9
238
237
  - 4
239
- version: 0.9.4
240
- name: cucumber
238
+ - 6
239
+ version: 0.4.6
240
+ name: aruba
241
241
  type: :development
242
242
  prerelease: false
243
243
  requirement: *id014
@@ -247,13 +247,13 @@ dependencies:
247
247
  requirements:
248
248
  - - ~>
249
249
  - !ruby/object:Gem::Version
250
- hash: 3
250
+ hash: 19
251
251
  segments:
252
252
  - 1
253
- - 7
254
- - 4
255
- version: 1.7.4
256
- name: webmock
253
+ - 0
254
+ - 2
255
+ version: 1.0.2
256
+ name: cucumber
257
257
  type: :development
258
258
  prerelease: false
259
259
  requirement: *id015
@@ -261,14 +261,14 @@ dependencies:
261
261
  version_requirements: &id016 !ruby/object:Gem::Requirement
262
262
  none: false
263
263
  requirements:
264
- - - "="
264
+ - - ~>
265
265
  - !ruby/object:Gem::Version
266
- hash: 19
266
+ hash: 29
267
267
  segments:
268
268
  - 0
269
269
  - 7
270
- - 8
271
- version: 0.7.8
270
+ - 15
271
+ version: 0.7.15
272
272
  name: curb
273
273
  type: :development
274
274
  prerelease: false
@@ -277,14 +277,14 @@ dependencies:
277
277
  version_requirements: &id017 !ruby/object:Gem::Requirement
278
278
  none: false
279
279
  requirements:
280
- - - "="
280
+ - - ~>
281
281
  - !ruby/object:Gem::Version
282
- hash: 29
282
+ hash: 17
283
283
  segments:
284
284
  - 0
285
285
  - 4
286
- - 9
287
- version: 0.4.9
286
+ - 15
287
+ version: 0.4.15
288
288
  name: patron
289
289
  type: :development
290
290
  prerelease: false
@@ -371,8 +371,6 @@ files:
371
371
  - features/record_modes/none.feature
372
372
  - features/record_modes/once.feature
373
373
  - features/step_definitions/cli_steps.rb
374
- - features/support/aruba_workaround/aruba_patches.rb
375
- - features/support/aruba_workaround/background_process.rb
376
374
  - features/support/env.rb
377
375
  - features/support/http_lib_filters.rb
378
376
  - features/support/vcr_cucumber_helpers.rb
@@ -424,6 +422,7 @@ files:
424
422
  - script/FullBuildRakeFile
425
423
  - script/full_build
426
424
  - script/spec
425
+ - spec/capture_warnings.rb
427
426
  - spec/fixtures/1.9.1/0_3_1_cassette.yml
428
427
  - spec/fixtures/1.9.1/cassette_spec/empty.yml
429
428
  - spec/fixtures/1.9.1/cassette_spec/example.yml
@@ -548,8 +547,6 @@ test_files:
548
547
  - features/record_modes/none.feature
549
548
  - features/record_modes/once.feature
550
549
  - features/step_definitions/cli_steps.rb
551
- - features/support/aruba_workaround/aruba_patches.rb
552
- - features/support/aruba_workaround/background_process.rb
553
550
  - features/support/env.rb
554
551
  - features/support/http_lib_filters.rb
555
552
  - features/support/vcr_cucumber_helpers.rb
@@ -557,6 +554,7 @@ test_files:
557
554
  - features/test_frameworks/rspec.feature
558
555
  - features/test_frameworks/shoulda.feature
559
556
  - features/test_frameworks/test_unit.feature
557
+ - spec/capture_warnings.rb
560
558
  - spec/fixtures/1.9.1/0_3_1_cassette.yml
561
559
  - spec/fixtures/1.9.1/cassette_spec/empty.yml
562
560
  - spec/fixtures/1.9.1/cassette_spec/example.yml
@@ -1,36 +0,0 @@
1
- # Aruba::Api#run in aruba 0.2.4 does not work w/ JRuby or Rubinius.
2
- # This is the version from 0.2.2 before aruba relied upon
3
- # BackgroundProcess (which is not jruby/rbx compatible).
4
- require 'tempfile'
5
-
6
- Aruba::Api.module_eval do
7
- def run(cmd, fail_on_error=true)
8
- cmd = detect_ruby(cmd)
9
-
10
- stderr_file = Tempfile.new('cucumber')
11
- stderr_file.close
12
- in_current_dir do
13
- announce_or_puts("$ cd #{Dir.pwd}") if @announce_dir
14
- announce_or_puts("$ #{cmd}") if @announce_cmd
15
-
16
- mode = RUBY_VERSION =~ /^1\.9/ ? {:external_encoding=>"UTF-8"} : 'r'
17
-
18
- IO.popen("#{cmd} 2> #{stderr_file.path}", mode) do |io|
19
- @last_stdout = io.read
20
- announce_or_puts(@last_stdout) if @announce_stdout
21
- end
22
-
23
- @last_exit_status = $?.exitstatus
24
- end
25
- @last_stderr = IO.read(stderr_file.path)
26
-
27
- announce_or_puts(@last_stderr) if @announce_stderr
28
-
29
- if(@last_exit_status != 0 && fail_on_error)
30
- fail("Exit status was #{@last_exit_status}. Output:\n#{combined_output}")
31
- end
32
-
33
- @last_stderr
34
- end
35
- end
36
-
@@ -1,4 +0,0 @@
1
- # Don't do anything--this is just here to allow aruba to run on JRuby/rbx.
2
- # It requires background_process, but that doesn't work on JRuby/rbx.
3
- # So on JRuby/rbx, we add this file's dir to the load path, in order to fake out aruba
4
- # and force it to load this file instaed.