vcr 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -25,3 +25,4 @@ features/fixtures/vcr_cassettes/**/temp/
25
25
  *.rbc
26
26
  .bundle
27
27
  tmp
28
+ rerun.txt
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.3.3 (November 21, 2010)
4
+
5
+ [Full Changelog](http://github.com/myronmarston/vcr/compare/v1.3.2...v1.3.3)
6
+
7
+ * In specs, hit a local sinatra server rather than example.com. This makes
8
+ the specs faster and removes an external dependency. The specs can pass
9
+ without being online!
10
+ * Raise an explicit error when the http stubbing library is not configured
11
+ (rather than letting the user get a confusing error later).
12
+ * Test against the latest WebMock release (1.6.1) (no changes required).
13
+ * Fix a few cucumber scenarios so they pass on rubinius and jruby.
14
+
3
15
  ## 1.3.2 (November 16, 2010)
4
16
 
5
17
  [Full Changelog](http://github.com/myronmarston/vcr/compare/v1.3.1...v1.3.2)
@@ -29,6 +41,8 @@
29
41
  * Add support for [Typhoeus](https://github.com/pauldix/typhoeus). Thanks to
30
42
  [David Balatero](https://github.com/dbalatero) for making the necessary changes in Typhoeus
31
43
  to support VCR.
44
+ * Remove FakeWeb/WebMock inference logic. You _must_ configure the http stubbing library
45
+ explicitly now.
32
46
 
33
47
  ## 1.2.0 (October 13, 2010)
34
48
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- vcr (1.3.2)
4
+ vcr (1.3.3)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -60,7 +60,7 @@ GEM
60
60
  rake (0.8.7)
61
61
  rb-fsevent (0.3.6)
62
62
  rcov (0.9.9)
63
- relish (0.1.1)
63
+ relish (0.1.5)
64
64
  archive-tar-minitar (~> 0.5.2)
65
65
  json (~> 1.4.6)
66
66
  rest-client (~> 1.6.1)
@@ -98,7 +98,7 @@ GEM
98
98
  tilt (1.1)
99
99
  timecop (0.3.5)
100
100
  typhoeus (0.2.0)
101
- webmock (1.6.0)
101
+ webmock (1.6.1)
102
102
  addressable (>= 2.2.2)
103
103
  crack (>= 0.1.7)
104
104
 
@@ -108,7 +108,7 @@ PLATFORMS
108
108
 
109
109
  DEPENDENCIES
110
110
  aruba (~> 0.2.1)
111
- bundler (~> 1.0.0)
111
+ bundler (~> 1.0.7)
112
112
  cucumber (~> 0.9.4)
113
113
  curb (~> 0.7.8)
114
114
  em-http-request (~> 0.2.7)
data/Rakefile CHANGED
@@ -12,7 +12,7 @@ end
12
12
  desc "Run all examples using rcov"
13
13
  RSpec::Core::RakeTask.new :rcov => :cleanup_rcov_files do |t|
14
14
  t.rcov = true
15
- t.rcov_opts = %[-Ilib -Ispec --exclude "spec/*,gems/*" --text-report --sort coverage --aggregate coverage.data]
15
+ t.rcov_opts = %[-Ilib -Ispec --exclude "spec/*,gems/*,ping,basic_object" --text-report --sort coverage --aggregate coverage.data]
16
16
  end
17
17
 
18
18
  task :cleanup_rcov_files do
@@ -26,7 +26,9 @@ task :default => [:spec, :cucumber]
26
26
 
27
27
  desc "Push cukes to relishapp using the relish-client-gem"
28
28
  task :relish do
29
- sh "relish push vcr"
29
+ require 'vcr/version'
30
+ sh "relish versions:add myronmarston/vcr:#{VCR.version}"
31
+ sh "relish push vcr:#{VCR.version}"
30
32
  end
31
33
 
32
34
  task :release => :relish
data/TODO.md CHANGED
@@ -1,4 +1,2 @@
1
- * use `expect { }.to` rather than `lambda { }.should` in specs.
2
1
  * Use fakefs gem instead of using temp_dir in specs.
3
- * Use localhost server in specs instead of hitting example.com.
4
2
  * Fix #method vs .method in specs.
@@ -25,7 +25,7 @@ Feature: Error for HTTP request made when no cassette is in use
25
25
  Then it should fail with "<error>"
26
26
  And the output should contain each of the following:
27
27
  | You can use VCR to automatically record this request and replay it later. |
28
- | from no_cassette_error.rb:11 |
28
+ | no_cassette_error.rb:11 |
29
29
 
30
30
  Examples:
31
31
  | stub_with | http_lib | error |
@@ -47,6 +47,14 @@ Given /^the directory "([^"]*)" does not exist$/ do |dir|
47
47
  check_directory_presence([dir], false)
48
48
  end
49
49
 
50
+ Given /^a previously recorded cassette file "([^"]*)" with:$/ do |file_name, content|
51
+ create_file(file_name, normalize_cassette_yaml(content))
52
+ end
53
+
54
+ Given /^(\d+) days have passed since the cassette was recorded$/ do |day_count|
55
+ set_env('DAYS_PASSED', day_count)
56
+ end
57
+
50
58
  Then /^the file "([^"]*)" should exist$/ do |file_name|
