Sha256: e817495ba017d015c8e9d98beb95c7af2042120e2a234531010144b4bda8d997

Contents?: true

Size: 1.03 KB

Versions: 17

Compression:

Stored size: 1.03 KB

Contents

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
    Yawast::Shared::Http.setup nil, nil
    body = Yawast::Shared::Http.get @uri

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

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

    assert_equal status, '200'
  end

  def test_status_apple_failure
    uri = @uri
    uri.path += '.404'

    Yawast::Shared::Http.setup nil, nil
    status = Yawast::Shared::Http.get_status_code uri

    assert_equal status, '404'
  end

  def test_head_apple_success
    Yawast::Shared::Http.setup nil, nil
    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

17 entries across 17 versions & 1 rubygems

Version Path
yawast-0.6.0.beta3 test/test_shared_http.rb
yawast-0.6.0.beta2 test/test_shared_http.rb
yawast-0.6.0.beta1 test/test_shared_http.rb
yawast-0.5.2 test/test_shared_http.rb
yawast-0.5.1 test/test_shared_http.rb
yawast-0.5.1.beta1 test/test_shared_http.rb
yawast-0.5.0 test/test_shared_http.rb
yawast-0.5.0.beta8 test/test_shared_http.rb
yawast-0.5.0.beta7 test/test_shared_http.rb
yawast-0.5.0.beta6 test/test_shared_http.rb
yawast-0.5.0.beta5 test/test_shared_http.rb
yawast-0.5.0.beta4 test/test_shared_http.rb
yawast-0.5.0.beta3 test/test_shared_http.rb
yawast-0.5.0.beta2 test/test_shared_http.rb
yawast-0.5.0.beta1 test/test_shared_http.rb
yawast-0.4.0 test/test_shared_http.rb
yawast-0.4.0.beta5 test/test_shared_http.rb