Skip to content

Commit

Permalink
Add ExVCR.ImplementationMissingError validation for coverter
Browse files Browse the repository at this point in the history
  • Loading branch information
parroty committed Mar 12, 2014
1 parent b101d1e commit 6a226f5
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/exvcr/converter.ex
Expand Up @@ -6,15 +6,15 @@ defmodule ExVCR.Converter do
defmacro __using__(_) do
quote do
@doc """
Parse string fromat into original request / response format.
Parse string format into original request / response tuples.
"""
def convert_from_string([{"request", request}, {"response", response}]) do
[ request: string_to_request(request), response: string_to_response(response) ]
end
defoverridable [convert_from_string: 1]

@doc """
Parse request and response parameters into string format.
Parse request and response tuples into string format.
"""
def convert_to_string(request, response) do
[ request: request_to_string(request), response: response_to_string(response) ]
Expand All @@ -26,6 +26,15 @@ defmodule ExVCR.Converter do
end
defoverridable [string_to_request: 1]

defp string_to_response(string), do: raise ExVCR.ImplementationMissingError
defoverridable [string_to_response: 1]

defp request_to_string(request), do: raise ExVCR.ImplementationMissingError
defoverridable [request_to_string: 1]

defp response_to_string(response), do: raise ExVCR.ImplementationMissingError
defoverridable [response_to_string: 1]

defp parse_headers(headers) do
do_parse_headers(headers, [])
end
Expand Down

0 comments on commit 6a226f5

Please sign in to comment.