Skip to content

Instantly share code, notes, and snippets.

@aisrael
Created February 5, 2018 02:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aisrael/958841742d3c63b1ba5b86ac54cb5c60 to your computer and use it in GitHub Desktop.
Save aisrael/958841742d3c63b1ba5b86ac54cb5c60 to your computer and use it in GitHub Desktop.
HI8 Spec that demonstrates failure using Cossack
require "./spec_helper"
require "cossack"
require "http/client"
HI8.configure do |config|
config.cassette_library_dir = "./test_dir/cassettes"
end
describe Hi8test do
it "doesn't work using Cossack::Client" do
HI8.use_cassette("using_cossack_client") do
client = Cossack::Client.new("https://api.fixer.io")
resp = client.get("/latest?base=USD")
resp.status.should eq(200)
end
end
it "works using HTTP::Client.get" do
HI8.use_cassette("using_http_client_get") do
resp = HTTP::Client.get("https://api.fixer.io/latest?base=USD")
resp.status_code.should eq(200)
end
end
it "works using HTTP::Client.new" do
HI8.use_cassette("using_http_client_new") do
client = HTTP::Client.new(URI.parse("https://api.fixer.io"))
resp = client.get("/latest?base=USD")
resp.status_code.should eq(200)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment