File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change 135135 context 'when a writer raises an exception' do
136136 let ( :output ) { double ( 'output' ) }
137137 before do
138- expect ( output ) . to receive ( :write ) . with ( String ) . and_raise (
138+ expect ( output ) . to receive ( :write ) . with ( 'hello' ) . and_raise (
139139 Encoding ::UndefinedConversionError , 'UTF-8 conversion error'
140140 )
141141 end
142142 let ( :writers ) { [ output ] }
143143
144- it 'should kill the monitoring thread' do
144+ it 'should eventually kill the monitoring thread' do
145145 monitored_pipe . write ( 'hello' )
146- sleep ( 0.02 )
146+ sleep ( 0.1 )
147147 expect ( monitored_pipe . thread . alive? ) . to eq ( false )
148148 end
149149
150- it 'should set the state to :closed' do
150+ it 'should eventually set the state to :closed' do
151151 monitored_pipe . write ( 'hello' )
152- sleep ( 0.02 )
152+ sleep ( 0.1 )
153153 expect ( monitored_pipe . state ) . to eq ( :closed )
154154 end
155155
156- it 'should save the exception raised to #exception' do
156+ it 'should eventually save the exception raised to #exception' do
157157 monitored_pipe . write ( 'hello' )
158- sleep ( 0.02 )
158+ sleep ( 0.1 )
159159 expect ( monitored_pipe . exception ) . to be_a ( Encoding ::UndefinedConversionError )
160160 expect ( monitored_pipe . exception . message ) . to eq ( 'UTF-8 conversion error' )
161161 end
162162
163163 it 'should raise an exception if #write is called after the pipe is closed' do
164164 monitored_pipe . write ( 'hello' )
165- sleep ( 0.02 )
165+ sleep ( 0.1 )
166166 expect { monitored_pipe . write ( 'world' ) } . to raise_error ( IOError , 'closed stream' )
167167 end
168168 end
You can’t perform that action at this time.
0 commit comments