Skip to content

Instantly share code, notes, and snippets.

@weavenet
Created December 31, 2011 07:07
Show Gist options
  • Save weavenet/1543197 to your computer and use it in GitHub Desktop.
Save weavenet/1543197 to your computer and use it in GitHub Desktop.
Configure Rails 3.1.X to use HAML, rspec andfactory girl
Gemfile:
source 'http://rubygems.org'
gem 'rails', '3.1.3'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'haml'
gem 'haml-rails'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.1.5'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
group :test do
#gem 'turn', '0.8.2', :require => false
gem 'rspec-rails'
end
group :development, :test do
# Pretty printed test output
gem 'rspec'
gem 'rspec-rails'
gem 'sqlite3'
gem 'rails3-generators'
gem 'rspec-rails'
gem 'factory_girl_rails'
gem 'capybara'
end
# Required for heroku postgres
gem 'pg', :group => :production
---------------------------------
Add factory girl to spec
require 'factory_girl'
FactoryGirl.find_definitions
--------------------------
Add to application.rb
config.generators do |g|
g.test_framework :rspec, :views => false
g.fixture_replacement :factory_girl, :dir => 'spec/factories'
g.form_builder :simple_form
g.template_engine :haml
end
# in config/application.rb
config.autoload_paths += %W(#{config.root}/lib)
config.autoload_paths += Dir["#{config.root}/lib/**/"]
---------------------------
Commands to run
bundle
rails g rspec:install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment