-
Create app, skipping TestUnit and specifying a Postgres db:
$ rails new app_name -T --database=postgresql
-
Update the Gemfile: Gemfile:
gem 'haml' gem 'haml-rails' group :development, :test do gem 'rspec-rails' gem 'factory_girl_rails' gem 'shoulda-matchers', '~> 3.1' gem 'faker' gem 'database_cleaner'
-
Bundle:
$ bundle
-
Install RSpec:
$ rails g rspec:install
-
Create
spec/support/factory_girl.rb
:RSpec.configure do |config| config.include FactoryGirl::Syntax::Methods end
-
Update
rails_helper.rb
:require 'spec_helper' require 'rspec/rails' require 'database_cleaner' # Require support files Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f } # Configure shoulda matchers Shoulda::Matchers.configure do |config| config.integrate do |with| with.test_framework :rspec with.library :rails end end Rspec.configure do |config| # ... config.include FactoryGirl::Syntax::Methods config.before(:suite) do DatabaseCleaner.clean_with(:truncation) DatabaseCleaner.strategy = :transaction end config.around(:each) do |example| DatabaseCleaner.cleaning do example.run end end
-
Convert app layout to haml:
$ rails g haml:application_layout convert
-
Set up db:
$ rake db:create db:migrate
-
-
Save malachaifrazier/f6e06ec46a6c67967025f267f44c1aac to your computer and use it in GitHub Desktop.
Steps for creating a new rails app with a Postgres database, Haml, RSpec and FactoryGirl
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment