vcr 1.10.3 → 1.11.1
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.
- data/.travis.yml +3 -2
- data/CHANGELOG.md +14 -1
- data/Gemfile +2 -1
- data/Rakefile +6 -2
- data/features/configuration/stub_with.feature +0 -30
- data/lib/vcr.rb +3 -1
- data/lib/vcr/http_stubbing_adapters/common.rb +96 -1
- data/lib/vcr/http_stubbing_adapters/excon.rb +3 -79
- data/lib/vcr/http_stubbing_adapters/fakeweb.rb +1 -1
- data/lib/vcr/http_stubbing_adapters/faraday.rb +6 -79
- data/lib/vcr/http_stubbing_adapters/typhoeus.rb +9 -1
- data/lib/vcr/http_stubbing_adapters/webmock.rb +3 -3
- data/lib/vcr/middleware/faraday.rb +1 -2
- data/lib/vcr/version.rb +1 -1
- data/spec/monkey_patches.rb +40 -24
- data/spec/spec_helper.rb +1 -17
- data/spec/support/vcr_localhost_server.rb +1 -1
- data/spec/vcr/cassette_spec.rb +2 -2
- data/spec/vcr/extensions/net_http_response_spec.rb +2 -2
- data/spec/vcr/extensions/net_http_spec.rb +1 -1
- data/spec/vcr/http_stubbing_adapters/excon_spec.rb +1 -1
- data/spec/vcr/http_stubbing_adapters/fakeweb_spec.rb +1 -1
- data/spec/vcr/http_stubbing_adapters/faraday_spec.rb +2 -9
- data/spec/vcr/http_stubbing_adapters/typhoeus_spec.rb +8 -1
- data/spec/vcr/http_stubbing_adapters/webmock_spec.rb +4 -4
- data/spec/vcr_spec.rb +6 -0
- data/vcr.gemspec +1 -1
- metadata +46 -48
    
        data/.travis.yml
    CHANGED
    
    
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,6 +1,19 @@ | |
| 1 1 | 
             
            ## In git
         | 
