File: a_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 (30 lines) | stat: -rw-r--r-- 650 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
# frozen_string_literal: true

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

require "socket"
require "protocol/http2/framer"

module Protocol
	module HTTP2
		AFrame = Sus::Shared("a frame") do
			let(:pipe) {Socket.pair(:UNIX, :STREAM)}
			let(:remote) {pipe[0]}
			let(:stream) {pipe[1]}
			
			let(:framer) {Protocol::HTTP2::Framer.new(stream, {subject::TYPE => subject})}
			
			let(:frame) {subject.new}
			
			it "is a valid frame type" do
				expect(frame).to be(:valid_type?)
			end
			
			it "can write the frame" do
				frame.write(remote)
				expect(framer.read_frame).to be == frame
			end
		end
	end
end