Sha256: ce4265abf9c5ee72631b7b342ec8a359493426b0e8e9773eb27bc4090415da81
Contents?: true
Size: 1.4 KB
Versions: 13
Compression:
Stored size: 1.4 KB
Contents
# frozen_string_literal: true require ::File.expand_path("../test_helper", __dir__) module Stripe class StripeResponseTest < Test::Unit::TestCase context ".from_faraday_hash" do should "converts to StripeResponse" do body = '{"foo": "bar"}' headers = { "Request-Id" => "request-id" } http_resp = { body: body, headers: headers, status: 200, } resp = StripeResponse.from_faraday_hash(http_resp) assert_equal JSON.parse(body, symbolize_names: true), resp.data assert_equal body, resp.http_body assert_equal headers, resp.http_headers assert_equal 200, resp.http_status assert_equal "request-id", resp.request_id end end context ".from_faraday_response" do should "converts to StripeResponse" do body = '{"foo": "bar"}' headers = { "Request-Id" => "request-id" } env = Faraday::Env.from( status: 200, body: body, response_headers: headers ) http_resp = Faraday::Response.new(env) resp = StripeResponse.from_faraday_response(http_resp) assert_equal JSON.parse(body, symbolize_names: true), resp.data assert_equal body, resp.http_body assert_equal headers, resp.http_headers assert_equal 200, resp.http_status assert_equal "request-id", resp.request_id end end end end
Version data entries
13 entries across 13 versions & 2 rubygems