integration_test_helper.rb 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. ENV['RAILS_ENV'] = 'test'
  3. require File.expand_path('../config/environment', __dir__)
  4. require 'rails/test_help'
  5. require 'test_support_helper'
  6. class ActiveSupport::TestCase
  7. # disable transactions / to work with own database connections for each thread
  8. self.use_transactional_tests = false
  9. ActiveRecord::Base.logger = Rails.logger.clone
  10. ActiveRecord::Base.logger.level = Logger::INFO
  11. # clear cache
  12. Rails.cache.clear
  13. # load seeds
  14. load Rails.root.join('db/seeds.rb')
  15. load Rails.root.join('test/fixtures/seeds.rb')
  16. # set system mode to done / to activate
  17. Setting.set('system_init_done', true)
  18. setup do
  19. # clear cache
  20. Rails.cache.clear
  21. # reload settings
  22. Setting.reload
  23. # remove all session messages
  24. Sessions.cleanup
  25. # remove old delayed jobs
  26. Delayed::Job.destroy_all
  27. # set current user
  28. UserInfo.current_user_id = nil
  29. travel_back
  30. end
  31. # Add more helper methods to be used by all tests here...
  32. end