2015-04-27 12:51:43 +00:00
|
|
|
ENV['RAILS_ENV'] = 'test'
|
2018-04-12 14:57:37 +00:00
|
|
|
require File.expand_path('../config/environment', __dir__)
|
2014-11-14 06:42:39 +00:00
|
|
|
require 'rails/test_help'
|
|
|
|
require 'cache'
|
|
|
|
|
2015-04-27 21:01:04 +00:00
|
|
|
class ActiveSupport::TestCase
|
2017-11-06 01:32:47 +00:00
|
|
|
|
|
|
|
# disable transactions / to work with own database connections for each thread
|
|
|
|
self.use_transactional_tests = false
|
2014-11-14 06:42:39 +00:00
|
|
|
|
2017-06-14 15:25:45 +00:00
|
|
|
ActiveRecord::Base.logger = Rails.logger.clone
|
|
|
|
ActiveRecord::Base.logger.level = Logger::INFO
|
|
|
|
|
2015-04-27 21:01:04 +00:00
|
|
|
# clear cache
|
|
|
|
Cache.clear
|
2014-11-14 06:42:39 +00:00
|
|
|
|
2015-04-27 21:01:04 +00:00
|
|
|
# load seeds
|
2017-11-23 08:09:44 +00:00
|
|
|
load Rails.root.join('db', 'seeds.rb')
|
|
|
|
load Rails.root.join('test', 'fixtures', 'seeds.rb')
|
2014-11-14 06:42:39 +00:00
|
|
|
|
2015-04-27 21:01:04 +00:00
|
|
|
setup do
|
2015-02-25 23:44:29 +00:00
|
|
|
|
2015-04-27 21:01:04 +00:00
|
|
|
# clear cache
|
|
|
|
Cache.clear
|
2014-11-14 06:42:39 +00:00
|
|
|
|
2017-11-06 01:32:47 +00:00
|
|
|
# reload settings
|
|
|
|
Setting.reload
|
|
|
|
|
2017-06-14 15:25:45 +00:00
|
|
|
# remove all session messages
|
|
|
|
Sessions.cleanup
|
|
|
|
|
2015-04-27 21:01:04 +00:00
|
|
|
# set current user
|
|
|
|
UserInfo.current_user_id = nil
|
2015-04-27 20:49:17 +00:00
|
|
|
end
|
2015-04-27 21:01:04 +00:00
|
|
|
|
|
|
|
# Add more helper methods to be used by all tests here...
|
2015-04-27 14:15:29 +00:00
|
|
|
end
|