51
59
  check_file_presence([file_name], true)
52
60
  end
@@ -66,17 +74,9 @@ Then /^the file "([^"]*)" should contain YAML like:$/ do |file_name, expected_co
66
74
  normalize_cassette_structs(actual_content).should == normalize_cassette_structs(expected_content)
67
75
  end
68
76
 
69
- Given /^a previously recorded cassette file "([^"]*)" with:$/ do |file_name, content|
70
- create_file(file_name, normalize_cassette_yaml(content))
71
- end
72
-
73
77
  Then /^the file "([^"]*)" should contain each of these:$/ do |file_name, table|
74
78
  table.raw.flatten.each do |string|
75
79
  check_file_content(file_name, string, true)
76
80
  end
77
81
  end
78
82
 
79
- Given /^(\d+) days have passed since the cassette was recorded$/ do |day_count|
80
- set_env('DAYS_PASSED', day_count)
81
- end
82
-
@@ -5,7 +5,16 @@ $LOAD_PATH.unshift '../../lib' unless $LOAD_PATH.include?('../../lib')
5
5
 
6
6
  RUNNING_UNDER_ARUBA = File.dirname(__FILE__) == '.' || File.dirname(__FILE__) =~ /aruba/
7
7
 
8
- require 'support/fixnum_extension' if RUNNING_UNDER_ARUBA
8
+ if RUNNING_UNDER_ARUBA
9
+ require 'support/fixnum_extension'
10
+ require 'vcr/internet_connection'
11
+
12
+ # pretend we're always on the internet (so that we don't have an
13
+ # internet connection dependency for our cukes)
14
+ VCR::InternetConnection.class_eval do
15
+ def available?; true; end
16
+ end
17
+ end
9
18
 
10
19
  if ENV['DAYS_PASSED']
11
20
  require 'timecop'
@@ -7,7 +7,7 @@ module VCR
7
7
  class Cassette
8
8
  class MissingERBVariableError < NameError; end
9
9
 
10
- VALID_RECORD_MODES = [:all, :none, :new_episodes].freeze
10
+ VALID_RECORD_MODES = [:all, :none, :new_episodes]
11
11
 
12
12
  attr_reader :name, :record_mode, :match_requests_on, :erb, :re_record_interval
13
13
 
@@ -16,11 +16,14 @@ module VCR
16
16
  @default_cassette_options
17
17
  end
18
18
 
19
- attr_reader :http_stubbing_libraries
20
19
  def stub_with(*http_stubbing_libraries)
21
20
  @http_stubbing_libraries = http_stubbing_libraries
22
21
  end
23
22
 
23
+ def http_stubbing_libraries
24
+ @http_stubbing_libraries ||= []
25
+ end
26
+
24
27
  def ignore_localhost=(value)
25
28
  VCR.http_stubbing_adapter && VCR.http_stubbing_adapter.ignore_localhost = value
26
29
  @ignore_localhost = value
@@ -10,8 +10,8 @@ module VCR
10
10
  module Common
11
11
  def self.add_vcr_info_to_exception_message(exception_klass)
12
12
  exception_klass.class_eval do
13
- def message
14
- super + ". " + VCR::HttpStubbingAdapters::Common::RECORDING_INSTRUCTIONS
13
+ def initialize(message)
14
+ super(message + '. ' + VCR::HttpStubbingAdapters::Common::RECORDING_INSTRUCTIONS)
15
15
  end
16
16
  end
17
17
  end
@@ -7,7 +7,7 @@ module VCR
7
7
  include VCR::HttpStubbingAdapters::Common
8
8
  extend self
9
9
 
