Skip to content

Commit

Permalink
Add more specs.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Jun 18, 2019
1 parent a80b980 commit 6f42598
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions spec/protocol/http2/stream_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@
context "idle stream" do
let(:stream) {client.create_stream}

it "can send headers" do
stream.send_headers(nil, [["foo", "bar"]])

server_stream = server.create_stream(stream.id)

expect(server_stream).to receive(:receive_headers)

server.read_frame
end

it "cannot send data" do
expect do
stream.send_data("Hello World!")
Expand Down Expand Up @@ -128,6 +138,30 @@
end
end

context "open stream" do
let(:stream) {client.create_stream.open!}

it "can send data" do
stream.send_data("Hello World!")

server_stream = server.create_stream(stream.id)

expect(server_stream).to receive(:receive_data)

server.read_frame
end

it "can send reset stream" do
stream.send_reset_stream

server_stream = server.create_stream(stream.id)

expect(server_stream).to receive(:receive_reset_stream)

server.read_frame
end
end

context "closed stream" do
let(:stream) {client.create_stream.close!}

Expand Down

0 comments on commit 6f42598

Please sign in to comment.