『追記:rspec, spork, guard で自動テストをやってみる』
RSpec, Spork
RSpec インストール済み、かつ既にテスト書いてある前提で
Install
Gemfile
group :development, :test do gem "rspec-rails" gem 'spork' end
shell
$ bundle install : $ spork --bootstrap
spec/spec_helper.rb
require 'rubygems' require 'spork' #uncomment the following line to use spork with the debugger #require 'spork/ext/ruby-debug' Spork.prefork do # Loading more in this block will cause your tests to run faster. However, # if you change any configuration or code from libraries loaded here, you'll # need to restart spork for it take effect. # ここの元々あった設定を入れる end
Run: spork
別窓のシェルで
$ spork Using RSpec Preloading Rails environment Loading Spork.prefork block... Spork is ready and listening on 8989!
追記:rspec, spork, guard で自動テストをやってみる
ファイルを編集保存すると自動でテストしてくれる
Gemfile
group :development, :test do gem 'rspec-rails' gem "spork-rails" gem 'guard-spork' gem 'guard-rspec' end
bundle
$ bundle install
rspec
$ rails generate rspec:install create .rspec exist spec create spec/spec_helper.rb
--color
--format d #任意で
Guard
rake db:migrate やっておく前提で
$ guard init spork $ guard init rspec
動かす
シェルで
$ guard