Sha256: a8ef9065aeb351af4291be2eea8814d5b98271c1eb312255d8a71743f3a7c9e4
Contents?: true
Size: 632 Bytes
Versions: 1
Compression:
Stored size: 632 Bytes
Contents
# frozen_string_literal: true require "test_helper" require "csv" class CustomResponseParserTest < Minitest::Test setup do parser = Class.new do def self.match?(content_type) content_type =~ /csv/ end def self.load(source) CSV.parse(source) end end Aitch::ResponseParser.prepend(:csv, parser) end test "returns csv" do register_uri(:get, "http://example.org/file.csv", body: "1,2,3", content_type: "text/csv") response = Aitch.get("http://example.org/file.csv") assert_instance_of Array, response.data assert_equal [%w[1 2 3]], response.data end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
aitch-1.2.0 | test/aitch/response/custom_response_parser_test.rb |