We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Async::Container::Channel
1 parent bc27b98 commit 06cbb91Copy full SHA for 06cbb91
test/async/container/channel.rb
@@ -0,0 +1,32 @@
1
+# frozen_string_literal: true
2
+
3
+# Released under the MIT License.
4
+# Copyright, 2025, by Samuel Williams.
5
6
+require "async/container/channel"
7
8
+describe Async::Container::Channel do
9
+ let(:channel) {subject.new}
10
11
+ after do
12
+ @channel&.close
13
+ end
14
15
+ it "can send and receive" do
16
+ channel.out.puts "Hello, World!"
17
18
+ expect(channel.in.gets).to be == "Hello, World!\n"
19
20
21
+ it "can send and receive JSON" do
22
+ channel.out.puts JSON.dump({hello: "world"})
23
24
+ expect(channel.receive).to be == {hello: "world"}
25
26
27
+ it "can receive invalid JSON" do
28
29
30
+ expect(channel.receive).to be == {line: "Hello, World!\n"}
31
32
+end
0 commit comments