更新了Rails测试套件设置?

时间:2013-03-16 04:17:12

标签: ruby-on-rails rspec guard growl

任何人都知道Rails Rspec / Guard / Spork / Growl测试套件的最新版本设置?

这些曾经很棒,但随着Ruby,Rails和宝石的升级已经过时了。

http://ygamretuta.me/2011/08/10/rails-3-setting-up-guard-with-rspec-and-spork-with-growl-notifications-in-osx/

https://eq8scrapbook.heroku.com/equivalents_scrap/on_rspec_spork_guard_configuration

即使是M. Hartl Ruby on Rails Tutorial指令也会导致Guard丢失ChildProcess错误并且不会加载DRb服务器。

1 个答案:

答案 0 :(得分:0)

以上是我发现的解决上述问题的方法:

rails new app_name --skip-test-framework

<强>的Gemfile

source 'https://rubygems.org'

gem 'rails', '3.2.12'
gem 'bootstrap-sass', '2.1'
gem 'bcrypt-ruby', '3.0.1'
gem 'faker', '1.0.1'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.6'
gem 'jquery-rails', '2.0.2'

group :development, :test do
  gem 'sqlite3', '1.3.5'
  gem 'rspec-rails', '2.11.0'
  gem 'rspec', '2.11.0'
  gem 'guard', '1.6.2'
  gem 'guard-rspec', '1.2.1'
  gem 'guard-spork', '1.4.2'  
  gem 'spork-rails', '3.2.1'
  gem 'spork', '1.0.0rc3'
end

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '3.2.5'
  gem 'coffee-rails', '3.2.2'
  gem 'uglifier', '1.2.3'
end

group :test do
  gem 'capybara', '1.1.2'
  gem 'factory_girl_rails', '4.1.0'
  gem 'database_cleaner', '0.7.0'
  gem 'launchy', '2.1.0'
  gem 'rb-fsevent', :require => false
  gem 'growl', '1.0.3'
end

group :production do
  gem 'pg', '0.12.2'
end

然后运行:

bundle update; bundle install; rails g rspec:install; guard init rspec; guard init spork; spork --bootstrap

<强> Guardfile

将增强的spork块放在rspec块之前

<强> spec_helper.rb

将块放在&#34; ENV [&#34; RAILS_ENV&#34;] || =&#39; test&#39;&#34;在Spork.prefork块里面

<强> .rspec 添加--drb

跑步&#39;守卫&#39;你应该全力以赴。