Skip to content

Instantly share code, notes, and snippets.

@parroty
Last active December 24, 2015 07:40
Show Gist options
  • Save parroty/6765617 to your computer and use it in GitHub Desktop.
Save parroty/6765617 to your computer and use it in GitHub Desktop.
ExVCR example
defmodule ExVCR.MockTest do
use ExUnit.Case
import ExVCR.Mock
setup_all do
ExVCR.Config.cassette_library_dir("fixture/vcr_cassettes",
"fixture/custom_cassettes")
:ok
end
test "example single request" do
use_cassette "example_ibrowse" do
:ibrowse.start
{:ok, status_code, _headers, body} =
:ibrowse.send_req('http://example.com', [], :get)
assert status_code == '200'
assert iolist_to_binary(body) =~ %r/Example Domain/
end
end
test "httpotion" do
use_cassette "example_httpotion" do
assert HTTPotion.get("http://example.com", []).body =~ %r/Example Domain/
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment