环境1.9.3 3.2.3,3.0以下的rails好像不支持
1. Guardfile
group :test do gem 'guard' gem 'guard-rspec' gem 'guard-cucumber' gem 'guard-livereload' gem 'rspec-rails' gem 'cucumber-rails' gem 'spork' gem 'guard-spork' gem 'rspec' gem 'cucumber' gem 'database_cleaner'
gem 'capybara' gem 'webrat' end
现在cucumber不常用,可以去掉了
group :development,:test do gem 'guard' gem 'guard-rspec' gem 'guard-livereload' gem 'rspec-rails' gem 'spork' gem 'guard-spork' gem 'rspec' gem 'database_cleaner' gem 'webrat' end
2.bundle install
3.guard init
4.
rm -R test Guardfile guard 'spork',:wait=>60,:cli=>'--drb',rspec :cli=>"--color --format nested --fail-fast --drb" cucumber :cli => '-c --drb --port 1234 --profile guard'
5.
rails generate cucumber:install rails generate rspec:install spork --bootstrap spork cucumber --bootstrap
6. rake db:test:prepare
7.http://datacodescotch.blogspot.com/2011/11/warning-cucumber-rails-required-outside.html
undefined method `allow_rescue=' for ActionController::Base:Class (NoMethodError)gem 'cucumber-rails',require: false
8 . 建立项目的时候可以
rails new railtest --skip-test-unit --skip-bundle -d postgresql
9. 不使用test_unit
appication.rb
config.generators do |g| g.test_framework :rspec #=> or whatever end