Sha256: a5a6a8ad266a1ec547985f7f55faa4a502686c6944e2ec07588fb8787d63c40b

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 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 'https://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

2 entries across 2 versions & 1 rubygems

Version Path
yawast-0.6.0.beta5 test/test_shared_http.rb
yawast-0.6.0.beta4 test/test_shared_http.rb