File tree Expand file tree Collapse file tree 1 file changed +27
-10
lines changed
Expand file tree Collapse file tree 1 file changed +27
-10
lines changed Original file line number Diff line number Diff line change 5252 expect ( input ) . to be ( :closed? )
5353 end
5454
55- it "can rewind after reading all input" do
56- expect ( input . read ) . to be == sample_data . join
57- expect ( input ) . to be ( :closed? )
58-
59- input . rewind
60-
61- expect ( input ) . not . to be ( :closed? )
62- expect ( input . read ) . to be == sample_data . join
63- end
64-
6555 it "can read exactly the content length" do
6656 expect ( body ) . to receive ( :close )
6757
155145 expect ( input ) . not . to be ( :closed? )
156146 end
157147 end
148+
149+ with "#rewind" do
150+ it "can rewind after reading all input" do
151+ expect ( input . read ) . to be == sample_data . join
152+ expect ( input ) . to be ( :closed? )
153+
154+ input . rewind
155+
156+ expect ( input ) . not . to be ( :closed? )
157+ expect ( input . read ) . to be == sample_data . join
158+ end
159+
160+ it "can rewind after reading partial input" do
161+ expect ( input . read ( 3 ) ) . to be == "The"
162+ expect ( input ) . not . to be ( :closed? )
163+
164+ input . rewind
165+
166+ expect ( input ) . not . to be ( :closed? )
167+ expect ( input . read ( 3 ) ) . to be == "The"
168+ end
169+
170+ it "can't rewind after explicit close" do
171+ input . close
172+ expect ( input . rewind ) . to be == false
173+ end
174+ end
158175 end
159176
160177 with "no body" do
You can’t perform that action at this time.
0 commit comments