File: goaway_frame.rb

package info (click to toggle)
ruby-protocol-http2 0.23.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 472 kB
  • sloc: ruby: 3,627; makefile: 4
file content (42 lines) | stat: -rw-r--r-- 758 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2019-2024, by Samuel Williams.

require "protocol/http2/goaway_frame"
require "protocol/http2/a_frame"

describe Protocol::HTTP2::GoawayFrame do
	let(:data) {"Hikikomori desu!"}
	let(:frame) {subject.new}
	
	it_behaves_like Protocol::HTTP2::AFrame do
		def before
			frame.pack 1, 2, data
			
			super
		end
	end
	
	it "applies to the connection" do
		frame.pack(0, 0, "")
		
		expect(frame).to be(:connection?)
	end
	
	with "#pack" do
		it "packs data" do
			frame.pack 3, 2, data
			
			expect(frame.length).to be == 8+data.bytesize
		end
	end
	
	with "#unpack" do
		it "unpacks data" do
			frame.pack 3, 2, data
			
			expect(frame.unpack).to be == [3, 2, data]
		end
	end
end