Skip to content

Instantly share code, notes, and snippets.

@sameera207
Created December 16, 2012 08:06
Show Gist options
  • Save sameera207/4304166 to your computer and use it in GitHub Desktop.
Save sameera207/4304166 to your computer and use it in GitHub Desktop.
My Rails3 testing environment with Rspec, cucumber and guard and spork to keep the tests faster and automatic
==== Gem file
group :test, :development do
gem "rspec-rails", "~> 2.0"
gem 'database_cleaner'
gem 'capybara'
gem "factory_girl_rails", ">= 4.1.0"
gem 'cucumber-rails', :require => false
gem 'mocha'
gem "shoulda-matchers"
gem "spork"
gem 'guard-rspec'
gem "guard-spork"
gem 'rb-inotify', '~> 0.8.8'
gem 'cucumber-rails', :require => false
gem 'cucumber-rails-training-wheels' #Still running on 'L' board
end
==== config file (application.rb)
#view specs will be covered by integration tests with cucumber
config.generators do |g|
g.test_framework :rspec, fixture: true
g.fixture_replacement :factory_girl
g.view_specs false
end
=== install rcpec
rails g rspec:install
=== install cucumber
rails g cucumber:install
=== bootsrap spork
spork --bootstrap
*** move the file loads between the 'prefork' section
*** reload factory girl inside 'each_run' section
Spork.each_run do
# This code will be run each time you run your specs.
FactoryGirl.reload
end
=== add guard
guard init rspec
guard init spork
** move 'spork' section up above the guard section
** update guard
guard 'rspec', :version => 2, :cli => '--drb' do
=== start guard
bundle exec guard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment