Tbpgr Blog

Employee Experience Engineer tbpgr(てぃーびー) のブログ

Sublime Text2 | Sublime Text2 Ruby TestsでTestUnit,Cucumber,RSpecのテストを効率化

概要

Sublime Text2 Ruby でTestUnit,Cucumber,RSpecのテストを効率化

内容

インストール

・Ctrl+Shift+P,install,Enter,RubyTest

設定

・'Sublime Text 2' -> 'Preferences' -> 'Package Settings' -> 'RubyTest' -> Setting-User
デフォルトから変更したい場合は上記を編集する
・設定例
bundler,springを利用してrspecを実行するように設定

{
  "run_rspec_command": "bundle exec spring rspec {relative_path}",
  "run_single_rspec_command": "bundle exec spring  rspec {relative_path} -l{line_number}"
}

※rbenvの設定次第では以下のようにする

{
  "run_rspec_command": "~/.rbenv/shims/bundle exec spring rspec {relative_path}",
  "run_single_rspec_command": "~/.rbenv/shims/bundle exec spring  rspec {relative_path} -l{line_number}"
}
操作
コマンド 操作内容
Ctrl+Shift+r テスト実行(カーソルの位置を基準に1ケース)
Ctrl+Shift+t テスト実行(ファイル内の全ケース)
Ctrl+. プロダクトコードとテストコードの切り替え
Ctrl+Shift+. プロダクトコードとテストコードを分割ビューで表示
Ctrl+Shift+x テストパネルの表示 ※escで非表示にする
Alt+Shift+V Rubyとerbの文法チェック