Sha256: 6f5c7b17453fae9f8b390ba267839e09a27bdb6fc4063accc95b33e1ae2d87d8

Contents?: true

Size: 733 Bytes

Versions: 1

Compression:

Stored size: 733 Bytes

Contents

# encoding: utf-8

require_relative 'test_helper'
require 'vcr'

VCR.configure do |c|
  c.cassette_library_dir = "#{File.dirname(__FILE__)}/fixtures-vcr"
  c.hook_into :webmock
end

class HttpTest < Test::Unit::TestCase
  def test_get_with_redirection
    VCR.use_cassette('http_test') do
      google = Http.get("http://google.de")
      assert google.starts_with?("<!doctype html>")
    end
  end

  def test_get_body_and_headers
    VCR.use_cassette('http_test') do
      body, headers = Http.get_body_and_headers("http://google.de", 0)
      assert body.starts_with?("<!doctype html>")
      assert_equal ["text/html; charset=ISO-8859-1"], headers["content-type"]
      assert_equal "UTF-8", body.encoding.name
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
radiospieler-0.3.8 test/http_test.rb