Created
October 17, 2017 18:46
-
-
Save intentionally-left-nil/587b01c84e55ac7c385f7504724af944 to your computer and use it in GitHub Desktop.
Rails test setup
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
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 |
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
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 |
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
require 'simplecov' | |
SimpleCov.start 'rails' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment