File tree Expand file tree Collapse file tree 2 files changed +16
-17
lines changed Expand file tree Collapse file tree 2 files changed +16
-17
lines changed Original file line number Diff line number Diff line change 5656 let ( :message ) { "Helloooooo World!" }
5757
5858 it "can send message via pipe" do
59- input , output = IO . pipe
60-
61- reactor . async do
62- sleep ( 0.001 )
63-
64- message . each_char do |character |
65- output . write ( character )
59+ IO . pipe do |input , output |
60+ reactor . async do
61+ sleep ( 0.001 )
62+
63+ message . each_char do |character |
64+ output . write ( character )
65+ end
66+
67+ output . close
6668 end
6769
68- output . close
70+ expect ( input . read ) . to be == message
6971 end
70-
71- expect ( input . read ) . to be == message
72-
73- input . close
7472 end
7573
7674 it "can fetch website using Net::HTTP" do
Original file line number Diff line number Diff line change 300300 it "can sleep for the requested duration" do
301301 state = nil
302302
303- reactor . async do |task |
304- task . sleep ( duration )
305- state = :finished
306- end
307-
303+ # Measure the entire time, it's got to be at least bigger than the requested duration:
308304 time = Async ::Clock . measure do
305+ reactor . async do |task |
306+ task . sleep ( duration )
307+ state = :finished
308+ end
309+
309310 reactor . run
310311 end
311312
You can’t perform that action at this time.
0 commit comments