Created
June 3, 2018 15:42
-
-
Save tuffs/15042f11938f1bdd7ed00970660645dc to your computer and use it in GitHub Desktop.
RSpec with Capybara rails_helper.rb
This file contains 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
ENV['RAILS_ENV'] ||= 'test' | |
require File.expand_path('../../config/environment', __FILE__) | |
abort("The Rails environment is running in production mode!") if Rails.env.production? | |
require 'spec_helper' | |
require 'rspec/rails' | |
require 'capybara/rails' | |
#WARDEN SETUP | |
# include Warden::Test::Helpers | |
# Warden.test_mode! | |
ActiveRecord::Migration.maintain_test_schema! | |
RSpec.configure do |config| | |
config.fixture_path = "#{::Rails.root}/spec/fixtures" | |
config.use_transactional_fixtures = false | |
config.before(:suite) { DatabaseCleaner.clean_with(:truncation) } | |
config.before(:each) { DatabaseCleaner.strategy = :transaction } | |
config.before(:each, :js => true) { DatabaseCleaner.strategy = :truncation } | |
config.before(:each) { DatabaseCleaner.start } | |
config.after(:each) { DatabaseCleaner.clean } | |
config.infer_spec_type_from_file_location! | |
config.filter_rails_from_backtrace! | |
#WARDEN CONFIG | |
# config.include Warden::Test::Helpers | |
# config.include FactoryBot::Syntax::Methods | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uncomment the two lines after #WARDEN CONFIG lines to bring in Warden and FactoryBot helper methods.