Last active
December 24, 2015 07:40
-
-
Save parroty/6765617 to your computer and use it in GitHub Desktop.
ExVCR example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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