Project

rspec_term

0.0
No commit activity in last 3 years
No release in over 3 years
Change iTerm background after RSpec execution.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.5
>= 0
~> 3.0.0.rc1
 Project Readme

RspecTerm

ver 0.3.0

RSpecの実行中や、テスト結果によってiTermの背景画像を変更する ruby gem です。
RSpec2, RSpec3に対応しています。

Installation

Add this line to your application's Gemfile:

gem 'rspec_term'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rspec_term

Usage

spec/spec_helper.rb ファイルに以下を記述します

require 'rspec_term'

RSpecTerm.configure do |config|

  #dir = File.expand_path(File.join('../', 'images'), File.dirname(__FILE__))
  #config.success_file = "#{dir}/success.jpg"
  #config.running_file = "#{dir}/running.jpg"
  #config.failure_file = "#{dir}/failure.jpg"
  #config.nothing_file = "#{dir}/nothing.jpg"

  config.success_url = 'https://raw.githubusercontent.com/brightgenerous/rspec_term/master/images/success.jpg'
  config.running_url = 'https://raw.githubusercontent.com/brightgenerous/rspec_term/master/images/running.jpg'
  config.failure_url = 'https://raw.githubusercontent.com/brightgenerous/rspec_term/master/images/failure.jpg'
  config.nothing_url = 'https://raw.githubusercontent.com/brightgenerous/rspec_term/master/images/nothing.jpg'
  config.tmp_dir = '/tmp/rspec_term'

  require 'simplecov'
  config.coverage do
    SimpleCov.result.covered_percent
  end
  config.coverage_url do |coverage|
    case coverage
    when 70..100
      'https://raw.githubusercontent.com/brightgenerous/rspec_term/master/images/coverage_100.jpg'
    end
  end

end

基本的な使い方

  • success_file : テストがエラーなしで終了した場合に表示される画像のファイル。success_urlよりも優先される。

  • running_file : テスト実行中表示される画像のファイル。running_urlよりも優先される。

  • failure_file : テストがエラーありで終了した場合に表示される画像のファイル。failure_urlよりも優先される。

  • nothing_file : 行うべきテストがなかった場合に表示される画像のファイル。nothing_urlよりも優先される。

  • success_url : テストがエラーなしで終了した場合に表示される画像のURL。

  • running_url : テスト実行中表示される画像のURL。

  • failure_url : テストがエラーありで終了した場合に表示される画像のURL。

  • nothing_url : 行うべきテストがなかった場合に表示される画像のURL。

  • tmp_dir : URLの画像を保存するディレクトリ。URLから生成したハッシュをファイル名として保存する。すでにファイルが存在する場合は再度ダウンロードしない。

  • coverage : coverageの値(%)を返す

  • coverage_file : テストがエラーなしで終了した場合にcoverageに応じて表示される画像のファイルを返す。該当する場合はsuccess_fileよりも優先される。

  • coverage_url : テストがエラーなしで終了した場合にcoverageに応じて表示される画像のURLを返す。該当する場合はsuccess_urlよりも優先される。

Contributing

  1. Fork it ( http://github.com//rspec_term/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request