Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Generate a new project without the included testing and with a postgres database:
- ```bash
- rails new MyApp -T --database=postgresql
- ```
- Add rspec, capybara, factory_girl, launchy and database cleaner to gemfile:
- ```ruby
- group :development, :test do
- gem 'rspec-rails'
- gem 'capybara'
- gem 'factory_girl_rails'
- gem 'launchy'
- gem 'database_cleaner'
- end
- ```
- Install gems and generate rspec files:
- ```bash
- bundle
- rails g rspec:install
- ```
- Create directory and folder for factory girl:
- ```bash
- mkdir spec/support
- touch spec/support/factory_girl.rb
- ```
- Add Rspec configuration to factory_girl.rb:
- ```ruby
- RSpec.configure do |config|
- config.include FactoryGirl::Syntax::Methods
- config.before(:suite) do
- begin
- DatabaseCleaner.start
- FactoryGirl.lint
- ensure
- DatabaseCleaner.clean
- end
- end
- end
- ```
- Uncomment this line from rails_helper.rb
- ```ruby
- Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement