Advertisement
Guest User

Untitled

a guest
Oct 24th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. Generate a new project without the included testing and with a postgres database:
  2. ```bash
  3. rails new MyApp -T --database=postgresql
  4. ```
  5.  
  6. Add rspec, capybara, factory_girl, launchy and database cleaner to gemfile:
  7. ```ruby
  8. group :development, :test do
  9. gem 'rspec-rails'
  10. gem 'capybara'
  11. gem 'factory_girl_rails'
  12. gem 'launchy'
  13. gem 'database_cleaner'
  14. end
  15. ```
  16.  
  17. Install gems and generate rspec files:
  18. ```bash
  19. bundle
  20. rails g rspec:install
  21. ```
  22.  
  23. Create directory and folder for factory girl:
  24. ```bash
  25. mkdir spec/support
  26. touch spec/support/factory_girl.rb
  27. ```
  28.  
  29. Add Rspec configuration to factory_girl.rb:
  30. ```ruby
  31. RSpec.configure do |config|
  32. config.include FactoryGirl::Syntax::Methods
  33. config.before(:suite) do
  34. begin
  35. DatabaseCleaner.start
  36. FactoryGirl.lint
  37. ensure
  38. DatabaseCleaner.clean
  39. end
  40. end
  41. end
  42. ```
  43.  
  44. Uncomment this line from rails_helper.rb
  45. ```ruby
  46. Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
  47. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement