Permalink
Browse files

Fix the way we override the webmock stubbing instructions.

  • Loading branch information...
1 parent 13b66dd commit 7f95cf8bb2671f8e595e639de94c79586541a7bf @myronmarston committed Nov 11, 2010
Showing with 9 additions and 4 deletions.
  1. +4 −2 lib/vcr/http_stubbing_adapters/common.rb
  2. +5 −2 lib/vcr/http_stubbing_adapters/webmock.rb
@@ -11,12 +11,14 @@ module Common
def self.add_vcr_info_to_exception_message(exception_klass)
exception_klass.class_eval do
def message
- super + ". You can use VCR to automatically record this request and replay it later. " +
- "For more details, visit the VCR wiki at: http://github.com/myronmarston/vcr/wiki"
+ super + ". " + VCR::HttpStubbingAdapters::Common::RECORDING_INSTRUCTIONS
end
end
end
+ RECORDING_INSTRUCTIONS = "You can use VCR to automatically record this request and replay it later. " +
+ "For more details, visit the VCR wiki at: http://github.com/myronmarston/vcr/wiki"
+
def check_version!
version_too_low, version_too_high = compare_version
@@ -94,5 +94,8 @@ def checkpoints
VCR.record_http_interaction(http_interaction)
end
-VCR::HttpStubbingAdapters::Common.add_vcr_info_to_exception_message(WebMock::NetConnectNotAllowedError)
-
+WebMock::NetConnectNotAllowedError.class_eval do
+ def stubbing_instructions(*args)
+ '. ' + VCR::HttpStubbingAdapters::Common::RECORDING_INSTRUCTIONS
+ end
+end

0 comments on commit 7f95cf8

Please sign in to comment.