«前の日記(2008-05-12) 最新 次の日記(2008-06-02)» 編集

野ログはノロキュアMaxHeart


2008-05-23

_ ZenTestのautotestとscreenでRailsのテストを行うメモ

いまさらかよ!

って感じですけど、いまさら使い始めたのでメモ

現在screen使ってる人向け。

注意

Ruby1.8.6未満だとautotest中に問題が発生する

参考

インストール

sudo gem install ZenTest redgreen

設定

$HOME/.autotest
require 'autotest/screen'
require 'autotest/redgreen'
Autotest::HOOKS.delete(:interrupt)
Autotest::Screen.statusline = "%{= wg} %-w%{=bu dr}%n %t%{-}%+w %= %{=b wb}%y/%m/%d %{=b wm}%c"
class Autotest::Screen
  SCREEN_COLOR[:green] = 'gw'
  SCREEN_COLOR[:yellow] = 'yk'

  Autotest.add_hook :run_command do |at|
    message 'Running' if execute?
  end

  Autotest.add_hook :quit do |at|
    clear if execute?
  end

  Autotest.add_hook :ran_command do |at|
    return unless execute?
    results = [at.results].flatten.join("\n")
    output = results.slice(/(\d+)\sexamples?,\s*(\d+)\s.*failures?(?:,\s*(\d+)\s.*pendings?)?/)
    if output
      ex,fail,pend = $~.captures.map {|e| e.to_i}
      if 0 < fail
        message "FAIL #{ex}ex, F:#{fail} ", :red
      elsif 0 < pend
        message "Pend #{ex}ex, F:#{fail} P:#{pend}", :yellow
      else
        message "All Green #{ex}ex", :green
      end
    end
  end
end

statusline部分は自分のscreenの設定にあわせて。

参考

http://kakutani.com/20070912.html#p02

使い方

開始

Railsプロジェクトのルートディレクトリで

autotest
停止

CTRL+Cを二回連続で停止

Tags: dev

Bookmark this entry:    Yahoo! bookmark    del.icio.us del.icio.us    Hatena Hatena    Buzzurl Buzzurl    livedoor clip livedoor clip

お名前:
E-mail:
右の画像に書かれている文字列を入力してください:
コメント:
[]

«前の日記(2008-05-12) 最新 次の日記(2008-06-02)» 編集

最近の記事

最近のコメント

  1. willnet (07-29)
  2. 要望 (07-19)
  3. nog (05-12)
  4. Googleから (05-10)
  5. nog (05-10)
  6. nog (02-25)
  7. yet (02-24)
  8. TERRAZI (02-24)
  9. nog (02-19)
  10. nog (02-19)

最近のトラックバック

  1. treasuring misc.:軍議nightにて、.. (2007-08-21 13:01)
  2. プッチャンの無双声優マニアック.. (2007-06-06 11:01)
  3. エム会議:まるでドラゴンクエス.. (2006-12-19 00:05)

作ったもんとか

チョコ鑑定
あなたのもらったチョコのレシピを鑑定します。
今時名前メーカー
あなたに今風の名前をプレゼントします。
コピペ運動会
ユーザー参加型コピペ投稿サイト
はうまっち?
楽天市場の価格を当て合うコミュニティ
Award on Rails楽天賞受賞

アンテナ

タグリスト

過去ログ

2003|08|09|10|11|12|
2004|01|02|03|04|05|06|07|08|09|10|11|12|
2005|01|02|03|04|05|
2006|05|06|06|07|08|09|10|11|12|
2007|01|02|03|04|05|06|07|08|09|10|11|12|
2008|01|02|04|05|06|07|

その他

フィードメーター - 野ログはノロキュアMaxHeart あわせて読みたいブログパーツ