10
- UNSUPPORTED_REQUEST_MATCH_ATTRIBUTES = [:body, :headers].freeze
10
+ UNSUPPORTED_REQUEST_MATCH_ATTRIBUTES = [:body, :headers]
11
11
  LOCALHOST_REGEX = %r|\Ahttps?://((\w+:)?\w+@)?(#{VCR::LOCALHOST_ALIASES.map { |a| Regexp.escape(a) }.join('|')})(:\d+)?/|i
12
12
 
13
13
  MINIMUM_VERSION = '1.3.0'
@@ -2,8 +2,8 @@ require 'set'
2
2
 
3
3
  module VCR
4
4
  class RequestMatcher
5
- VALID_MATCH_ATTRIBUTES = [:method, :uri, :host, :path, :headers, :body].freeze
6
- DEFAULT_MATCH_ATTRIBUTES = [:method, :uri].freeze
5
+ VALID_MATCH_ATTRIBUTES = [:method, :uri, :host, :path, :headers, :body]
6
+ DEFAULT_MATCH_ATTRIBUTES = [:method, :uri]
7
7
 
8
8
  attr_reader :request, :match_attributes
9
9
 
@@ -3,7 +3,7 @@ module VCR
3
3
 
4
4
  def version
5
5
  @version ||= begin
6
- string = '1.3.2'
6
+ string = '1.3.3'
7
7
 
8
8
  def string.parts; VCR.version.split('.').map { |p| p.to_i }; end
9
9
  def string.major; parts[0]; end
@@ -1 +1 @@
1
- rvm 1.8.6,1.8.7,1.9.1,1.9.2,ree,jruby,rbx-head rake -f script/FullBuildRakeFile build | tee tmp/full_build.out
1
+ rvm 1.8.6,1.8.7,1.9.1,1.9.2,ree,jruby,rbx rake -f script/FullBuildRakeFile build | tee tmp/full_build.out
@@ -52,11 +52,11 @@ describe VCR::Cassette do
52
52
  describe 'on creation' do
53
53
  it 'raises an error with a helpful message when loading an old unsupported cassette' do
54
54
  VCR::Config.cassette_library_dir = File.expand_path(File.dirname(__FILE__) + "/fixtures/#{YAML_SERIALIZATION_VERSION}")
55
- lambda { VCR::Cassette.new('0_3_1_cassette') }.should raise_error(/The VCR cassette 0_3_1_cassette.yml uses an old format that is now deprecated/)
55
+ expect { VCR::Cassette.new('0_3_1_cassette') }.to raise_error(/The VCR cassette 0_3_1_cassette.yml uses an old format that is now deprecated/)
56
56
  end
57
57
 
58
58
  it "raises an error if given an invalid record mode" do
59
- lambda { VCR::Cassette.new(:test, :record => :not_a_record_mode) }.should raise_error(ArgumentError)
59
+ expect { VCR::Cassette.new(:test, :record => :not_a_record_mode) }.to raise_error(ArgumentError)
60
60
  end
61
61
 
62
62
  it 'raises an error if given invalid options' do
@@ -266,7 +266,7 @@ describe VCR::Cassette do
266
266
  cassette = VCR::Cassette.new(:eject_test)
267
267
  cassette.stub!(:new_recorded_interactions).and_return(recorded_interactions)
268
268
 
269
- lambda { cassette.eject }.should change { File.exist?(cassette.file) }.from(false).to(true)
269
+ expect { cassette.eject }.to change { File.exist?(cassette.file) }.from(false).to(true)
270
270
  saved_recorded_interactions = File.open(cassette.file, "r") { |f| YAML.load(f.read) }
271
271
  saved_recorded_interactions.should == recorded_interactions
272
272
  end
@@ -276,7 +276,7 @@ describe VCR::Cassette do
276
276
  cassette = VCR::Cassette.new('subdirectory/test_cassette')
277
277
  cassette.stub!(:new_recorded_interactions).and_return(recorded_interactions)
278
278
 
279
- lambda { cassette.eject }.should change { File.exist?(cassette.file) }.from(false).to(true)
279
+ expect { cassette.eject }.to change { File.exist?(cassette.file) }.from(false).to(true)
280
280
  saved_recorded_interactions = File.open(cassette.file, "r") { |f| YAML.load(f.read) }
281
281
  saved_recorded_interactions.should == recorded_interactions
282
282
  end
@@ -300,7 +300,7 @@ describe VCR::Cassette do
300
300
  it "does not re-write to disk the previously recorded interactions if there are no new ones" do
301
301
  yaml_file = subject.file
302
302
  File.should_not_receive(:open).with(subject.file, 'w')
303
- lambda { subject.eject }.should_not change { File.mtime(yaml_file) }
303
+ expect { subject.eject }.to_not change { File.mtime(yaml_file) }
304
304
  end
