Sha256: 62fcba34f203ce26909d1411ca8d526a5ef99758bd73a2b596195ed98a2411db

Contents?: true

Size: 924 Bytes

Versions: 10

Compression:

Stored size: 924 Bytes

Contents

require 'minitest/autorun'
require File.dirname(__FILE__) + '/../lib/yawast'
require File.dirname(__FILE__) + '/base'

class TestSharedHttp < Minitest::Test
  include TestBase

  def setup
    @uri = URI::Parser.new.parse 'http://www.apple.com/library/test/success.html'
  end

  def test_get_apple_success
    body = Yawast::Shared::Http.get @uri

    assert body.include?('Success'), 'Failed to receive "Success" message from Apple.com'
  end

  def test_status_apple_success
    status = Yawast::Shared::Http.get_status_code @uri

    assert_equal status, '200'
  end

  def test_status_apple_failure
    uri = @uri
    uri.path += '.404'
    status = Yawast::Shared::Http.get_status_code uri

    assert_equal status, '404'
  end

  def test_head_apple_success
    head = Yawast::Shared::Http.head @uri
    head.each do |k, v|
      if k.downcase == 'server'
        assert_equal v, 'Apache'
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
yawast-0.4.0.beta4 test/test_shared_http.rb
yawast-0.4.0.beta3 test/test_shared_http.rb
yawast-0.4.0.beta2 test/test_shared_http.rb
yawast-0.4.0.beta1 test/test_shared_http.rb
yawast-0.3.0 test/test_shared_http.rb
yawast-0.3.0.beta2 test/test_shared_http.rb
yawast-0.3.0.beta1 test/test_shared_http.rb
yawast-0.2.2 test/test_shared_http.rb
yawast-0.2.1 test/test_shared_http.rb
yawast-0.2.0.beta3 test/test_shared_http.rb