>>772
newgemでbinつき、rspecつきで出力したのが参考になるかも

binのスクリプトのスペックファイルがこんなのになってる
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
require 'tweetswget/cli'

describe Tweetswget::CLI, "execute" do
 before(:each) do
  @stdout_io = StringIO.new
  Tweetswget::CLI.execute(@stdout_io, [])
  @stdout_io.rewind
  @stdout = @stdout_io.read
 end
 
 it "should print default output" do
  @stdout.should =~ /To update this executable/
 end
end