Thank you, Gavin.
'stringio' is very useful. I didn't know it.
It seemed to be a feature of Ruby 1.8, so I installed Ruby Shim.
http://raa.ruby-lang.org/list.rhtml?name=shim-ruby16_18

regards,
makotz


Gavin Sinclair <gsinclair / soyabean.com.au> wrote:
> 
>   def print_list(list, out=STDOUT)
>     list.each_with_index do |item, index|
>       out.print "#{index+1}: #{item}\n"
>     end
>   end
> 
> In your test case:
> 
>   require 'stringio'
> 
>   buf = ""
>   StringIO.open(buf, 'w') do |io|
>     print_list(list, io)
>   end
> 
>   assert_equal(expected_result, buf)
> 
>   
> I think I got that right.
> 
> Gavin