Skip to content

Instantly share code, notes, and snippets.

@gmgp
Forked from bsodmike/spec_helper.rb
Created November 21, 2011 12:30
Show Gist options
  • Save gmgp/1382511 to your computer and use it in GitHub Desktop.
Save gmgp/1382511 to your computer and use it in GitHub Desktop.
RSpec + Cucumber BDD Stack for Rails 3 with Spork and Guard

RSpec + Cucumber BDD Stack for Rails 3 with Spork and Guard

Steps to follow, Ref:

  • Update Gemfile
  • bundle install
  • rails g rspec:install
  • Edit .rspec
    --colour
    --format progress
    --drb
    -fs
  • spork --bootstrap
  • Edit spec/spec_helper.rb
  • rails generate cucumber:install --rspec --spork
  • rails g jquery:install --ui
  • guard init spork
  • guard init rspec
  • guard init cucumber
source 'http://rubygems.org'
gem 'rails', '3.0.9'
gem 'jquery-rails'
group :development do
gem 'sqlite3'
gem 'nifty-generators'
gem 'ruby-debug', :platform => :ruby_18
gem 'ruby-debug19', :platform => :ruby_19
gem 'rspec-rails'
end
group :development, :test do
gem 'spork'
end
group :test do
gem 'rspec'
gem 'cucumber'
gem 'cucumber-rails'
gem 'capybara'
gem 'launchy'
gem 'factory_girl_rails'
gem 'rb-fsevent'
gem 'guard-spork'
gem 'guard-rspec'
gem 'guard-cucumber'
gem 'guard-livereload'
# gem 'growl'
# gem 'delorean' # travel in time, for testing.
gem 'database_cleaner'
# gem 'autotest'
# gem 'autotest-rails'
# gem 'autotest-fsevent'
# gem 'autotest-growl'
# gem 'mocha'
end
require 'rubygems'
require 'spork'
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.
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'factory_girl'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
RSpec.configure do |config|
config.mock_with :rspec
#config.fixture_path = "#{::Rails.root}/spec/fixtures"
#config.use_transactional_fixtures = true
end
end
Spork.each_run do
# This code will be run each time you run your specs.
end
# --- Instructions ---
# - Sort through your spec_helper file. Place as much environment loading
# code that you don't normally modify during development in the
# Spork.prefork block.
# - Place the rest under Spork.each_run block
# - Any code that is left outside of the blocks will be ran during preforking
# and during each_run!
# - These instructions should self-destruct in 10 seconds. If they don't,
# feel free to delete them.
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment