# File lib/vcr/http_stubbing_adapters/common.rb, line 24 def adapters @adapters ||= [] end
# File lib/vcr/http_stubbing_adapters/common.rb, line 16 def add_vcr_info_to_exception_message(exception_klass) exception_klass.class_eval do def initialize(message) super(message + '. ' + VCR::HttpStubbingAdapters::Common::RECORDING_INSTRUCTIONS) end end end
# File lib/vcr/http_stubbing_adapters/common.rb, line 28 def included(adapter) adapters << adapter end
# File lib/vcr/http_stubbing_adapters/common.rb, line 18 def initialize(message) super(message + '. ' + VCR::HttpStubbingAdapters::Common::RECORDING_INSTRUCTIONS) end
# File lib/vcr/http_stubbing_adapters/common.rb, line 50 def check_version! case compare_version when :too_low raise "You are using #{library_name} #{version}. VCR requires version #{version_requirement}." when :too_high warn "You are using #{library_name} #{version}. VCR is known to work with #{library_name} #{version_requirement}. It may not work with this version." end end
# File lib/vcr/http_stubbing_adapters/common.rb, line 36 def enabled? [nil, self].include? VCR::HttpStubbingAdapters::Common.exclusively_enabled_adapter end
# File lib/vcr/http_stubbing_adapters/common.rb, line 40 def exclusively_enabled VCR::HttpStubbingAdapters::Common.exclusively_enabled_adapter = self begin yield ensure VCR::HttpStubbingAdapters::Common.exclusively_enabled_adapter = nil end end
# File lib/vcr/deprecations/http_stubbing_adapters/common.rb, line 4 def ignore_localhost? VCR::Config.ignore_localhost? end
# File lib/vcr/http_stubbing_adapters/common.rb, line 59 def library_name @library_name ||= self.to_s.split('::').last end
# File lib/vcr/http_stubbing_adapters/common.rb, line 67 def restore_stubs_checkpoint(cassette) raise ArgumentError.new("No checkpoint for #{cassette.inspect} could be found") end
# File lib/vcr/http_stubbing_adapters/common.rb, line 63 def set_http_connections_allowed_to_default self.http_connections_allowed = VCR::Config.allow_http_connections_when_no_cassette? end