Sha256: b0ced09dc6b4c47376b91741219153ca2b2ef3c02f12fabfb6c8a742e23c329c

Contents?: true

Size: 770 Bytes

Versions: 3

Compression:

Stored size: 770 Bytes

Contents

require "helper"

class TestHeaders < Test::Unit::TestCase
  def setup
    @headers = Mechanize::Headers.new
    @headers['content-type'] = 'text/html'
    @headers['Content-encoding'] = 'gzip'
    @headers['SERVER'] = 'Apache/2.2'
  end

  def test_aref
    assert_equal('Apache/2.2', @headers['server'])
    assert_equal('text/html', @headers['Content-Type'])
  end

  def test_key?
    assert_equal(true, @headers.key?('content-Encoding'))
  end

  def test_canonical_each
    all_keys = ['Content-Type', 'Content-Encoding', 'Server']
    keys = all_keys.dup
    @headers.canonical_each { |key, value|
      case keys.delete(key)
      when *all_keys
        # ok
      else
        flunk "unexpected key: #{key}"
      end
    }
    assert_equal([], keys)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mechanize-2.0 test/test_headers.rb
mechanize-2.0.pre.2 test/test_headers.rb
mechanize-2.0.pre.1 test/test_headers.rb