2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
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'
|
|
|
|
|
2018-06-03 15:24:35 +00:00
|
|
|
require 'test_support_helper'
|
|
|
|
|
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
|
2020-02-18 19:51:31 +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
|
|
|
|
2018-06-25 11:07:47 +00:00
|
|
|
# set system mode to done / to activate
|
|
|
|
Setting.set('system_init_done', true)
|
|
|
|
|
2021-07-09 13:05:05 +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
|
|
|
|
|
2018-06-25 11:07:47 +00:00
|
|
|
# remove old delayed jobs
|
|
|
|
Delayed::Job.destroy_all
|
|
|
|
|
2015-04-27 21:01:04 +00:00
|
|
|
# set current user
|
|
|
|
UserInfo.current_user_id = nil
|
2018-06-25 11:07:47 +00:00
|
|
|
|
|
|
|
travel_back
|
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
|