305
305
 
306
306
  context 'when some new interactions have been recorded' do
@@ -5,11 +5,11 @@ describe VCR::Config do
5
5
  temp_dir(File.expand_path(File.dirname(__FILE__) + '/fixtures/config_spec'))
6
6
 
7
7
  it 'creates the directory if it does not exist' do
8
- lambda { VCR::Config.cassette_library_dir = @temp_dir }.should change { File.exist?(@temp_dir) }.from(false).to(true)
8
+ expect { VCR::Config.cassette_library_dir = @temp_dir }.to change { File.exist?(@temp_dir) }.from(false).to(true)
9
9
  end
10
10
 
11
11
  it 'does not raise an error if given nil' do
12
- lambda { VCR::Config.cassette_library_dir = nil }.should_not raise_error
12
+ expect { VCR::Config.cassette_library_dir = nil }.to_not raise_error
13
13
  end
14
14
  end
15
15
 
@@ -35,6 +35,13 @@ describe VCR::Config do
35
35
  end
36
36
  end
37
37
 
38
+ describe '.http_stubbing_libraries' do
39
+ it 'returns an empty array even when the variable is nil' do
40
+ VCR::Config.send(:remove_instance_variable, :@http_stubbing_libraries)
41
+ VCR::Config.http_stubbing_libraries.should == []
42
+ end
43
+ end
44
+
38
45
  describe '#ignore_localhost' do
39
46
  it 'sets VCR.http_stubbing_adapter.ignore_localhost?' do
40
47
  [true, false].each do |val|
@@ -42,7 +42,7 @@ describe VCR::Net::HTTPResponse do
42
42
  end
43
43
  end
44
44
 
45
- { :get => /You have reached this web page by typing.*example\.com/, :head => /\A\z/ }.each do |http_verb, expected_body_regex|
45
+ { :get => /GET to root/, :head => /\A\z/ }.each do |http_verb, expected_body_regex|
46
46
  context "for a #{http_verb.to_s.upcase} request" do
47
47
  let(:http_verb_method) { :"request_#{http_verb}" }
48
48
 
@@ -53,7 +53,7 @@ describe VCR::Net::HTTPResponse do
53
53
  end
54
54
 
55
55
  @response ||= begin
56
- http = Net::HTTP.new('example.com', 80)
56
+ http = Net::HTTP.new('localhost', VCR::SinatraApp.port)
57
57
  res = http.send(http_verb_method, '/', &block)
58
58
  res.should_not be_a(VCR::Net::HTTPResponse)
59
59
  res.should_not be_a(::WebMock::Net::HTTPResponse)
@@ -3,12 +3,14 @@ require 'spec_helper'
3
3
  describe "Net::HTTP Extensions" do
4
4
  without_webmock_callbacks
5
5
 
6
- let(:uri) { URI.parse('http://example.com') }
6
+ before(:all) { VCR::SinatraApp.port } # ensure the server is started before instantiating any Net::HTTP instances
7
+
8
+ let(:uri) { URI.parse("http://localhost:#{VCR::SinatraApp.port}/") }
7
9
  before(:each) { VCR.stub(:http_stubbing_adapter).and_return(VCR::HttpStubbingAdapters::FakeWeb) }
8
10
 
9
11
  it 'checks if the request is stubbed using a VCR::Request' do
10
12
  VCR.http_stubbing_adapter.should_receive(:request_stubbed?) do |request, _|
11
- request.uri.should == 'http://example.com:80/'
13
+ request.uri.should == "http://localhost:#{VCR::SinatraApp.port}/"
12
14
  request.method.should == :get
13
15
  true
14
16
  end
@@ -33,7 +35,7 @@ describe "Net::HTTP Extensions" do
33
35
  end
34
36
 
35
37
  def perform_get_with_returning_block
36
- Net::HTTP.new('example.com', 80).request(Net::HTTP::Get.new('/', {})) do |response|
38
+ Net::HTTP.new('localhost', VCR::SinatraApp.port).request(Net::HTTP::Get.new('/', {})) do |response|
37
39
  return response
38
40
  end
39
41
  end
@@ -43,7 +45,7 @@ describe "Net::HTTP Extensions" do
43
45
  interaction.request.headers.should_not have_key('content-type')
44
46
  interaction.request.headers.should_not have_key('host')
45
47
  end
46
- Net::HTTP.new('example.com', 80).send_request('POST', '/', '', { 'x-http-user' => 'me' })
48
+ Net::HTTP.new('localhost', VCR::SinatraApp.port).send_request('POST', '/', '', { 'x-http-user' => 'me' })
47
49
  end
