Sha256: 6fcbc9fba2091f30889bb5c622227adfc9fecf0abdca9b70050cbea442a99b81

Contents?: true

Size: 1004 Bytes

Versions: 8

Compression:

Stored size: 1004 Bytes

Contents

module VCR
  class Cassette
    def allow_real_http_requests_to?(uri)
      warn "WARNING: VCR::Cassette#allow_real_http_requests_to? is deprecated and should no longer be used."
      VCR.http_stubbing_adapter.ignore_localhost? && VCR::LOCALHOST_ALIASES.include?(uri.host)
    end

    private

    def deprecate_old_cassette_options(options)
      message = "VCR's :allow_real_http cassette option is deprecated.  Instead, use the ignore_localhost configuration option."
      if options[:allow_real_http] == :localhost
        @original_ignore_localhost = VCR.http_stubbing_adapter.ignore_localhost?
        VCR.http_stubbing_adapter.ignore_localhost = true
        Kernel.warn "WARNING: #{message}"
      elsif options[:allow_real_http]
        raise ArgumentError.new(message)
      end
    end

    def restore_ignore_localhost_for_deprecation
      if defined?(@original_ignore_localhost)
        VCR.http_stubbing_adapter.ignore_localhost = @original_ignore_localhost
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
vcr-1.2.0 lib/vcr/deprecations.rb
vcr-1.1.2 lib/vcr/deprecations.rb
vcr-1.1.1 lib/vcr/deprecations.rb
vcr-1.1.0 lib/vcr/deprecations.rb
vcr-1.0.3 lib/vcr/deprecations.rb
vcr-1.0.2 lib/vcr/deprecations.rb
vcr-1.0.1 lib/vcr/deprecations.rb
vcr-1.0.0 lib/vcr/deprecations.rb