Sha256: f64fe921e8a2c93e8201ecf506b58102e177bf8582d7ac29e0b010f89aee10f7

Contents?: true

Size: 859 Bytes

Versions: 5

Compression:

Stored size: 859 Bytes

Contents

require_relative 'test_helper'

class HTTPReaderTest < Minitest::Test
  describe IOStreams::HTTP::Reader do
    let :uri do
      "http://example.com/index.html?count=10"
    end

    let :ssl_uri do
      "https://example.com/index.html?count=10"
    end

    describe '.open' do
      it 'reads http' do
        result = IOStreams::HTTP::Reader.open(uri) do |io|
          io.read
        end
        assert_includes result, "<html>"
      end

      it 'reads https' do
        result = IOStreams::HTTP::Reader.open(ssl_uri) do |io|
          io.read
        end
        assert_includes result, "<html>"
      end

      it 'does not support streams' do
        assert_raises ArgumentError do
          io = StringIO.new
          IOStreams::HTTP::Reader.open(io) do |http_io|
            http_io.read
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
iostreams-0.20.3 test/http_reader_test.rb
iostreams-0.20.2 test/http_reader_test.rb
iostreams-0.20.1 test/http_reader_test.rb
iostreams-0.20.0 test/http_reader_test.rb
iostreams-0.19.0 test/http_reader_test.rb