48
50
 
49
51
  it "records headers for which Net::HTTP usually sets defaults when the user manually sets their values" do
@@ -51,7 +53,7 @@ describe "Net::HTTP Extensions" do
51
53
  interaction.request.headers['content-type'].should == ['foo/bar']
52
54
  interaction.request.headers['host'].should == ['my-example.com']
53
55
  end
54
- Net::HTTP.new('example.com', 80).send_request('POST', '/', '', { 'Content-Type' => 'foo/bar', 'Host' => 'my-example.com' })
56
+ Net::HTTP.new('localhost', VCR::SinatraApp.port).send_request('POST', '/', '', { 'Content-Type' => 'foo/bar', 'Host' => 'my-example.com' })
55
57
  end
56
58
 
57
59
  it 'calls VCR.record_http_interaction' do
@@ -61,7 +63,7 @@ describe "Net::HTTP Extensions" do
61
63
 
62
64
  it 'calls #record_http_interaction only once, even when Net::HTTP internally recursively calls #request' do
63
65
  VCR.should_receive(:record_http_interaction).once
64
- Net::HTTP.new('example.com', 80).post('/', nil)
66
+ Net::HTTP.new('localhost', VCR::SinatraApp.port).post('/', nil)
65
67
  end
66
68
 
67
69
  it 'calls #record_http_interaction when Net::HTTP#request is called with a block with a return statement' do
@@ -200,29 +200,31 @@ module HttpLibrarySpecs
200
200
  end
201
201
 
202
202
  def self.test_real_http_request(http_allowed)
203
+ let(:url) { "http://localhost:#{VCR::SinatraApp.port}/foo" }
204
+
203
205
  if http_allowed
204
206
 
205
207
  it 'allows real http requests' do
206
- get_body_string(make_http_request(:get, 'http://example.com/foo')).should =~ /The requested URL \/foo was not found/
208
+ get_body_string(make_http_request(:get, url)).should == 'FOO!'
207
209
  end
208
210
 
209
211
  it 'records new http requests' do
210
212
  VCR.should_receive(:record_http_interaction) do |interaction|
211
- interaction.request.uri.should == 'http://example.com:80/foo'
213
+ interaction.request.uri.should == url
212
214
  interaction.request.method.should == :get
213
- interaction.response.status.code.should == 404
214
- interaction.response.status.message.should == 'Not Found'
215
- interaction.response.body.should =~ /The requested URL \/foo was not found/
216
- interaction.response.headers['content-type'].should == ["text/html; charset=iso-8859-1"]
215
+ interaction.response.status.code.should == 200
216
+ interaction.response.status.message.should == 'OK'
217
+ interaction.response.body.should == 'FOO!'
218
+ interaction.response.headers['content-type'].should == ["text/html;charset=utf-8"]
217
219
  end
218
220
 
219
- make_http_request(:get, 'http://example.com/foo')
221
+ make_http_request(:get, url)
220
222
  end
221
223
 
222
224
  else
223
225
  it 'does not allow real HTTP requests or record them' do
224
226
  VCR.should_receive(:record_http_interaction).never
225
- lambda { make_http_request(:get, 'http://example.com/foo') }.should raise_error(NET_CONNECT_NOT_ALLOWED_ERROR)
227
+ expect { make_http_request(:get, url) }.to raise_error(NET_CONNECT_NOT_ALLOWED_ERROR)
226
228
  end
227
229
  end
228
230
  end
@@ -248,16 +250,14 @@ module HttpLibrarySpecs
248
250
 
249
251
  unless http_allowed
250
252
  describe '.ignore_localhost =' do
251
- let(:localhost_response) { 'A localhost response!' }
252
- let(:localhost_server) { VCR::LocalhostServer::STATIC_SERVERS[localhost_response] }
253
+ localhost_response = "Localhost response"
253
254
 
254
255
  VCR::LOCALHOST_ALIASES.each do |localhost_alias|
255
256
  describe 'when set to true' do
256
- extend PendingOnHeroku
257
257
  before(:each) { subject.ignore_localhost = true }
258
258
 
259
259
  it "allows requests to #{localhost_alias}" do
260
- get_body_string(make_http_request(:get, "http://#{localhost_alias}:#{localhost_server.port}/")).should == localhost_response
260
+ get_body_string(make_http_request(:get, "http://#{localhost_alias}:#{VCR::SinatraApp.port}/localhost_test")).should == localhost_response
261
261
  end
