Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix for #188. Add mention of debug logging configuration option to un…

…handled request error message. Also added it to the no_cassette.feature.
  • Loading branch information...
commit d72b7b7056fbaf344f40184c6f707fb10eb361c2 1 parent ae9de23
Jacobkg authored
4  features/cassettes/no_cassette.feature
@@ -5,6 +5,10 @@ Feature: Error for HTTP request made when no cassette is in use
5 5
   raised when an HTTP request is made while there is no cassette in
6 6
   use.  The error is helpful to pinpoint where HTTP requests are
7 7
   made so you can use a VCR cassette at that point in your code.
  8
+  
  9
+  If you want insight about how VCR attempted to handle the request,
  10
+  you can use the [debug\_logger](../configuration/debug-logging)
  11
+  configuration option to log more details.
8 12
 
9 13
   If you want to allow an HTTP request to proceed as normal, you can
10 14
   set the [allow\_http\_connections\_when\_no\_cassette](../configuration/allow-http-connections-when-no-cassette)
9  lib/vcr/errors.rb
@@ -183,6 +183,13 @@ def format_foot_note(url, index)
183 183
            "change your :match_requests_on cassette option to be more lenient",
184 184
            "or use a custom request matcher to allow it to match"],
185 185
            "https://www.relishapp.com/myronmarston/vcr/v/%s/docs/request-matching"
  186
+        ],
  187
+
  188
+        :try_debug_logger => [
  189
+          ["If you're surprised VCR is raising this error",
  190
+           "and want insight about how VCR attempted to handle the request,",
  191
+           "you can use the debug_logger configuraiton option to log more details"],
  192
+          "https://www.relishapp.com/myronmarston/vcr/v/%s/docs/configuration/debug-logging"
186 193
         ]
187 194
       }
188 195
 
@@ -196,7 +203,7 @@ def suggestion_for(key)
196 203
       def suggestions
197 204
         return no_cassette_suggestions unless cassette = VCR.current_cassette
198 205
 
199  
-        [:use_new_episodes, :ignore_request].tap do |suggestions|
  206
+        [:try_debug_logger, :use_new_episodes, :ignore_request].tap do |suggestions|
200 207
           suggestions.push(*record_mode_suggestion)
201 208
           suggestions << :allow_playback_repeats if cassette.http_interactions.has_used_interaction_matching?(request)
202 209
           suggestions.map! { |k| suggestion_for(k) }
10  spec/vcr/errors_spec.rb
@@ -42,6 +42,10 @@ def request_with(values)
42 42
         it 'does not double-insert the asterisks for the bullet points' do
43 43
           message.should_not match(/\s+\*\s+\*/)
44 44
         end
  45
+        
  46
+        it 'mentions the debug logging configuration option' do
  47
+          message.should include('debug_logger')
  48
+        end
45 49
       end
46 50
 
47 51
       context 'when there is a current cassette' do
@@ -122,6 +126,12 @@ def request_with(values)
122 126
             message.should include('2 HTTP interactions ')
123 127
           end
124 128
         end
  129
+
  130
+        it 'mentions the debug logging configuration option' do
  131
+          VCR.use_cassette('example', :record => :new_episodes) do
  132
+            message.should include('debug_logger')
  133
+          end
  134
+        end
125 135
       end
126 136
     end
127 137
   end

0 notes on commit d72b7b7

Please sign in to comment.
Something went wrong with that request. Please try again.