Sha256: 6643f0b8f167c2287fca397f0e493b9d7531e1d5907904e92efc76e504193549

Contents?: true

Size: 684 Bytes

Versions: 10

Compression:

Stored size: 684 Bytes

Contents

require 'helper'

RSpec.describe HTTP2::Buffer do
  let(:b) { Buffer.new('émalgré') }

  it 'should force 8-bit encoding' do
    expect(b.encoding.to_s).to eq 'ASCII-8BIT'
  end

  it 'should force 8-bit encoding when adding data' do
    b << 'émalgré'
    expect(b.encoding.to_s).to eq 'ASCII-8BIT'
    b.prepend('émalgré')
    expect(b.encoding.to_s).to eq 'ASCII-8BIT'
  end

  it 'should return bytesize of the buffer' do
    expect(b.size).to eq 9
  end

  it 'should read single byte at a time' do
    9.times { expect(b.read(1)).not_to be_nil }
  end

  it 'should unpack an unsigned 32-bit int' do
    expect(Buffer.new([256].pack('N')).read_uint32).to eq 256
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
http-2-0.11.0 spec/buffer_spec.rb
http-2-0.10.2 spec/buffer_spec.rb
http-2-0.10.1 spec/buffer_spec.rb
http-2-0.10.0 spec/buffer_spec.rb
http-2-0.9.1 spec/buffer_spec.rb
http-2-0.9.0 spec/buffer_spec.rb
http-2-0.8.4 spec/buffer_spec.rb
http-2-0.8.3 spec/buffer_spec.rb
http-2-0.8.2 spec/buffer_spec.rb
http-2-0.8.1 spec/buffer_spec.rb