262
262
  end
263
263
 
@@ -265,7 +265,7 @@ module HttpLibrarySpecs
265
265
  before(:each) { subject.ignore_localhost = false }
266
266
 
267
267
  it "does not allow requests to #{localhost_alias}" do
268
- expect { make_http_request(:get, "http://#{localhost_alias}:#{localhost_server.port}/") }.to raise_error(NET_CONNECT_NOT_ALLOWED_ERROR)
268
+ expect { make_http_request(:get, "http://#{localhost_alias}:#{VCR::SinatraApp.port}/localhost_test") }.to raise_error(NET_CONNECT_NOT_ALLOWED_ERROR)
269
269
  end
270
270
  end
271
271
  end
@@ -0,0 +1,25 @@
1
+ require 'sinatra'
2
+
3
+ module VCR
4
+ class SinatraApp < ::Sinatra::Base
5
+ get '/' do
6
+ "GET to root"
7
+ end
8
+
9
+ get '/localhost_test' do
10
+ "Localhost response"
11
+ end
12
+
13
+ get '/foo' do
14
+ "FOO!"
15
+ end
16
+
17
+ def self.port
18
+ server.port
19
+ end
20
+
21
+ def self.server
22
+ @server ||= VCR::LocalhostServer.new(new)
23
+ end
24
+ end
25
+ end
@@ -92,10 +92,6 @@ module VCR
92
92
  sleep(0.05)
93
93
  end
94
94
  end
95
-
96
- STATIC_SERVERS = Hash.new do |h, k|
97
- h[k] = new(lambda { |env| [200, {}, StringIO.new(k)] })
98
- end
99
95
  end
100
96
  end
101
97
 
@@ -32,7 +32,7 @@ describe VCR do
32
32
 
33
33
  it 'returns the #current_cassette to the previous one' do
34
34
  cassette1, cassette2 = insert_cassette, insert_cassette
35
- lambda { VCR.eject_cassette }.should change(VCR, :current_cassette).from(cassette2).to(cassette1)
35
+ expect { VCR.eject_cassette }.to change(VCR, :current_cassette).from(cassette2).to(cassette1)
36
36
  end
37
37
  end
38
38
 
@@ -56,13 +56,13 @@ describe VCR do
56
56
 
57
57
  it 'ejects the cassette even if there is an error' do
58
58
  VCR.should_receive(:eject_cassette)
59
- lambda { VCR.use_cassette(:cassette_test) { raise StandardError } }.should raise_error
59
+ expect { VCR.use_cassette(:cassette_test) { raise StandardError } }.to raise_error
60
60
  end
61
61
 
62
62
  it 'does not eject a cassette if there was an error inserting it' do
63
63
  VCR.should_receive(:insert_cassette).and_raise(StandardError.new('Boom!'))
64
64
  VCR.should_not_receive(:eject_cassette)
65
- lambda { VCR.use_cassette(:test) { } }.should raise_error(StandardError, 'Boom!')
65
+ expect { VCR.use_cassette(:test) { } }.to raise_error(StandardError, 'Boom!')
66
66
  end
67
67
  end
68
68
 
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.required_rubygems_version = '>= 1.3.5'
20
20
 
