Search code examples
ruby-on-railsrspecguardgrowl

Updated Rails test suite set up?


Anyone know of a more up-to-date version of a Rails Rspec/Guard/Spork/Growl test suite set up?

These used to be great, but have become outdated as Ruby, Rails and the gems upgraded.

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

Even the M. Hartl Ruby on Rails Tutorial instructions results in Guard tossing up a ChildProcess error and doesn't load the DRb server.


Solution

  • Here's what I've found to fix my problem above:

    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
    

    Then run this:

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

    Guardfile

    Put the boostrapped spork block before the rspec block

    spec_helper.rb

    Put the block starting with "ENV["RAILS_ENV"] ||= 'test'" inside the Spork.prefork block

    .rspec add --drb

    Run 'guard' and you should be all set.