| 2 2 |  | 
| 3 | 
            -
            [Full Changelog](http://github.com/myronmarston/vcr/compare/v1. | 
| 3 | 
            +
            [Full Changelog](http://github.com/myronmarston/vcr/compare/v1.11.1...master)
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            ## 1.11.1 (August 18, 2011)
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            [Full Changelog](http://github.com/myronmarston/vcr/compare/v1.11.0...v1.11.1)
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            * Yanked 1.11.0 and rebuilt gem on 1.8.7 to deal with syck/psych
         | 
| 10 | 
            +
              incompatibilties in gemspec.
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            ## 1.11.0 (August 18, 2011)
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            [Full Changelog](http://github.com/myronmarston/vcr/compare/v1.10.3...v1.11.0)
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            * Updates to work with WebMock 1.7.0.
         | 
| 4 17 |  | 
| 5 18 | 
             
            ## 1.10.3 (July 21, 2011)
         | 
| 6 19 |  | 
    
        data/Gemfile
    CHANGED
    
    | @@ -30,6 +30,7 @@ group :extras do | |
| 30 30 |  | 
| 31 31 | 
             
              platforms :mri_18 do
         | 
| 32 32 | 
             
                gem 'ruby-debug'
         | 
| 33 | 
            +
                gem 'linecache', '0.43' # later versions do not work on 1.8.6
         | 
| 33 34 | 
             
              end
         | 
| 34 35 |  | 
| 35 36 | 
             
              platforms :mri_19 do
         | 
| @@ -37,5 +38,5 @@ group :extras do | |
| 37 38 | 
             
                gem 'ruby-debug19'
         | 
| 38 39 | 
             
                gem 'ruby-debug-base19', RUBY_VERSION == '1.9.1' ? '0.11.23' : '~> 0.11.24'
         | 
| 39 40 | 
             
              end
         | 
| 40 | 
            -
            end
         | 
| 41 | 
            +
            end unless ENV['CI']
         | 
| 41 42 |  | 
    
        data/Rakefile
    CHANGED
    
    | @@ -44,7 +44,7 @@ namespace :ci do | |
| 44 44 | 
             
              end
         | 
| 45 45 |  | 
| 46 46 | 
             
              desc "Run a ci build"
         | 
| 47 | 
            -
              task :build => [:setup, :spec | 
| 47 | 
            +
              task :build => [:setup, :spec]
         | 
| 48 48 | 
             
            end
         | 
| 49 49 |  | 
| 50 50 | 
             
            def ensure_relish_doc_symlinked(filename)
         | 
| @@ -78,7 +78,11 @@ task :prep_relish_release do | |
| 78 78 | 
             
              ENV['NEW_RELISH_RELEASE'] = 'true'
         | 
| 79 79 | 
             
            end
         | 
| 80 80 |  | 
| 81 | 
            -
            task : | 
| 81 | 
            +
            task :require_ruby_18 do
         | 
| 82 | 
            +
              raise "This must be run on Ruby 1.8" unless RUBY_VERSION =~ /^1\.8/
         | 
| 83 | 
            +
            end
         | 
| 84 | 
            +
             | 
| 85 | 
            +
            task :release => [:require_ruby_18, :prep_relish_release, :relish]
         | 
| 82 86 |  | 
| 83 87 | 
             
            # For gem-test: http://gem-testers.org/
         | 
| 84 88 | 
             
            task :test => :spec
         | 
| @@ -41,36 +41,6 @@ Feature: stub_with | |
| 41 41 | 
             
              additional features of WebMock) you can change the `stub_with` configuration
         | 
| 42 42 | 
             
              option and it'll work with no other changes required.
         | 
| 43 43 |  | 
| 44 | 
            -
              Scenario Outline: stub_with loads the given HTTP stubbing library
         | 
| 45 | 
            -
                Given a file named "vcr_stub_with.rb" with:
         | 
| 46 | 
            -
                  """
         | 
| 47 | 
            -
                  require 'vcr'
         | 
| 48 | 
            -
             | 
| 49 | 
            -
                  VCR.config do |c|
         | 
| 50 | 
            -
                    c.stub_with <stub_with>
         | 
| 51 | 
            -
                  end
         | 
| 52 | 
            -
             | 
| 53 | 
            -
                  puts "FakeWeb Loaded: #{!!defined?(FakeWeb)}"
         | 
| 54 | 
            -
                  puts "WebMock Loaded: #{!!defined?(WebMock)}"
         | 
| 55 | 
            -
                  puts "Typhoeus Loaded: #{!!defined?(Typhoeus)}"
         | 
| 56 | 
            -
                  puts "Excon Loaded: #{!!defined?(Excon)}"
         | 
| 57 | 
            -
                  """
         | 
| 58 | 
            -
                When I run "ruby vcr_stub_with.rb"
         | 
| 59 | 
            -
                Then the output should contain:
         | 
| 60 | 
            -
                  """
         | 
| 61 | 
            -
                  FakeWeb Loaded: <fakeweb_loaded>
         | 
| 62 | 
            -
                  WebMock Loaded: <webmock_loaded>
         | 
| 63 | 
            -
                  Typhoeus Loaded: <typhoeus_loaded>
         | 
| 64 | 
            -
                  Excon Loaded: <excon_loaded>
         | 
| 65 | 
            -
                  """
         | 
| 66 | 
            -
             | 
| 67 | 
            -
                Examples:
         | 
| 68 | 
            -
                  | stub_with | fakeweb_loaded | webmock_loaded | typhoeus_loaded | excon_loaded |
         | 
| 69 | 
            -
                  | :fakeweb  | true           | false          | false           | false        |
         | 
| 70 | 
            -
                  | :webmock  | false          | true           | false           | false        |
         | 
| 71 | 
            -
                  | :typhoeus | false          | false          | true            | false        |
         | 
| 72 | 
            -
                  | :excon    | false          | false          | false           | true         |
         | 
| 73 | 
            -
             | 
| 74 44 | 
             
              Scenario Outline: Record and replay a request using each supported stubbing/http library combination
         | 
| 75 45 | 
             
                Given a file named "stubbing_http_lib_combo.rb" with:
         | 
| 76 46 | 
             
                  """
         | 
    
        data/lib/vcr.rb
    CHANGED
    
    | @@ -99,7 +99,9 @@ module VCR | |
| 99 99 |  | 
| 100 100 | 
             
                  adapters = VCR::Config.http_stubbing_libraries.map { |l| adapter_for(l) }
         | 
| 101 101 | 
             
                  raise ArgumentError.new("The http stubbing library is not configured.") if adapters.empty?
         | 
| 102 | 
            -
                  HttpStubbingAdapters::MultiObjectProxy.for(*adapters)
         | 
| 102 | 
            +
                  adapter = HttpStubbingAdapters::MultiObjectProxy.for(*adapters)
         | 
| 103 | 
            +
                  adapter.after_adapters_loaded
         | 
| 104 | 
            +
                  adapter
         | 
| 103 105 | 
             
                end
         | 
| 104 106 | 
             
              end
         | 
| 105 107 |  | 
| @@ -37,6 +37,10 @@ module VCR | |
| 37 37 | 
             
                    [nil, self].include? VCR::HttpStubbingAdapters::Common.exclusively_enabled_adapter
         | 
| 38 38 | 
             
                  end
         | 
| 39 39 |  | 
| 40 | 
            +
                  def after_adapters_loaded
         | 
| 41 | 
            +
                    # no-op
         | 
| 42 | 
            +
                  end
         | 
| 43 | 
            +
             | 
| 40 44 | 
             
                  def exclusively_enabled
         | 
| 41 45 | 
             
                    VCR::HttpStubbingAdapters::Common.exclusively_enabled_adapter = self
         | 
| 42 46 |  | 
| @@ -64,12 +68,89 @@ module VCR | |
| 64 68 | 
             
                    self.http_connections_allowed = VCR::Config.allow_http_connections_when_no_cassette?
         | 
| 65 69 | 
             
                  end
         | 
| 66 70 |  | 
| 67 | 
            -
                  def  | 
| 71 | 
            +
                  def raise_no_checkpoint_error(cassette)
         | 
| 68 72 | 
             
                    raise ArgumentError.new("No checkpoint for #{cassette.inspect} could be found")
         | 
| 69 73 | 
             
                  end
         | 
| 70 74 |  | 
| 75 | 
            +
                  attr_writer :http_connections_allowed
         | 
| 76 | 
            +
             | 
| 77 | 
            +
                  def http_connections_allowed?
         | 
| 78 | 
            +
                    !!@http_connections_allowed
         | 
| 79 | 
            +
                  end
         | 
| 80 | 
            +
             | 
| 81 | 
            +
                  def ignored_hosts=(hosts)
         | 
| 82 | 
            +
                    @ignored_hosts = hosts
         | 
| 83 | 
            +
                  end
         | 
| 84 | 
            +
             | 
| 85 | 
            +
                  def uri_should_be_ignored?(uri)
         | 
| 86 | 
            +
                    uri = URI.parse(uri) unless uri.respond_to?(:host)
         | 
| 87 | 
            +
                    ignored_hosts.include?(uri.host)
         | 
| 88 | 
            +
                  end
         | 
| 89 | 
            +
             | 
| 90 | 
            +
                  def stub_requests(http_interactions, match_attributes)
         | 
| 91 | 
            +
                    match_attributes_stack << match_attributes
         | 
| 92 | 
            +
                    grouped_responses(http_interactions, match_attributes).each do |request_matcher, responses|
         | 
| 93 | 
            +
                      request_matcher = request_matcher_with_normalized_uri(request_matcher)
         | 
| 94 | 
            +
                      queue = stub_queues[request_matcher]
         | 
| 95 | 
            +
                      responses.each { |res| queue << res }
         | 
| 96 | 
            +
                    end
         | 
| 97 | 
            +
                  end
         | 
| 98 | 
            +
             | 
| 99 | 
            +
                  def create_stubs_checkpoint(cassette)
         | 
| 100 | 
            +
                    checkpoints[cassette] = stub_queue_dup
         | 
| 101 | 
            +
                  end
         | 
| 102 | 
            +
             | 
| 103 | 
            +
                  def restore_stubs_checkpoint(cassette)
         | 
| 104 | 
            +
                    match_attributes_stack.pop
         | 
| 105 | 
            +
                    @stub_queues = checkpoints.delete(cassette) || raise_no_checkpoint_error(cassette)
         | 
| 106 | 
            +
                  end
         | 
| 107 | 
            +
             | 
| 108 | 
            +
                  def stubbed_response_for(request)
         | 
| 109 | 
            +
                    return nil unless match_attributes_stack.any?
         | 
| 110 | 
            +
                    request_matcher = request.matcher(match_attributes_stack.last)
         | 
| 111 | 
            +
                    queue = stub_queues[request_matcher]
         | 
| 112 | 
            +
                    return queue.shift if queue.size > 1
         | 
| 113 | 
            +
                    queue.first
         | 
| 114 | 
            +
                  end
         | 
| 115 | 
            +
             | 
| 116 | 
            +
                  def reset!
         | 
| 117 | 
            +
                    instance_variables.each do |ivar|
         | 
| 118 | 
            +
                      remove_instance_variable(ivar)
         | 
| 119 | 
            +
                    end
         | 
| 120 | 
            +
                  end
         | 
| 121 | 
            +
             | 
| 71 122 | 
             
                  private
         | 
| 72 123 |  | 
| 124 | 
            +
                  def ignored_hosts
         | 
| 125 | 
            +
                    @ignored_hosts ||= []
         | 
| 126 | 
            +
                  end
         | 
| 127 | 
            +
             | 
| 128 | 
            +
                  def checkpoints
         | 
| 129 | 
            +
                    @checkpoints ||= {}
         | 
| 130 | 
            +
                  end
         | 
| 131 | 
            +
             | 
| 132 | 
            +
                  def stub_queues
         | 
| 133 | 
            +
                    @stub_queues ||= hash_of_arrays
         | 
| 134 | 
            +
                  end
         | 
| 135 | 
            +
             | 
| 136 | 
            +
                  def match_attributes_stack
         | 
| 137 | 
            +
                    @match_attributes_stack ||= []
         | 
| 138 | 
            +
                  end
         | 
| 139 | 
            +
             | 
| 140 | 
            +
                  def stub_queue_dup
         | 
| 141 | 
            +
                    dup = hash_of_arrays
         | 
| 142 | 
            +
             | 
| 143 | 
            +
                    stub_queues.each do |k, v|
         | 
| 144 | 
            +
                      dup[k] = v.dup
         | 
| 145 | 
            +
                    end
         | 
| 146 | 
            +
             | 
| 147 | 
            +
                    dup
         | 
| 148 | 
            +
                  end
         | 
| 149 | 
            +
             | 
| 150 | 
            +
                  def hash_of_arrays
         | 
| 151 | 
            +
                    Hash.new { |h, k| h[k] = [] }
         | 
| 152 | 
            +
                  end
         | 
| 153 | 
            +
             | 
| 73 154 | 
             
                  def compare_version
         | 
| 74 155 | 
             
                    major,     minor,     patch     = parse_version(version)
         | 
| 75 156 | 
             
                    min_major, min_minor, min_patch = parse_version(self::MINIMUM_VERSION)
         | 
| @@ -102,6 +183,20 @@ module VCR | |
| 102 183 |  | 
| 103 184 | 
             
                    responses
         | 
| 104 185 | 
             
                  end
         | 
| 186 | 
            +
             | 
| 187 | 
            +
                  def normalize_uri(uri)
         | 
| 188 | 
            +
                    uri # adapters can override this
         | 
| 189 | 
            +
                  end
         | 
| 190 | 
            +
             | 
| 191 | 
            +
                  def request_matcher_with_normalized_uri(matcher)
         | 
| 192 | 
            +
                    normalized_uri = normalize_uri(matcher.request.uri)
         | 
| 193 | 
            +
                    return matcher unless matcher.request.uri != normalized_uri
         | 
| 194 | 
            +
             | 
| 195 | 
            +
                    request = matcher.request.dup
         | 
| 196 | 
            +
                    request.uri = normalized_uri
         | 
| 197 | 
            +
             | 
| 198 | 
            +
                    RequestMatcher.new(request, matcher.match_attributes)
         | 
| 199 | 
            +
                  end
         | 
| 105 200 | 
             
                end
         | 
| 106 201 | 
             
              end
         | 
| 107 202 | 
             
            end
         | 
| @@ -11,87 +11,11 @@ module VCR | |
| 11 11 | 
             
                  MINIMUM_VERSION = '0.6.5'
         | 
| 12 12 | 
             
                  MAXIMUM_VERSION = '0.6'
         | 
| 13 13 |  | 
| 14 | 
            -
                  attr_writer :http_connections_allowed
         | 
| 15 | 
            -
             | 
| 16 | 
            -
                  def http_connections_allowed?
         | 
| 17 | 
            -
                    !!@http_connections_allowed
         | 
| 18 | 
            -
                  end
         | 
| 19 | 
            -
             | 
| 20 | 
            -
                  def ignored_hosts=(hosts)
         | 
| 21 | 
            -
                    @ignored_hosts = hosts
         | 
| 22 | 
            -
                  end
         | 
| 23 | 
            -
             | 
| 24 | 
            -
                  def uri_should_be_ignored?(uri)
         | 
| 25 | 
            -
                    uri = URI.parse(uri) unless uri.respond_to?(:host)
         | 
| 26 | 
            -
                    ignored_hosts.include?(uri.host)
         | 
| 27 | 
            -
                  end
         | 
| 28 | 
            -
             | 
| 29 | 
            -
                  def stub_requests(http_interactions, match_attributes)
         | 
| 30 | 
            -
                    match_attributes_stack << match_attributes
         | 
| 31 | 
            -
                    grouped_responses(http_interactions, match_attributes).each do |request_matcher, responses|
         | 
| 32 | 
            -
                      queue = stub_queues[request_matcher]
         | 
| 33 | 
            -
                      responses.each { |res| queue << res }
         | 
| 34 | 
            -
                    end
         | 
| 35 | 
            -
                  end
         | 
| 36 | 
            -
             | 
| 37 | 
            -
                  def create_stubs_checkpoint(cassette)
         | 
| 38 | 
            -
                    checkpoints[cassette] = stub_queue_dup
         | 
| 39 | 
            -
                  end
         | 
| 40 | 
            -
             | 
| 41 | 
            -
                  def restore_stubs_checkpoint(cassette)
         | 
| 42 | 
            -
                    match_attributes_stack.pop
         | 
| 43 | 
            -
                    @stub_queues = checkpoints.delete(cassette) || super
         | 
| 44 | 
            -
                  end
         | 
| 45 | 
            -
             | 
| 46 | 
            -
                  def stubbed_response_for(request)
         | 
| 47 | 
            -
                    return nil unless match_attributes_stack.any?
         | 
| 48 | 
            -
                    request_matcher = request.matcher(match_attributes_stack.last)
         | 
| 49 | 
            -
                    queue = stub_queues[request_matcher]
         | 
| 50 | 
            -
                    return queue.shift if queue.size > 1
         | 
| 51 | 
            -
                    queue.first
         | 
| 52 | 
            -
                  end
         | 
| 53 | 
            -
             | 
| 54 | 
            -
                  def reset!
         | 
| 55 | 
            -
                    instance_variables.each do |ivar|
         | 
| 56 | 
            -
                      remove_instance_variable(ivar)
         | 
| 57 | 
            -
                    end
         | 
| 58 | 
            -
                  end
         | 
| 59 | 
            -
             | 
| 60 14 | 
             
                  private
         | 
| 61 15 |  | 
| 62 | 
            -
             | 
| 63 | 
            -
             | 
| 64 | 
            -
             | 
| 65 | 
            -
             | 
| 66 | 
            -
                    def ignored_hosts
         | 
| 67 | 
            -
                      @ignored_hosts ||= []
         | 
| 68 | 
            -
                    end
         | 
| 69 | 
            -
             | 
| 70 | 
            -
                    def checkpoints
         | 
| 71 | 
            -
                      @checkpoints ||= {}
         | 
| 72 | 
            -
                    end
         | 
| 73 | 
            -
             | 
| 74 | 
            -
                    def stub_queues
         | 
| 75 | 
            -
                      @stub_queues ||= hash_of_arrays
         | 
| 76 | 
            -
                    end
         | 
| 77 | 
            -
             | 
| 78 | 
            -
                    def match_attributes_stack
         | 
| 79 | 
            -
                      @match_attributes_stack ||= []
         | 
| 80 | 
            -
                    end
         | 
| 81 | 
            -
             | 
| 82 | 
            -
                    def stub_queue_dup
         | 
| 83 | 
            -
                      dup = hash_of_arrays
         | 
| 84 | 
            -
             | 
| 85 | 
            -
                      stub_queues.each do |k, v|
         | 
| 86 | 
            -
                        dup[k] = v.dup
         | 
| 87 | 
            -
                      end
         | 
| 88 | 
            -
             | 
| 89 | 
            -
                      dup
         | 
| 90 | 
            -
                    end
         | 
| 91 | 
            -
             | 
| 92 | 
            -
                    def hash_of_arrays
         | 
| 93 | 
            -
                      Hash.new { |h, k| h[k] = [] }
         | 
| 94 | 
            -
                    end
         | 
| 16 | 
            +
                  def version
         | 
| 17 | 
            +
                    ::Excon::VERSION
         | 
| 18 | 
            +
                  end
         | 
| 95 19 |  | 
| 96 20 | 
             
                  class RequestHandler
         | 
| 97 21 | 
             
                    attr_reader :params
         | 
| @@ -44,7 +44,7 @@ module VCR | |
| 44 44 | 
             
                  end
         | 
| 45 45 |  | 
| 46 46 | 
             
                  def restore_stubs_checkpoint(cassette)
         | 
| 47 | 
            -
                    ::FakeWeb::Registry.instance.uri_map = checkpoints.delete(cassette) ||  | 
| 47 | 
            +
                    ::FakeWeb::Registry.instance.uri_map = checkpoints.delete(cassette) || raise_no_checkpoint_error(cassette)
         | 
| 48 48 | 
             
                  end
         | 
| 49 49 |  | 
| 50 50 | 
             
                  def request_stubbed?(request, match_attributes)
         | 
| @@ -9,89 +9,16 @@ module VCR | |
| 9 9 | 
             
                  MINIMUM_VERSION = '0.6.0'
         | 
| 10 10 | 
             
                  MAXIMUM_VERSION = '0.6'
         | 
| 11 11 |  | 
| 12 | 
            -
                   | 
| 13 | 
            -
             | 
| 14 | 
            -
                  def http_connections_allowed?
         | 
| 15 | 
            -
                    !!@http_connections_allowed
         | 
| 16 | 
            -
                  end
         | 
| 17 | 
            -
             | 
| 18 | 
            -
                  def ignored_hosts=(hosts)
         | 
| 19 | 
            -
                    @ignored_hosts = hosts
         | 
| 20 | 
            -
                  end
         | 
| 21 | 
            -
             | 
| 22 | 
            -
                  def uri_should_be_ignored?(uri)
         | 
| 23 | 
            -
                    uri = URI.parse(uri) unless uri.respond_to?(:host)
         | 
| 24 | 
            -
                    ignored_hosts.include?(uri.host)
         | 
| 25 | 
            -
                  end
         | 
| 26 | 
            -
             | 
| 27 | 
            -
                  def stub_requests(http_interactions, match_attributes)
         | 
| 28 | 
            -
                    grouped_responses(http_interactions, match_attributes).each do |request_matcher, responses|
         | 
| 29 | 
            -
                      matcher = request_matcher_with_normalized_uri(request_matcher)
         | 
| 30 | 
            -
                      queue = stub_queues[matcher]
         | 
| 31 | 
            -
                      responses.each { |res| queue << res }
         | 
| 32 | 
            -
                    end
         | 
| 33 | 
            -
                  end
         | 
| 34 | 
            -
             | 
| 35 | 
            -
                  def create_stubs_checkpoint(cassette)
         | 
| 36 | 
            -
                    checkpoints[cassette] = stub_queue_dup
         | 
| 37 | 
            -
                  end
         | 
| 38 | 
            -
             | 
| 39 | 
            -
                  def restore_stubs_checkpoint(cassette)
         | 
| 40 | 
            -
                    @stub_queues = checkpoints.delete(cassette) || super
         | 
| 41 | 
            -
                  end
         | 
| 12 | 
            +
                  private
         | 
| 42 13 |  | 
| 43 | 
            -
                  def  | 
| 44 | 
            -
                     | 
| 45 | 
            -
                    return queue.shift if queue.size > 1
         | 
| 46 | 
            -
                    queue.first
         | 
| 14 | 
            +
                  def version
         | 
| 15 | 
            +
                    ::Faraday::VERSION
         | 
| 47 16 | 
             
                  end
         | 
| 48 17 |  | 
| 49 | 
            -
                  def  | 
| 50 | 
            -
                     | 
| 51 | 
            -
             | 
| 52 | 
            -
                    end
         | 
| 18 | 
            +
                  def normalize_uri(uri)
         | 
| 19 | 
            +
                    # faraday normalizes +'s to %20's
         | 
| 20 | 
            +
                    uri.gsub('+', '%20')
         | 
| 53 21 | 
             
                  end
         | 
| 54 | 
            -
             | 
| 55 | 
            -
                  private
         | 
| 56 | 
            -
             | 
| 57 | 
            -
                    def version
         | 
| 58 | 
            -
                      ::Faraday::VERSION
         | 
| 59 | 
            -
                    end
         | 
| 60 | 
            -
             | 
| 61 | 
            -
                    def ignored_hosts
         | 
| 62 | 
            -
                      @ignored_hosts ||= []
         | 
| 63 | 
            -
                    end
         | 
| 64 | 
            -
             | 
| 65 | 
            -
                    def checkpoints
         | 
| 66 | 
            -
                      @checkpoints ||= {}
         | 
| 67 | 
            -
                    end
         | 
| 68 | 
            -
             | 
| 69 | 
            -
                    def stub_queues
         | 
| 70 | 
            -
                      @stub_queues ||= hash_of_arrays
         | 
| 71 | 
            -
                    end
         | 
| 72 | 
            -
             | 
| 73 | 
            -
                    def stub_queue_dup
         | 
| 74 | 
            -
                      dup = hash_of_arrays
         | 
| 75 | 
            -
             | 
| 76 | 
            -
                      stub_queues.each do |k, v|
         | 
| 77 | 
            -
                        dup[k] = v.dup
         | 
| 78 | 
            -
                      end
         | 
| 79 | 
            -
             | 
| 80 | 
            -
                      dup
         | 
| 81 | 
            -
                    end
         | 
| 82 | 
            -
             | 
| 83 | 
            -
                    def hash_of_arrays
         | 
| 84 | 
            -
                      Hash.new { |h, k| h[k] = [] }
         | 
| 85 | 
            -
                    end
         | 
| 86 | 
            -
             | 
| 87 | 
            -
                    def request_matcher_with_normalized_uri(matcher)
         | 
| 88 | 
            -
                      return matcher unless matcher.uri.is_a?(String) && matcher.uri.include?('+')
         | 
| 89 | 
            -
             | 
| 90 | 
            -
                      request = matcher.request.dup
         | 
| 91 | 
            -
                      request.uri = request.uri.gsub('+', '%20')
         | 
| 92 | 
            -
             | 
| 93 | 
            -
                      RequestMatcher.new(request, matcher.match_attributes)
         | 
| 94 | 
            -
                    end
         | 
| 95 22 | 
             
                end
         | 
| 96 23 | 
             
              end
         | 
| 97 24 | 
             
            end
         | 
| @@ -44,7 +44,15 @@ module VCR | |
| 44 44 | 
             
                  end
         | 
| 45 45 |  | 
| 46 46 | 
             
                  def restore_stubs_checkpoint(cassette)
         | 
| 47 | 
            -
                    ::Typhoeus::Hydra.stubs = checkpoints.delete(cassette) ||  | 
| 47 | 
            +
                    ::Typhoeus::Hydra.stubs = checkpoints.delete(cassette) || raise_no_checkpoint_error(cassette)
         | 
| 48 | 
            +
                  end
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                  def after_adapters_loaded
         | 
| 51 | 
            +
                    # ensure WebMock's Typhoeus adapter does not conflict with us here
         | 
| 52 | 
            +
                    # (i.e. to double record requests or whatever).
         | 
| 53 | 
            +
                    if defined?(::WebMock::HttpLibAdapters::TyphoeusAdapter)
         | 
| 54 | 
            +
                      ::WebMock::HttpLibAdapters::TyphoeusAdapter.disable!
         | 
| 55 | 
            +
                    end
         | 
| 48 56 | 
             
                  end
         | 
| 49 57 |  | 
| 50 58 | 
             
                  private
         | 
| @@ -6,8 +6,8 @@ module VCR | |
| 6 6 | 
             
                  include VCR::HttpStubbingAdapters::Common
         | 
| 7 7 | 
             
                  extend self
         | 
| 8 8 |  | 
| 9 | 
            -
                  MINIMUM_VERSION = '1. | 
| 10 | 
            -
                  MAXIMUM_VERSION = '1. | 
| 9 | 
            +
                  MINIMUM_VERSION = '1.7.0'
         | 
| 10 | 
            +
                  MAXIMUM_VERSION = '1.7'
         | 
| 11 11 |  | 
| 12 12 | 
             
                  def http_connections_allowed=(value)
         | 
| 13 13 | 
             
                    @http_connections_allowed = value
         | 
| @@ -39,7 +39,7 @@ module VCR | |
| 39 39 | 
             
                  end
         | 
| 40 40 |  | 
| 41 41 | 
             
                  def restore_stubs_checkpoint(cassette)
         | 
| 42 | 
            -
                    ::WebMock::StubRegistry.instance.request_stubs = checkpoints.delete(cassette) ||  | 
| 42 | 
            +
                    ::WebMock::StubRegistry.instance.request_stubs = checkpoints.delete(cassette) || raise_no_checkpoint_error(cassette)
         | 
| 43 43 | 
             
                  end
         | 
| 44 44 |  | 
| 45 45 | 
             
                  private
         | 
| @@ -11,11 +11,10 @@ module VCR | |
| 11 11 | 
             
                    VCR::HttpStubbingAdapters::Faraday.exclusively_enabled do
         | 
| 12 12 | 
             
                      VCR.use_cassette(*cassette_arguments(env)) do |cassette|
         | 
| 13 13 | 
             
                        request = request_for(env)
         | 
| 14 | 
            -
                        request_matcher = request.matcher(cassette.match_requests_on)
         | 
| 15 14 |  | 
| 16 15 | 
             
                        if VCR::HttpStubbingAdapters::Faraday.uri_should_be_ignored?(request.uri)
         | 
| 17 16 | 
             
                          @app.call(env)
         | 
| 18 | 
            -
                        elsif response = VCR::HttpStubbingAdapters::Faraday.stubbed_response_for( | 
| 17 | 
            +
                        elsif response = VCR::HttpStubbingAdapters::Faraday.stubbed_response_for(request)
         | 
| 19 18 | 
             
                          headers = env[:response_headers] ||= ::Faraday::Utils::Headers.new
         | 
| 20 19 | 
             
                          headers.update response.headers if response.headers
         | 
| 21 20 | 
             
                          env.update :status => response.status.code, :body => response.body
         | 
    
        data/lib/vcr/version.rb
    CHANGED
    
    
    
        data/spec/monkey_patches.rb
    CHANGED
    
    | @@ -12,9 +12,14 @@ module MonkeyPatches | |
| 12 12 |  | 
| 13 13 | 
             
              def enable!(scope)
         | 
| 14 14 | 
             
                case scope
         | 
| 15 | 
            -
                  when : | 
| 16 | 
            -
                     | 
| 17 | 
            -
             | 
| 15 | 
            +
                  when :fakeweb
         | 
| 16 | 
            +
                    realias_all :with_fakeweb
         | 
| 17 | 
            +
                    enable!(:vcr) # fakeweb adapter relies upon VCR's Net::HTTP monkey patch
         | 
| 18 | 
            +
                  when :webmock
         | 
| 19 | 
            +
                    ::WebMock::HttpLibAdapters::NetHttpAdapter.enable!
         | 
| 20 | 
            +
                    ::WebMock::HttpLibAdapters::TyphoeusAdapter.enable! unless RUBY_INTERPRETER == :jruby
         | 
| 21 | 
            +
                    $original_webmock_callbacks.each do |cb|
         | 
| 22 | 
            +
                      ::WebMock::CallbackRegistry.add_callback(cb[:options], cb[:block])
         | 
| 18 23 | 
             
                    end
         | 
| 19 24 | 
             
                  when :vcr
         | 
| 20 25 | 
             
                    realias Net::HTTP, :request, :with_vcr
         | 
| @@ -22,15 +27,13 @@ module MonkeyPatches | |
| 22 27 | 
             
                end
         | 
| 23 28 | 
             
              end
         | 
| 24 29 |  | 
| 25 | 
            -
              def  | 
| 26 | 
            -
                 | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
                   | 
| 32 | 
            -
                    realias Net::HTTP, :request, :without_vcr
         | 
| 33 | 
            -
                  else raise ArgumentError.new("Unexpected scope: #{scope}")
         | 
| 30 | 
            +
              def disable_all!
         | 
| 31 | 
            +
                realias_all :without_monkeypatches
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                if defined?(::WebMock)
         | 
| 34 | 
            +
                  ::WebMock::HttpLibAdapters::NetHttpAdapter.disable!
         | 
| 35 | 
            +
                  ::WebMock::HttpLibAdapters::TyphoeusAdapter.disable! unless RUBY_INTERPRETER == :jruby
         | 
| 36 | 
            +
                  ::WebMock::CallbackRegistry.reset
         | 
| 34 37 | 
             
                end
         | 
| 35 38 | 
             
              end
         | 
| 36 39 |  | 
| @@ -45,13 +48,7 @@ module MonkeyPatches | |
| 45 48 |  | 
| 46 49 | 
             
              def capture_method_definition(klass, method, original)
         | 
| 47 50 | 
             
                klass.class_eval do
         | 
| 48 | 
            -
                  monkeypatch_methods = [
         | 
| 49 | 
            -
                    :with_vcr,     :without_vcr,
         | 
| 50 | 
            -
                    :with_fakeweb, :without_fakeweb,
         | 
| 51 | 
            -
                    :with_webmock, :without_webmock
         | 
| 52 | 
            -
                  ].select do |m|
         | 
| 53 | 
            -
                    method_defined?(:"#{method}_#{m}")
         | 
| 54 | 
            -
                  end
         | 
| 51 | 
            +
                  monkeypatch_methods = [:vcr, :fakeweb].select { |m| method_defined?(:"#{method}_with_#{m}") }
         | 
| 55 52 |  | 
| 56 53 | 
             
                  if original
         | 
| 57 54 | 
             
                    if monkeypatch_methods.size > 0
         | 
| @@ -78,6 +75,12 @@ module MonkeyPatches | |
| 78 75 | 
             
              def realias(klass, method, alias_extension)
         | 
| 79 76 | 
             
                klass.class_eval { alias_method method, :"#{method}_#{alias_extension}" }
         | 
| 80 77 | 
             
              end
         | 
| 78 | 
            +
             | 
| 79 | 
            +
              def realias_all(alias_extension)
         | 
| 80 | 
            +
                MONKEY_PATCHES.each do |mp|
         | 
| 81 | 
            +
                  realias mp.first, mp.last, alias_extension
         | 
| 82 | 
            +
                end
         | 
| 83 | 
            +
              end
         | 
| 81 84 | 
             
            end
         | 
| 82 85 |  | 
| 83 86 | 
             
            # Require all the HTTP libraries--these must be required before WebMock
         | 
| @@ -91,13 +94,26 @@ if RUBY_INTERPRETER == :mri | |
| 91 94 | 
             
              require 'typhoeus'
         | 
| 92 95 | 
             
            end
         | 
| 93 96 |  | 
| 94 | 
            -
            # The FakeWeb adapter must be required after WebMock's so
         | 
| 95 | 
            -
            # that VCR's Net::HTTP monkey patch is loaded last.
         | 
| 96 | 
            -
            # This allows us to disable it (i.e. by realiasing to
         | 
| 97 | 
            -
            # the version of Net::HTTP's methods before it was loaded)
         | 
| 98 | 
            -
            require 'vcr/http_stubbing_adapters/webmock'
         | 
| 99 97 | 
             
            require 'vcr/http_stubbing_adapters/fakeweb'
         | 
| 100 98 |  | 
| 101 99 | 
             
            # All Net::HTTP monkey patches have now been loaded, so capture the
         | 
| 102 100 | 
             
            # appropriate method definitions so we can disable them later.
         | 
| 103 101 | 
             
            MonkeyPatches.init
         | 
| 102 | 
            +
             | 
| 103 | 
            +
            # Disable FakeWeb/VCR Net::HTTP patches before WebMock
         | 
| 104 | 
            +
            # subclasses Net::HTTP and inherits them...
         | 
| 105 | 
            +
            MonkeyPatches.disable_all!
         | 
| 106 | 
            +
             | 
| 107 | 
            +
            require 'vcr/http_stubbing_adapters/webmock'
         | 
| 108 | 
            +
            $original_webmock_callbacks = ::WebMock::CallbackRegistry.callbacks
         | 
| 109 | 
            +
             | 
| 110 | 
            +
            # disable all by default; we'll enable specific ones when we need them
         | 
| 111 | 
            +
            MonkeyPatches.disable_all!
         | 
| 112 | 
            +
             | 
| 113 | 
            +
            RSpec.configure do |config|
         | 
| 114 | 
            +
              [:fakeweb, :webmock, :vcr].each do |scope|
         | 
| 115 | 
            +
                config.before(:all, :with_monkey_patches => scope) { MonkeyPatches.enable!(scope) }
         | 
| 116 | 
            +
                config.after(:all,  :with_monkey_patches => scope) { MonkeyPatches.disable_all!   }
         | 
| 117 | 
            +
              end
         | 
| 118 | 
            +
            end
         | 
| 119 | 
            +
             | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | @@ -41,7 +41,7 @@ end | |
| 41 41 |  | 
| 42 42 | 
             
            RSpec.configure do |config|
         | 
| 43 43 | 
             
              config.color_enabled = true
         | 
| 44 | 
            -
              config.debug = (using_git && RUBY_INTERPRETER == :mri && RUBY_VERSION != '1.9.1')
         | 
| 44 | 
            +
              config.debug = (using_git && RUBY_INTERPRETER == :mri && RUBY_VERSION != '1.9.1' && !ENV['CI'])
         | 
| 45 45 | 
             
              config.treat_symbols_as_metadata_keys_with_true_values = true
         | 
| 46 46 |  | 
| 47 47 | 
             
              tmp_dir = File.expand_path('../../tmp/cassette_library_dir', __FILE__)
         | 
| @@ -78,22 +78,6 @@ RSpec.configure do |config| | |
| 78 78 | 
             
                $stderr = @orig_std_err
         | 
| 79 79 | 
             
              end
         | 
| 80 80 |  | 
| 81 | 
            -
              config.before(:all, :without_webmock_callbacks => true) do
         | 
| 82 | 
            -
                @original_webmock_callbacks = ::WebMock::CallbackRegistry.callbacks
         | 
| 83 | 
            -
                ::WebMock::CallbackRegistry.reset
         | 
| 84 | 
            -
              end
         | 
| 85 | 
            -
             | 
| 86 | 
            -
              config.after(:all, :without_webmock_callbacks => true) do
         | 
| 87 | 
            -
                @original_webmock_callbacks.each do |cb|
         | 
| 88 | 
            -
                  ::WebMock::CallbackRegistry.add_callback(cb[:options], cb[:block])
         | 
| 89 | 
            -
                end
         | 
| 90 | 
            -
              end
         | 
| 91 | 
            -
             | 
| 92 | 
            -
              [:all, :vcr].each do |scope|
         | 
| 93 | 
            -
                config.before(:each, :without_monkey_patches => scope) { MonkeyPatches.disable!(scope) }
         | 
| 94 | 
            -
                config.after(:each, :without_monkey_patches => scope)  { MonkeyPatches.enable!(scope)  }
         | 
| 95 | 
            -
              end
         | 
| 96 | 
            -
             | 
| 97 81 | 
             
              config.filter_run :focus => true
         | 
| 98 82 | 
             
              config.run_all_when_everything_filtered = true
         | 
| 99 83 |  | 
| @@ -41,7 +41,7 @@ module VCR | |
| 41 41 | 
             
                def boot
         | 
| 42 42 | 
             
                  # Use WEBrick since it's part of the ruby standard library and is available on all ruby interpreters.
         | 
| 43 43 | 
             
                  options = { :Port => port }
         | 
| 44 | 
            -
                  options.merge!(:AccessLog => [], :Logger => WEBrick::BasicLog.new(StringIO.new)) unless ENV[' | 
| 44 | 
            +
                  options.merge!(:AccessLog => [], :Logger => WEBrick::BasicLog.new(StringIO.new)) unless ENV['VERBOSE_SERVER']
         | 
| 45 45 | 
             
                  Rack::Handler::WEBrick.run(Identify.new(@rack_app), options)
         | 
| 46 46 | 
             
                end
         | 
| 47 47 |  | 
    
        data/spec/vcr/cassette_spec.rb
    CHANGED
    
    | @@ -449,7 +449,7 @@ describe VCR::Cassette do | |
| 449 449 | 
             
                        end
         | 
| 450 450 |  | 
| 451 451 | 
             
                        it "matches old requests to new ones using the cassette's match attributes" do
         | 
| 452 | 
            -
                          pending("Need to fix this to work with Psych", :if => defined?(::Psych) | 
| 452 | 
            +
                          pending("Need to fix this to work with Psych", :if => defined?(::Psych)) do
         | 
| 453 453 | 
             
                            [
         | 
| 454 454 | 
             
                              old_interaction_1, old_interaction_2, old_interaction_3,
         | 
| 455 455 | 
             
                              new_interaction_1, new_interaction_2, new_interaction_3
         | 
| @@ -459,7 +459,7 @@ describe VCR::Cassette do | |
| 459 459 |  | 
| 460 460 | 
             
                            subject.eject
         | 
| 461 461 | 
             
                          end
         | 
| 462 | 
            -
                        end
         | 
| 462 | 
            +
                        end unless ENV['CI']
         | 
| 463 463 | 
             
                      else
         | 
| 464 464 | 
             
                        it 'saves the old interactions followed by the new ones to disk' do
         | 
| 465 465 | 
             
                          subject.eject
         | 
| @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            require 'spec_helper'
         | 
| 2 2 |  | 
| 3 | 
            -
            describe VCR::Net::HTTPResponse | 
| 3 | 
            +
            describe VCR::Net::HTTPResponse do
         | 
| 4 4 | 
             
              def self.it_allows_the_body_to_be_read(expected_regex)
         | 
| 5 5 | 
             
                it 'allows the body to be read using #body' do
         | 
| 6 6 | 
             
                  response.body.to_s.should =~ expected_regex
         | 
| @@ -54,7 +54,7 @@ describe VCR::Net::HTTPResponse, :without_monkey_patches => :all do | |
| 54 54 | 
             
                      http = Net::HTTP.new('localhost', VCR::SinatraApp.port)
         | 
| 55 55 | 
             
                      res = http.send(http_verb_method, '/', &block)
         | 
| 56 56 | 
             
                      res.should_not be_a(VCR::Net::HTTPResponse)
         | 
| 57 | 
            -
                      res.should_not be_a(:: | 
| 57 | 
            +
                      res.should_not be_a(::Net::WebMockHTTPResponse)
         | 
| 58 58 | 
             
                      res
         | 
| 59 59 | 
             
                    end
         | 
| 60 60 | 
             
                  end
         | 
| @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            require 'spec_helper'
         | 
| 2 2 |  | 
| 3 | 
            -
            describe "Net::HTTP Extensions", : | 
| 3 | 
            +
            describe "Net::HTTP Extensions", :with_monkey_patches => :vcr do
         | 
| 4 4 | 
             
              before(:all) { VCR::SinatraApp.port } # ensure the server is started before instantiating any Net::HTTP instances
         | 
| 5 5 |  | 
| 6 6 | 
             
              let(:uri) { URI.parse("http://localhost:#{VCR::SinatraApp.port}/") }
         | 
| @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            require 'spec_helper'
         | 
| 2 2 |  | 
| 3 | 
            -
            describe VCR::HttpStubbingAdapters::FakeWeb, : | 
| 3 | 
            +
            describe VCR::HttpStubbingAdapters::FakeWeb, :with_monkey_patches => :fakeweb do
         | 
| 4 4 | 
             
              it_behaves_like 'an http stubbing adapter', ['net/http'], [:method, :uri, :host, :path], :needs_net_http_extension
         | 
| 5 5 |  | 
| 6 6 | 
             
              it_performs('version checking',
         | 
| @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            require 'spec_helper'
         | 
| 2 2 |  | 
| 3 | 
            -
            describe VCR::HttpStubbingAdapters::Faraday | 
| 3 | 
            +
            describe VCR::HttpStubbingAdapters::Faraday do
         | 
| 4 4 | 
             
              it_behaves_like 'an http stubbing adapter',
         | 
| 5 5 | 
             
                %w[ faraday-typhoeus faraday-net_http faraday-patron ],
         | 
| 6 6 | 
             
                [:method, :uri, :host, :path, :body, :headers],
         | 
| @@ -27,8 +27,7 @@ describe VCR::HttpStubbingAdapters::Faraday, :without_monkey_patches => :all do | |
| 27 27 | 
             
                let(:match_attributes) { [:method, :uri] }
         | 
| 28 28 |  | 
| 29 29 | 
             
                def stubbed_response_for(request)
         | 
| 30 | 
            -
                   | 
| 31 | 
            -
                  subject.stubbed_response_for(matcher)
         | 
| 30 | 
            +
                  subject.stubbed_response_for(request)
         | 
| 32 31 | 
             
                end
         | 
| 33 32 |  | 
| 34 33 | 
             
                before(:each) do
         | 
| @@ -72,12 +71,6 @@ describe VCR::HttpStubbingAdapters::Faraday, :without_monkey_patches => :all do | |
| 72 71 | 
             
                    subject.restore_stubs_checkpoint(cassette_1)
         | 
| 73 72 | 
             
                    test_stubbed_responses
         | 
| 74 73 | 
             
                  end
         | 
| 75 | 
            -
             | 
| 76 | 
            -
                  it 'restores the queues to the checkpoint state when a queue has been used' do
         | 
| 77 | 
            -
                    stubbed_response_for(request_1)
         | 
| 78 | 
            -
                    subject.restore_stubs_checkpoint(cassette_1)
         | 
| 79 | 
            -
                    test_stubbed_responses
         | 
| 80 | 
            -
                  end
         | 
| 81 74 | 
             
                end
         | 
| 82 75 | 
             
              end
         | 
| 83 76 | 
             
            end
         | 
| @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            require 'spec_helper'
         | 
| 2 2 |  | 
| 3 | 
            -
            describe VCR::HttpStubbingAdapters::Typhoeus | 
| 3 | 
            +
            describe VCR::HttpStubbingAdapters::Typhoeus do
         | 
| 4 4 | 
             
              before(:each) do
         | 
| 5 5 | 
             
                ::Typhoeus::Hydra.stubs = []
         | 
| 6 6 | 
             
                ::Typhoeus::Hydra.allow_net_connect = true
         | 
| @@ -21,5 +21,12 @@ describe VCR::HttpStubbingAdapters::Typhoeus, :without_monkey_patches => :vcr do | |
| 21 21 | 
             
                  Typhoeus::VERSION = version
         | 
| 22 22 | 
             
                end
         | 
| 23 23 | 
             
              end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
              describe ".after_adapters_loaded" do
         | 
| 26 | 
            +
                it 'disables the webmock typhoeus adapter so it does not conflict with our typhoeus adapter' do
         | 
| 27 | 
            +
                  ::WebMock::HttpLibAdapters::TyphoeusAdapter.should_receive(:disable!)
         | 
| 28 | 
            +
                  described_class.after_adapters_loaded
         | 
| 29 | 
            +
                end
         | 
| 30 | 
            +
              end
         | 
| 24 31 | 
             
            end unless RUBY_PLATFORM == 'java'
         | 
| 25 32 |  | 
| @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            require 'spec_helper'
         | 
| 2 2 |  | 
| 3 | 
            -
            describe VCR::HttpStubbingAdapters::WebMock, : | 
| 3 | 
            +
            describe VCR::HttpStubbingAdapters::WebMock, :with_monkey_patches => :webmock do
         | 
| 4 4 | 
             
              it_behaves_like 'an http stubbing adapter',
         | 
| 5 5 | 
             
                %w[net/http patron httpclient em-http-request curb],
         | 
| 6 6 | 
             
                [:method, :uri, :host, :path, :body, :headers]
         | 
| 7 7 |  | 
| 8 8 | 
             
              it_performs('version checking',
         | 
| 9 | 
            -
                :valid    => %w[ 1. | 
| 10 | 
            -
                :too_low  => %w[ 0.9.9 0.9.10 0.1.30 1.0.30 1. | 
| 11 | 
            -
                :too_high => %w[ 1. | 
| 9 | 
            +
                :valid    => %w[ 1.7.0 1.7.99 ],
         | 
| 10 | 
            +
                :too_low  => %w[ 0.9.9 0.9.10 0.1.30 1.0.30 1.6.9 ],
         | 
| 11 | 
            +
                :too_high => %w[ 1.8.0 1.10.0 2.0.0 ]
         | 
| 12 12 | 
             
              ) do
         | 
| 13 13 | 
             
                def stub_version(version)
         | 
| 14 14 | 
             
                  WebMock.stub(:version).and_return(version)
         | 
    
        data/spec/vcr_spec.rb
    CHANGED
    
    | @@ -156,6 +156,12 @@ describe VCR do | |
| 156 156 | 
             
                  end
         | 
| 157 157 | 
             
                end
         | 
| 158 158 |  | 
| 159 | 
            +
                it 'calls #after_adapters_loaded on the configured stubbing adapter' do
         | 
| 160 | 
            +
                  VCR::HttpStubbingAdapters::FakeWeb.should_receive(:after_adapters_loaded)
         | 
| 161 | 
            +
                  VCR::Config.stub_with :fakeweb
         | 
| 162 | 
            +
                  VCR.http_stubbing_adapter
         | 
| 163 | 
            +
                end
         | 
| 164 | 
            +
             | 
| 159 165 | 
             
                it 'raises an error if both :fakeweb and :webmock are configured' do
         | 
| 160 166 | 
             
                  VCR::Config.stub_with :fakeweb, :webmock
         | 
| 161 167 |  | 
    
        data/vcr.gemspec
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version | |
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
              segments: 
         | 
| 7 7 | 
             
              - 1
         | 
| 8 | 
            -
              -  | 
| 9 | 
            -
              -  | 
| 10 | 
            -
              version: 1. | 
| 8 | 
            +
              - 11
         | 
| 9 | 
            +
              - 1
         | 
| 10 | 
            +
              version: 1.11.1
         | 
| 11 11 | 
             
            platform: ruby
         | 
| 12 12 | 
             
            authors: 
         | 
| 13 13 | 
             
            - Myron Marston
         | 
| @@ -15,8 +15,7 @@ autorequire: | |
| 15 15 | 
             
            bindir: bin
         | 
| 16 16 | 
             
            cert_chain: []
         | 
| 17 17 |  | 
| 18 | 
            -
            date: 2011- | 
| 19 | 
            -
            default_executable: 
         | 
| 18 | 
            +
            date: 2011-08-19 00:00:00 Z
         | 
| 20 19 | 
             
            dependencies: 
         | 
| 21 20 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 22 21 | 
             
              version_requirements: &id001 !ruby/object:Gem::Requirement 
         | 
| @@ -30,10 +29,10 @@ dependencies: | |
| 30 29 | 
             
                    - 7
         | 
| 31 30 | 
             
                    - 2
         | 
| 32 31 | 
             
                    version: 0.7.2
         | 
| 33 | 
            -
              requirement: *id001
         | 
| 34 | 
            -
              prerelease: false
         | 
| 35 32 | 
             
              name: faraday
         | 
| 36 33 | 
             
              type: :development
         | 
| 34 | 
            +
              prerelease: false
         | 
| 35 | 
            +
              requirement: *id001
         | 
| 37 36 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 38 37 | 
             
              version_requirements: &id002 !ruby/object:Gem::Requirement 
         | 
| 39 38 | 
             
                none: false
         | 
| @@ -46,10 +45,10 @@ dependencies: | |
| 46 45 | 
             
                    - 3
         | 
| 47 46 | 
             
                    - 0
         | 
| 48 47 | 
             
                    version: 1.3.0
         | 
| 49 | 
            -
              requirement: *id002
         | 
| 50 | 
            -
              prerelease: false
         | 
| 51 48 | 
             
              name: fakeweb
         | 
| 52 49 | 
             
              type: :development
         | 
| 50 | 
            +
              prerelease: false
         | 
| 51 | 
            +
              requirement: *id002
         | 
| 53 52 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 54 53 | 
             
              version_requirements: &id003 !ruby/object:Gem::Requirement 
         | 
| 55 54 | 
             
                none: false
         | 
| @@ -63,10 +62,10 @@ dependencies: | |
| 63 62 | 
             
                    - 5
         | 
| 64 63 | 
             
                    - 2
         | 
| 65 64 | 
             
                    version: 2.1.5.2
         | 
| 66 | 
            -
              requirement: *id003
         | 
| 67 | 
            -
              prerelease: false
         | 
| 68 65 | 
             
              name: httpclient
         | 
| 69 66 | 
             
              type: :development
         | 
| 67 | 
            +
              prerelease: false
         | 
| 68 | 
            +
              requirement: *id003
         | 
| 70 69 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 71 70 | 
             
              version_requirements: &id004 !ruby/object:Gem::Requirement 
         | 
| 72 71 | 
             
                none: false
         | 
| @@ -79,10 +78,10 @@ dependencies: | |
| 79 78 | 
             
                    - 8
         | 
| 80 79 | 
             
                    - 7
         | 
| 81 80 | 
             
                    version: 0.8.7
         | 
| 82 | 
            -
              requirement: *id004
         | 
| 83 | 
            -
              prerelease: false
         | 
| 84 81 | 
             
              name: rake
         | 
| 85 82 | 
             
              type: :development
         | 
| 83 | 
            +
              prerelease: false
         | 
| 84 | 
            +
              requirement: *id004
         | 
| 86 85 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 87 86 | 
             
              version_requirements: &id005 !ruby/object:Gem::Requirement 
         | 
| 88 87 | 
             
                none: false
         | 
| @@ -95,10 +94,10 @@ dependencies: | |
| 95 94 | 
             
                    - 3
         | 
| 96 95 | 
             
                    - 5
         | 
| 97 96 | 
             
                    version: 0.3.5
         | 
| 98 | 
            -
              requirement: *id005
         | 
| 99 | 
            -
              prerelease: false
         | 
| 100 97 | 
             
              name: timecop
         | 
| 101 98 | 
             
              type: :development
         | 
| 99 | 
            +
              prerelease: false
         | 
| 100 | 
            +
              requirement: *id005
         | 
| 102 101 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 103 102 | 
             
              version_requirements: &id006 !ruby/object:Gem::Requirement 
         | 
| 104 103 | 
             
                none: false
         | 
| @@ -111,10 +110,10 @@ dependencies: | |
| 111 110 | 
             
                    - 2
         | 
| 112 111 | 
             
                    - 6
         | 
| 113 112 | 
             
                    version: 2.2.6
         | 
| 114 | 
            -
              requirement: *id006
         | 
| 115 | 
            -
              prerelease: false
         | 
| 116 113 | 
             
              name: addressable
         | 
| 117 114 | 
             
              type: :development
         | 
| 115 | 
            +
              prerelease: false
         | 
| 116 | 
            +
              requirement: *id006
         | 
| 118 117 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 119 118 | 
             
              version_requirements: &id007 !ruby/object:Gem::Requirement 
         | 
| 120 119 | 
             
                none: false
         | 
| @@ -127,10 +126,10 @@ dependencies: | |
| 127 126 | 
             
                    - 9
         | 
| 128 127 | 
             
                    - 2
         | 
| 129 128 | 
             
                    version: 2.9.2
         | 
| 130 | 
            -
              requirement: *id007
         | 
| 131 | 
            -
              prerelease: false
         | 
| 132 129 | 
             
              name: shoulda
         | 
| 133 130 | 
             
              type: :development
         | 
| 131 | 
            +
              prerelease: false
         | 
| 132 | 
            +
              requirement: *id007
         | 
| 134 133 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 135 134 | 
             
              version_requirements: &id008 !ruby/object:Gem::Requirement 
         | 
| 136 135 | 
             
                none: false
         | 
| @@ -142,10 +141,10 @@ dependencies: | |
| 142 141 | 
             
                    - 2
         | 
| 143 142 | 
             
                    - 6
         | 
| 144 143 | 
             
                    version: "2.6"
         | 
| 145 | 
            -
              requirement: *id008
         | 
| 146 | 
            -
              prerelease: false
         | 
| 147 144 | 
             
              name: rspec
         | 
| 148 145 | 
             
              type: :development
         | 
| 146 | 
            +
              prerelease: false
         | 
| 147 | 
            +
              requirement: *id008
         | 
| 149 148 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 150 149 | 
             
              version_requirements: &id009 !ruby/object:Gem::Requirement 
         | 
| 151 150 | 
             
                none: false
         | 
| @@ -158,10 +157,10 @@ dependencies: | |
| 158 157 | 
             
                    - 1
         | 
| 159 158 | 
             
                    - 0
         | 
| 160 159 | 
             
                    version: 1.1.0
         | 
| 161 | 
            -
              requirement: *id009
         | 
| 162 | 
            -
              prerelease: false
         | 
| 163 160 | 
             
              name: rack
         | 
| 164 161 | 
             
              type: :development
         | 
| 162 | 
            +
              prerelease: false
         | 
| 163 | 
            +
              requirement: *id009
         | 
| 165 164 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 166 165 | 
             
              version_requirements: &id010 !ruby/object:Gem::Requirement 
         | 
| 167 166 | 
             
                none: false
         | 
| @@ -174,10 +173,10 @@ dependencies: | |
| 174 173 | 
             
                    - 2
         | 
| 175 174 | 
             
                    - 4
         | 
| 176 175 | 
             
                    version: 0.2.4
         | 
| 177 | 
            -
              requirement: *id010
         | 
| 178 | 
            -
              prerelease: false
         | 
| 179 176 | 
             
              name: aruba
         | 
| 180 177 | 
             
              type: :development
         | 
| 178 | 
            +
              prerelease: false
         | 
| 179 | 
            +
              requirement: *id010
         | 
| 181 180 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 182 181 | 
             
              version_requirements: &id011 !ruby/object:Gem::Requirement 
         | 
| 183 182 | 
             
                none: false
         | 
| @@ -190,10 +189,10 @@ dependencies: | |
| 190 189 | 
             
                    - 1
         | 
| 191 190 | 
             
                    - 0
         | 
| 192 191 | 
             
                    version: 1.1.0
         | 
| 193 | 
            -
              requirement: *id011
         | 
| 194 | 
            -
              prerelease: false
         | 
| 195 192 | 
             
              name: sinatra
         | 
| 196 193 | 
             
              type: :development
         | 
| 194 | 
            +
              prerelease: false
         | 
| 195 | 
            +
              requirement: *id011
         | 
| 197 196 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 198 197 | 
             
              version_requirements: &id012 !ruby/object:Gem::Requirement 
         | 
| 199 198 | 
             
                none: false
         | 
| @@ -206,10 +205,10 @@ dependencies: | |
| 206 205 | 
             
                    - 0
         | 
| 207 206 | 
             
                    - 7
         | 
| 208 207 | 
             
                    version: 1.0.7
         | 
| 209 | 
            -
              requirement: *id012
         | 
| 210 | 
            -
              prerelease: false
         | 
| 211 208 | 
             
              name: bundler
         | 
| 212 209 | 
             
              type: :development
         | 
| 210 | 
            +
              prerelease: false
         | 
| 211 | 
            +
              requirement: *id012
         | 
| 213 212 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 214 213 | 
             
              version_requirements: &id013 !ruby/object:Gem::Requirement 
         | 
| 215 214 | 
             
                none: false
         | 
| @@ -222,10 +221,10 @@ dependencies: | |
| 222 221 | 
             
                    - 6
         | 
| 223 222 | 
             
                    - 5
         | 
| 224 223 | 
             
                    version: 0.6.5
         | 
| 225 | 
            -
              requirement: *id013
         | 
| 226 | 
            -
              prerelease: false
         | 
| 227 224 | 
             
              name: excon
         | 
| 228 225 | 
             
              type: :development
         | 
| 226 | 
            +
              prerelease: false
         | 
| 227 | 
            +
              requirement: *id013
         | 
| 229 228 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 230 229 | 
             
              version_requirements: &id014 !ruby/object:Gem::Requirement 
         | 
| 231 230 | 
             
                none: false
         | 
| @@ -238,26 +237,26 @@ dependencies: | |
| 238 237 | 
             
                    - 9
         | 
| 239 238 | 
             
                    - 4
         | 
| 240 239 | 
             
                    version: 0.9.4
         | 
| 241 | 
            -
              requirement: *id014
         | 
| 242 | 
            -
              prerelease: false
         | 
| 243 240 | 
             
              name: cucumber
         | 
| 244 241 | 
             
              type: :development
         | 
| 242 | 
            +
              prerelease: false
         | 
| 243 | 
            +
              requirement: *id014
         | 
| 245 244 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 246 245 | 
             
              version_requirements: &id015 !ruby/object:Gem::Requirement 
         | 
| 247 246 | 
             
                none: false
         | 
| 248 247 | 
             
                requirements: 
         | 
| 249 248 | 
             
                - - ~>
         | 
| 250 249 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 251 | 
            -
                    hash:  | 
| 250 | 
            +
                    hash: 3
         | 
| 252 251 | 
             
                    segments: 
         | 
| 253 252 | 
             
                    - 1
         | 
| 254 | 
            -
                    -  | 
| 253 | 
            +
                    - 7
         | 
| 255 254 | 
             
                    - 4
         | 
| 256 | 
            -
                    version: 1. | 
| 257 | 
            -
              requirement: *id015
         | 
| 258 | 
            -
              prerelease: false
         | 
| 255 | 
            +
                    version: 1.7.4
         | 
| 259 256 | 
             
              name: webmock
         | 
| 260 257 | 
             
              type: :development
         | 
| 258 | 
            +
              prerelease: false
         | 
| 259 | 
            +
              requirement: *id015
         | 
| 261 260 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 262 261 | 
             
              version_requirements: &id016 !ruby/object:Gem::Requirement 
         | 
| 263 262 | 
             
                none: false
         | 
| @@ -270,10 +269,10 @@ dependencies: | |
| 270 269 | 
             
                    - 7
         | 
| 271 270 | 
             
                    - 8
         | 
| 272 271 | 
             
                    version: 0.7.8
         | 
| 273 | 
            -
              requirement: *id016
         | 
| 274 | 
            -
              prerelease: false
         | 
| 275 272 | 
             
              name: curb
         | 
| 276 273 | 
             
              type: :development
         | 
| 274 | 
            +
              prerelease: false
         | 
| 275 | 
            +
              requirement: *id016
         | 
| 277 276 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 278 277 | 
             
              version_requirements: &id017 !ruby/object:Gem::Requirement 
         | 
| 279 278 | 
             
                none: false
         | 
| @@ -286,10 +285,10 @@ dependencies: | |
| 286 285 | 
             
                    - 4
         | 
| 287 286 | 
             
                    - 9
         | 
| 288 287 | 
             
                    version: 0.4.9
         | 
| 289 | 
            -
              requirement: *id017
         | 
| 290 | 
            -
              prerelease: false
         | 
| 291 288 | 
             
              name: patron
         | 
| 292 289 | 
             
              type: :development
         | 
| 290 | 
            +
              prerelease: false
         | 
| 291 | 
            +
              requirement: *id017
         | 
| 293 292 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 294 293 | 
             
              version_requirements: &id018 !ruby/object:Gem::Requirement 
         | 
| 295 294 | 
             
                none: false
         | 
| @@ -302,10 +301,10 @@ dependencies: | |
| 302 301 | 
             
                    - 3
         | 
| 303 302 | 
             
                    - 0
         | 
| 304 303 | 
             
                    version: 0.3.0
         | 
| 305 | 
            -
              requirement: *id018
         | 
| 306 | 
            -
              prerelease: false
         | 
| 307 304 | 
             
              name: em-http-request
         | 
| 308 305 | 
             
              type: :development
         | 
| 306 | 
            +
              prerelease: false
         | 
| 307 | 
            +
              requirement: *id018
         | 
| 309 308 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 310 309 | 
             
              version_requirements: &id019 !ruby/object:Gem::Requirement 
         | 
| 311 310 | 
             
                none: false
         | 
| @@ -318,10 +317,10 @@ dependencies: | |
| 318 317 | 
             
                    - 2
         | 
| 319 318 | 
             
                    - 1
         | 
| 320 319 | 
             
                    version: 0.2.1
         | 
| 321 | 
            -
              requirement: *id019
         | 
| 322 | 
            -
              prerelease: false
         | 
| 323 320 | 
             
              name: typhoeus
         | 
| 324 321 | 
             
              type: :development
         | 
| 322 | 
            +
              prerelease: false
         | 
| 323 | 
            +
              requirement: *id019
         | 
| 325 324 | 
             
            description: VCR provides a simple API to record and replay your test suite's HTTP interactions.  It works with a variety of HTTP client libraries, HTTP stubbing libraries and testing frameworks.
         | 
| 326 325 | 
             
            email: myron.marston@gmail.com
         | 
| 327 326 | 
             
            executables: []
         | 
| @@ -485,7 +484,6 @@ files: | |
| 485 484 | 
             
            - spec/vcr/version_spec.rb
         | 
| 486 485 | 
             
            - spec/vcr_spec.rb
         | 
| 487 486 | 
             
            - vcr.gemspec
         | 
| 488 | 
            -
            has_rdoc: true
         | 
| 489 487 | 
             
            homepage: http://github.com/myronmarston/vcr
         | 
| 490 488 | 
             
            licenses: []
         | 
| 491 489 |  | 
| @@ -519,7 +517,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 519 517 | 
             
            requirements: []
         | 
| 520 518 |  | 
| 521 519 | 
             
            rubyforge_project: 
         | 
| 522 | 
            -
            rubygems_version: 1.6 | 
| 520 | 
            +
            rubygems_version: 1.8.6
         | 
| 523 521 | 
             
            signing_key: 
         | 
| 524 522 | 
             
            specification_version: 3
         | 
| 525 523 | 
             
            summary: Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.
         |