Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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 Jacobkg authored
View
4 features/cassettes/no_cassette.feature
@@ -5,6 +5,10 @@ Feature: Error for HTTP request made when no cassette is in use
raised when an HTTP request is made while there is no cassette in
use. The error is helpful to pinpoint where HTTP requests are
made so you can use a VCR cassette at that point in your code.
+
+ If you want insight about how VCR attempted to handle the request,
+ you can use the [debug\_logger](../configuration/debug-logging)
+ configuration option to log more details.
If you want to allow an HTTP request to proceed as normal, you can
set the [allow\_http\_connections\_when\_no\_cassette](../configuration/allow-http-connections-when-no-cassette)
View
9 lib/vcr/errors.rb
@@ -183,6 +183,13 @@ def format_foot_note(url, index)
"change your :match_requests_on cassette option to be more lenient",
"or use a custom request matcher to allow it to match"],
"https://www.relishapp.com/myronmarston/vcr/v/%s/docs/request-matching"
+ ],
+
+ :try_debug_logger => [
+ ["If you're surprised VCR is raising this error",
+ "and want insight about how VCR attempted to handle the request,",
+ "you can use the debug_logger configuraiton option to log more details"],
+ "https://www.relishapp.com/myronmarston/vcr/v/%s/docs/configuration/debug-logging"
]
}
@@ -196,7 +203,7 @@ def suggestion_for(key)
def suggestions
return no_cassette_suggestions unless cassette = VCR.current_cassette
- [:use_new_episodes, :ignore_request].tap do |suggestions|
+ [:try_debug_logger, :use_new_episodes, :ignore_request].tap do |suggestions|
suggestions.push(*record_mode_suggestion)
suggestions << :allow_playback_repeats if cassette.http_interactions.has_used_interaction_matching?(request)
suggestions.map! { |k| suggestion_for(k) }
View
10 spec/vcr/errors_spec.rb
@@ -42,6 +42,10 @@ def request_with(values)
it 'does not double-insert the asterisks for the bullet points' do
message.should_not match(/\s+\*\s+\*/)
end
+
+ it 'mentions the debug logging configuration option' do
+ message.should include('debug_logger')
+ end
end
context 'when there is a current cassette' do
@@ -122,6 +126,12 @@ def request_with(values)
message.should include('2 HTTP interactions ')
end
end
+
+ it 'mentions the debug logging configuration option' do
+ VCR.use_cassette('example', :record => :new_episodes) do
+ message.should include('debug_logger')
+ end
+ end
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.