vcr 2.2.1 → 2.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,17 @@
1
1
  ## In git
2
2
 
3
- [Full Changelog](http://github.com/myronmarston/vcr/compare/v2.2.0...master)
3
+ [Full Changelog](http://github.com/myronmarston/vcr/compare/v2.2.2...master)
4
+
5
+ ## 2.2.2 (June 15, 2012)
6
+
7
+ [Full Changelog](http://github.com/myronmarston/vcr/compare/v2.2.1...v2.2.2)
8
+
9
+ Bug Fixes:
10
+
11
+ * Fix `VCR.eject_cassette` so that it always pops a cassette off the
12
+ cassette stack even if an error occurs while ejecting the cassette.
13
+ This is important to keep things consistent, so that a cassette for
14
+ one test doesn't remain in place for another test.
4
15
 
5
16
  ## 2.2.1 (June 13, 2012)
6
17
 
data/lib/vcr.rb CHANGED
@@ -134,6 +134,8 @@ module VCR
134
134
  def eject_cassette
135
135
  cassette = cassettes.last
136
136
  cassette.eject if cassette
137
+ cassette
138
+ ensure
137
139
  cassettes.pop
138
140
  end
139
141
 
@@ -229,7 +231,7 @@ module VCR
229
231
  #
230
232
  # @param options [Hash] hash of options
231
233
  # @option options :ignore_cassettes [Boolean] controls what happens when a cassette is
232
- # inserted while VCR is turned off. If +true+ is passed, the cassette insertion
234
+ # inserted while VCR is turned off. If `true` is passed, the cassette insertion
233
235
  # will be ignored; otherwise a {VCR::Errors::TurnedOffError} will be raised.
234
236
  #
235
237
  # @return [void]
@@ -237,7 +239,8 @@ module VCR
237
239
  # @raise [ArgumentError] if you pass an invalid option
238
240
  def turn_off!(options = {})
239
241
  if VCR.current_cassette
240
- raise CassetteInUseError.new("A VCR cassette is currently in use. You must eject it before you can turn VCR off.")
242
+ raise CassetteInUseError, "A VCR cassette is currently in use (#{VCR.current_cassette.name}). " +
243
+ "You must eject it before you can turn VCR off."
241
244
  end
242
245
 
243
246
  @ignore_cassettes = options[:ignore_cassettes]
@@ -31,7 +31,7 @@ module VCR
31
31
  # Error raised when a VCR 1.x cassette is used with VCR 2.
32
32
  class InvalidCassetteFormatError < Error; end
33
33
 
34
- # Error raised when an +around_http_request+ hook is used improperly.
34
+ # Error raised when an `around_http_request` hook is used improperly.
35
35
  # @see VCR::Configuration#around_http_request
36
36
  class AroundHTTPRequestHookError < Error; end
37
37
 
@@ -20,11 +20,13 @@ module VCR
20
20
  @main_object = main_object
21
21
  end
22
22
 
23
- # Adds +Before+ and +After+ cucumber hooks for the named tags that
23
+ # Adds `Before` and `After` cucumber hooks for the named tags that
24
24
  # will cause a VCR cassette to be used for scenarios with matching tags.
25
25
  #
26
26
  # @param [Array<String>] tag_names the cucumber scenario tags
27
- # @param [(optional) Hash] options the cassette options. Specify :use_scenario_name => true to automatically name the cassette according to the scenario name.
27
+ # @param [(optional) Hash] options the cassette options. Specify
28
+ # `:use_scenario_name => true` to automatically name the
29
+ # cassette according to the scenario name.
28
30
  def tags(*tag_names)
29
31
  original_options = tag_names.last.is_a?(::Hash) ? tag_names.pop : {}
30
32
  tag_names.each do |tag_name|
@@ -10,7 +10,7 @@ module VCR
10
10
  # * `parts` [Array<Integer>] List of the version parts.
11
11
  def version
12
12
  @version ||= begin
13
- string = '2.2.1'
13
+ string = '2.2.2'
14
14
 
15
15
  def string.parts
16
16
  split('.').map { |p| p.to_i }
@@ -52,6 +52,13 @@ describe VCR do
52
52
  current.should be(cassette)
53
53
  VCR.current_cassette.should_not be(cassette)
54
54
  end
55
+
56
+ it 'properly pops the cassette off the stack even if an error occurs' do
57
+ cassette = insert_cassette
58
+ cassette.stub(:eject) { raise "boom" }
59
+ expect { VCR.eject_cassette }.to raise_error("boom")
60
+ VCR.current_cassette.should be_nil
61
+ end
55
62
  end
56
63
 
57
64
  describe '.use_cassette' do
@@ -259,7 +266,7 @@ describe VCR do
259
266
  VCR.insert_cassette('foo')
260
267
  expect {
261
268
  VCR.turn_off!
262
- }.to raise_error(VCR::CassetteInUseError)
269
+ }.to raise_error(VCR::CassetteInUseError, /foo/)
263
270
  end
264
271
 
265
272
  it 'causes an error to be raised if you insert a cassette while VCR is turned off' do
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: 5
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 2
9
- - 1
10
- version: 2.2.1
9
+ - 2
10
+ version: 2.2.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: 2012-06-13 00:00:00 Z
18
+ date: 2012-06-15 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  version_requirements: &id001 !ruby/object:Gem::Requirement