Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@intentionally-left-nil
Created October 17, 2017 18:46
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save intentionally-left-nil/587b01c84e55ac7c385f7504724af944 to your computer and use it in GitHub Desktop.
Save intentionally-left-nil/587b01c84e55ac7c385f7504724af944 to your computer and use it in GitHub Desktop.
Rails test setup
group :test do
gem 'rspec-rails'
gem 'simplecov', require: false
gem 'rails-controller-testing'
gem 'shoulda-matchers'
gem 'faker'
gem 'capybara'
gem 'poltergeist'
gem 'factory_girl_rails'
gem 'database_cleaner'
end
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, js_errors: false)
end
DatabaseCleaner.strategy = :truncation
RSpec.configure do |config|
config.use_transactional_fixtures = false
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each, :js => true) do
DatabaseCleaner.strategy = :truncation
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
end
require 'simplecov'
SimpleCov.start 'rails'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment