Sha256: 40d3e03d4f49bb36f9c7ea116b4e9447a84f09409a531c9eca3acfc6254bf750

Contents?: true

Size: 516 Bytes

Versions: 3

Compression:

Stored size: 516 Bytes

Contents

# frozen_string_literal: true
require "test_helper"

class JsonResponseTest < Minitest::Test
  test "detects as json" do
    register_uri(:get, "http://example.org/", body: "[]", content_type: "application/json")
    response = Aitch.get("http://example.org/")

    assert response.json?
  end

  test "returns json" do
    register_uri(:get, "http://example.org/", body: "[1,2,3]", content_type: "application/json")
    response = Aitch.get("http://example.org/")

    assert_equal [1,2,3], response.data
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
aitch-1.0.2 test/aitch/response/json_response_test.rb
aitch-1.0.1 test/aitch/response/json_response_test.rb
aitch-1.0.0 test/aitch/response/json_response_test.rb