21
21
  {
22
- 'bundler' => '~> 1.0.0',
22
+ 'bundler' => '~> 1.0.7',
23
23
  'rake' => '~> 0.8.7',
24
24
 
25
25
  'rspec' => '~> 2.1.0',
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: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 3
9
- - 2
10
- version: 1.3.2
9
+ - 3
10
+ version: 1.3.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Myron Marston
@@ -15,11 +15,11 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-16 00:00:00 -08:00
18
+ date: 2010-11-21 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- version_requirements: &id001 !ruby/object:Gem::Requirement
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
23
  none: false
24
24
  requirements:
25
25
  - - ~>
@@ -30,12 +30,12 @@ dependencies:
30
30
  - 3
31
31
  - 0
32
32
  version: 1.3.0
33
- requirement: *id001
34
33
  type: :development
35
34
  name: fakeweb
36
35
  prerelease: false
36
+ version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency
38
- version_requirements: &id002 !ruby/object:Gem::Requirement
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -47,12 +47,12 @@ dependencies:
47
47
  - 5
48
48
  - 2
49
49
  version: 2.1.5.2
50
- requirement: *id002
51
50
  type: :development
52
51
  name: httpclient
53
52
  prerelease: false
53
+ version_requirements: *id002
54
54
  - !ruby/object:Gem::Dependency
55
- version_requirements: &id003 !ruby/object:Gem::Requirement
55
+ requirement: &id003 !ruby/object:Gem::Requirement
56
56
  none: false
57
57
  requirements:
58
58
  - - ~>
@@ -63,12 +63,12 @@ dependencies:
63
63
  - 8
64
64
  - 7
65
65
  version: 0.8.7
66
- requirement: *id003
67
66
  type: :development
68
67
  name: rake
69
68
  prerelease: false
69
+ version_requirements: *id003
70
70
  - !ruby/object:Gem::Dependency
71
- version_requirements: &id004 !ruby/object:Gem::Requirement
71
+ requirement: &id004 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -79,12 +79,12 @@ dependencies:
79
79
  - 3
80
80
  - 5
81
81
  version: 0.3.5
82
- requirement: *id004
83
82
  type: :development
84
83
  name: timecop
85
84
  prerelease: false
85
+ version_requirements: *id004
86
86
  - !ruby/object:Gem::Dependency
87
- version_requirements: &id005 !ruby/object:Gem::Requirement
87
+ requirement: &id005 !ruby/object:Gem::Requirement
88
88
  none: false
89
89
  requirements:
90
90
  - - ~>
@@ -95,12 +95,12 @@ dependencies:
95
95
  - 1
96
96
  - 0
97
97
  version: 2.1.0
98
- requirement: *id005
99
98
  type: :development
100
99
  name: rspec
101
100
  prerelease: false
101
+ version_requirements: *id005
102
102
  - !ruby/object:Gem::Dependency
103
- version_requirements: &id006 !ruby/object:Gem::Requirement
103
+ requirement: &id006 !ruby/object:Gem::Requirement
104
104
  none: false
105
105
  requirements:
106
106
  - - "="
@@ -111,12 +111,12 @@ dependencies:
111
111
  - 1
112
112
  - 0
113
113
  version: 1.1.0
114
- requirement: *id006
115
114
  type: :development
116
115
  name: rack
117
116
  prerelease: false
117
+ version_requirements: *id006
118
118
  - !ruby/object:Gem::Dependency
119
- version_requirements: &id007 !ruby/object:Gem::Requirement
119
+ requirement: &id007 !ruby/object:Gem::Requirement
120
120
  none: false
121
121
  requirements:
122
122
  - - ~>
@@ -127,12 +127,12 @@ dependencies:
127
127
  - 2
128
128
  - 1
129
129
  version: 0.2.1
130
- requirement: *id007
131
130
  type: :development
132
131
  name: aruba
133
132
  prerelease: false
133
+ version_requirements: *id007
134
134
  - !ruby/object:Gem::Dependency
135
- version_requirements: &id008 !ruby/object:Gem::Requirement
135
+ requirement: &id008 !ruby/object:Gem::Requirement
136
136
  none: false
137
137
  requirements:
138
138
  - - ~>
@@ -143,28 +143,28 @@ dependencies:
143
143
  - 1
144
144
  - 0
145
145
  version: 1.1.0
146
- requirement: *id008
147
146
  type: :development
148
147
  name: sinatra
149
148
  prerelease: false
149
+ version_requirements: *id008
150
150
  - !ruby/object:Gem::Dependency
151
- version_requirements: &id009 !ruby/object:Gem::Requirement
151
+ requirement: &id009 !ruby/object:Gem::Requirement
152
152
  none: false
153
153
  requirements:
154
154
  - - ~>
155
155
  - !ruby/object:Gem::Version
156
- hash: 23
156
+ hash: 25
157
157
  segments:
158
158
  - 1
159
159
  - 0
160
- - 0
161
- version: 1.0.0
162
- requirement: *id009
160
+ - 7
161
+ version: 1.0.7
163
162
  type: :development
164
163
  name: bundler
165
164
  prerelease: false
165
+ version_requirements: *id009
166
166
  - !ruby/object:Gem::Dependency
167
- version_requirements: &id010 !ruby/object:Gem::Requirement
167
+ requirement: &id010 !ruby/object:Gem::Requirement
168
168
  none: false
169
169
  requirements:
170
170
  - - ~>
@@ -175,12 +175,12 @@ dependencies:
175
175
  - 9
176
176
  - 4
177
177
  version: 0.9.4
178
- requirement: *id010
179
178
  type: :development
180
179
  name: cucumber
181
180
  prerelease: false
181
+ version_requirements: *id010
182
182
  - !ruby/object:Gem::Dependency
183
- version_requirements: &id011 !ruby/object:Gem::Requirement
183
+ requirement: &id011 !ruby/object:Gem::Requirement
184
184
  none: false
185
185
  requirements:
186
186
  - - ~>
@@ -191,12 +191,12 @@ dependencies:
191
191
  - 6
192
192
  - 0
193
193
  version: 1.6.0
194
- requirement: *id011
195
194
  type: :development
196
195
  name: webmock
197
196
  prerelease: false
197
+ version_requirements: *id011
198
198
  - !ruby/object:Gem::Dependency
199
- version_requirements: &id012 !ruby/object:Gem::Requirement
199
+ requirement: &id012 !ruby/object:Gem::Requirement
200
200
  none: false
201
201
  requirements:
202
202
  - - ~>
@@ -207,12 +207,12 @@ dependencies:
207
207
  - 7
208
208
  - 8
209
209
  version: 0.7.8
210
- requirement: *id012
211
210
  type: :development
212
211
  name: curb
213
212
  prerelease: false
213
+ version_requirements: *id012
214
214
  - !ruby/object:Gem::Dependency
215
- version_requirements: &id013 !ruby/object:Gem::Requirement
215
+ requirement: &id013 !ruby/object:Gem::Requirement
216
216
  none: false
217
217
  requirements:
218
218
  - - ~>
@@ -223,12 +223,12 @@ dependencies:
223
223
  - 4
224
224
  - 6
225
225
  version: 0.4.6
226
- requirement: *id013
227
226
  type: :development
228
227
  name: patron
229
228
  prerelease: false
229
+ version_requirements: *id013
230
230
  - !ruby/object:Gem::Dependency
231
- version_requirements: &id014 !ruby/object:Gem::Requirement
231
+ requirement: &id014 !ruby/object:Gem::Requirement
232
232
  none: false
233
233
  requirements:
234
234
  - - ~>
@@ -239,12 +239,12 @@ dependencies:
239
239
  - 2
240
240
  - 7
241
241
  version: 0.2.7
242
- requirement: *id014
243
242
  type: :development
244
243
  name: em-http-request
245
244
  prerelease: false
245
+ version_requirements: *id014
246
246
  - !ruby/object:Gem::Dependency
247
- version_requirements: &id015 !ruby/object:Gem::Requirement
247
+ requirement: &id015 !ruby/object:Gem::Requirement
248
248
  none: false
249
249
  requirements:
250
250
  - - ~>
@@ -255,10 +255,10 @@ dependencies:
255
255
  - 2
256
256
  - 0
257
257
  version: 0.2.0
258
- requirement: *id015
259
258
  type: :development
260
259
  name: typhoeus
261
260
  prerelease: false
261
+ version_requirements: *id015
262
262
  description: VCR provides helpers to record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests. It works with any ruby testing framework, and provides built-in support for cucumber.
263
263
  email: myron.marston@gmail.com
264
264
  executables: []
@@ -366,8 +366,8 @@ files:
366
366
  - spec/support/fixnum_extension.rb
367
367
  - spec/support/http_library_adapters.rb
368
368
  - spec/support/http_stubbing_adapter.rb
369
- - spec/support/pending_on_heroku.rb
370
369
  - spec/support/ruby_interpreter.rb
370
+ - spec/support/sinatra_app.rb
371
371
  - spec/support/temp_cassette_library_dir.rb
372
372
  - spec/support/vcr_localhost_server.rb
373
373
  - spec/support/version_checker.rb
@@ -478,8 +478,8 @@ test_files:
478
478
  - spec/support/fixnum_extension.rb
479
479
  - spec/support/http_library_adapters.rb
480
480
  - spec/support/http_stubbing_adapter.rb
481
- - spec/support/pending_on_heroku.rb
482
481
  - spec/support/ruby_interpreter.rb
482
+ - spec/support/sinatra_app.rb
483
483
  - spec/support/temp_cassette_library_dir.rb
484
484
  - spec/support/vcr_localhost_server.rb
485
485
  - spec/support/version_checker.rb
@@ -1,14 +0,0 @@
1
- # The VCR test suite spawns a localhost webserver in a separate process, but it appears that
2
- # heroku does not support this. I'm using heroku for my CI server, so we disable these specs
3
- # as pending specs when we're running on heroku.
4
- module PendingOnHeroku
5
- if ENV.keys.include?('HEROKU_SLUG')
6
- def it(*args, &block)
7
- super description, *args do
8
- pending('pending on heroku because heroku does not allow the spawning of a localhost webserver') do
9
- instance_eval(&block)
10
- end
11
- end
12
- end
13
- end
14
- end