2016-09-24 03:00:46 +00:00
|
|
|
# frozen_string_literal: true
|
2017-11-06 16:15:18 +00:00
|
|
|
|
2015-10-12 03:26:48 +00:00
|
|
|
ENV['RAILS_ENV'] ||= 'test'
|
2016-09-21 17:22:40 +00:00
|
|
|
require 'spec_helper'
|
2015-10-12 03:26:48 +00:00
|
|
|
require File.expand_path('../../config/environment', __FILE__)
|
2016-09-21 17:22:40 +00:00
|
|
|
require 'rspec/rails'
|
2015-12-16 14:33:29 +00:00
|
|
|
|
2015-10-12 03:26:48 +00:00
|
|
|
# Prevent database truncation if the environment is production
|
2015-12-16 14:33:29 +00:00
|
|
|
if Rails.env.production?
|
|
|
|
abort('The Rails environment is running in production mode!')
|
|
|
|
end
|
|
|
|
|
2015-12-16 14:16:02 +00:00
|
|
|
# require all support files
|
|
|
|
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
|
2015-10-12 03:26:48 +00:00
|
|
|
|
2016-09-21 17:22:40 +00:00
|
|
|
ActiveRecord::Migration.maintain_test_schema!
|
|
|
|
|
2015-10-12 03:26:48 +00:00
|
|
|
RSpec.configure do |config|
|
|
|
|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
|
|
|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
|
|
|
|
|
|
|
config.use_transactional_fixtures = true
|
|
|
|
|
|
|
|
config.infer_spec_type_from_file_location!
|
2015-12-16 13:32:50 +00:00
|
|
|
|
2015-12-17 01:16:02 +00:00
|
|
|
config.include Shoulda::Matchers::ActiveModel, type: :model
|
|
|
|
config.include Shoulda::Matchers::ActiveRecord, type: :model
|
2015-10-12 03:26:48 +00:00
|
|
|
end
|