Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# encoding: utf-8
require 'spec_helper'
describe "Test JSON response" do
before :all do
host = http://localhost:3000
@url = "api/v1/foobar"
headers = {
:'Content-Type' => 'application/json',
:'User-Agent' => 'Testing API Response',
}
@conn = Faraday.new(url: host, headers: headers) do |builder|
builder.use Faraday::Request::UrlEncoded
builder.adapter :net_http
end
end
it "Get correct JSON response" do
data = File.read("path/to/json/file.json"))
r = @conn.post( @url, data )
resp = File.read("path/to/response/response.json")
r.body.squish.should eql(resp.squish)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.