ruby Rails Test Helper rails_helper.rb
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ruby Rails Test Helper rails_helper.rb相关的知识,希望对你有一定的参考价值。
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'
# Next two lines to test device
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!
end
以上是关于ruby Rails Test Helper rails_helper.rb的主要内容,如果未能解决你的问题,请参考以下文章
ruby on rails AbstractController::Helpers::MissingHelperError: Missing helper file helpers//
为啥 Ruby on Rails 的 URL Helper 在我的 URL 中加上句点?
如何在 Ruby-on-Rails 中生成 PDF 表单
Circle CI 上的 Rspec 测试失败(Ruby on Rails 5.2.3)
安装 rubyracer 时出错
ruby 来自http://robots.thoughtbot.com/how-we-test-rails-applications