Last active
December 17, 2018 13:09
-
-
Save danilolic/b596fe40bc1a8e38652e5dff1bbead45 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Gemfile | |
| group :development do | |
| # Access an interactive console on exception pages or by calling 'console' anywhere in the code. | |
| gem 'web-console', '>= 3.3.0' | |
| gem 'listen', '>= 3.0.5', '< 3.2' | |
| # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring | |
| gem 'spring' | |
| gem 'spring-watcher-listen', '~> 2.0.0' | |
| gem 'spring-commands-rspec' | |
| end | |
| group :development, :test do | |
| # Call 'byebug' anywhere in the code to stop execution and get a debugger console | |
| gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] | |
| gem 'faker' | |
| gem 'factory_bot_rails' | |
| gem 'pry-rails' | |
| end | |
| group :test do | |
| gem 'rspec-rails', '~> 3.7' | |
| gem 'shoulda-matchers', '~> 3.1' | |
| gem 'capybara' | |
| gem 'database_cleaner' | |
| end | |
| # bundle install | |
| # rails g rspec:install | |
| # bundle exec spring binstub --all | |
| #.rspec (opcional) | |
| --format documentation | |
| # generates only model and requests specs | |
| # config/application.rb | |
| config.generators do |g| | |
| g.test_framework :rspec | |
| g.helper_specs false | |
| g.controller_specs false | |
| g.view_specs false | |
| g.routing_specs false | |
| end | |
| #spec/rails_helper.rb | |
| require 'database_cleaner' | |
| #spec/rails_helper.rb | |
| config.include FactoryBot::Syntax::Methods | |
| #spec/rails_helper.rb | |
| Shoulda::Matchers.configure do |config| | |
| config.integrate do |with| | |
| with.test_framework :rspec | |
| with.library :rails | |
| end | |
| end | |
| #spec/rails_helper.rb | |
| # start by truncating all the tables but then use the faster transaction strategy the rest of the time. | |
| config.before(:suite) do | |
| DatabaseCleaner.clean_with(:truncation) | |
| DatabaseCleaner.strategy = :transaction | |
| end | |
| # start the transaction strategy as examples are run | |
| config.around(:each) do |example| | |
| DatabaseCleaner.cleaning do | |
| example.run | |
| end | |
| end | |
| #mkdir spec/factories |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment