2015-04-27 12:51:43 +00:00
|
|
|
ENV['RAILS_ENV'] = 'test'
|
2015-04-28 21:08:11 +00:00
|
|
|
# rubocop:disable ClassAndModuleChildren
|
2012-04-10 13:31:21 +00:00
|
|
|
require File.expand_path('../../config/environment', __FILE__)
|
|
|
|
require 'rails/test_help'
|
2014-08-03 12:57:03 +00:00
|
|
|
require 'cache'
|
2013-01-08 13:56:20 +00:00
|
|
|
require 'simplecov'
|
2012-11-08 20:21:01 +00:00
|
|
|
require 'simplecov-rcov'
|
2012-04-10 13:31:21 +00:00
|
|
|
|
2015-04-27 21:01:04 +00:00
|
|
|
class ActiveSupport::TestCase
|
|
|
|
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
|
|
|
|
#
|
|
|
|
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
|
|
|
# -- they do not yet inherit this setting
|
|
|
|
SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
|
|
|
|
SimpleCov.start
|
|
|
|
fixtures :all
|
2012-04-10 13:31:21 +00:00
|
|
|
|
2015-04-27 21:01:04 +00:00
|
|
|
# disable transactions
|
|
|
|
self.use_transactional_fixtures = false
|
2012-12-26 22:02:16 +00:00
|
|
|
|
2015-04-27 21:01:04 +00:00
|
|
|
# clear cache
|
|
|
|
Cache.clear
|
2014-08-03 12:57:03 +00:00
|
|
|
|
2015-04-27 21:01:04 +00:00
|
|
|
# load seeds
|
|
|
|
load "#{Rails.root}/db/seeds.rb"
|
2012-05-06 20:48:23 +00:00
|
|
|
|
2015-05-01 22:58:43 +00:00
|
|
|
# proccess background jobs
|
|
|
|
Delayed::Worker.new.work_off
|
|
|
|
|
2015-04-27 21:01:04 +00:00
|
|
|
# set system mode to done / to activate
|
|
|
|
Setting.set('system_init_done', true)
|
2014-11-10 20:34:15 +00:00
|
|
|
|
2015-05-01 22:58:43 +00:00
|
|
|
def setup
|
2013-04-20 09:52:33 +00:00
|
|
|
|
2015-04-27 21:01:04 +00:00
|
|
|
# clear cache
|
|
|
|
Cache.clear
|
2015-02-25 21:35:37 +00:00
|
|
|
|
2015-04-27 21:01:04 +00:00
|
|
|
# set current user
|
|
|
|
puts 'reset UserInfo.current_user_id'
|
|
|
|
UserInfo.current_user_id = nil
|
2013-04-20 09:52:33 +00:00
|
|
|
end
|
2015-04-27 21:01:04 +00:00
|
|
|
|
2015-05-01 22:58:43 +00:00
|
|
|
# cleanup jobs
|
|
|
|
def teardown
|
|
|
|
puts 'teardown'
|
|
|
|
|
|
|
|
# check if jobs are proccessed
|
|
|
|
if !Delayed::Job.all.empty?
|
|
|
|
Delayed::Job.all.destroy_all
|
|
|
|
end
|
|
|
|
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
|