Review of correct test helper for integration tests.

This commit is contained in:
Martin Edenhofer 2018-06-25 13:07:47 +02:00
parent 4120afb131
commit 76f3a2876b
7 changed files with 14 additions and 13 deletions

View file

@ -1,8 +1,7 @@
require 'integration_test_helper'
require 'test_helper'
class ClearbitTest < ActiveSupport::TestCase
self.use_transactional_tests = true
# check
test 'base' do

View file

@ -1,7 +1,7 @@
require 'test_helper'
require 'integration_test_helper'
class MonitoringControllerTest < ActionDispatch::IntegrationTest
self.use_transactional_tests = false
setup do
# set accept header
@ -75,8 +75,6 @@ class MonitoringControllerTest < ActionDispatch::IntegrationTest
roles: roles,
)
# ensure fresh state
Delayed::Job.destroy_all
end
test '01 monitoring without token' do

View file

@ -1,8 +1,7 @@
require 'test_helper'
require 'integration_test_helper'
require 'rake'
class ObjectManagerAttributesControllerTest < ActionDispatch::IntegrationTest
self.use_transactional_tests = false
setup do

View file

@ -1,7 +1,6 @@
require 'test_helper'
require 'integration_test_helper'
class ObjectManagerTest < ActiveSupport::TestCase
self.use_transactional_tests = false
test 'a object manager' do

View file

@ -1,8 +1,7 @@
require 'test_helper'
require 'integration_test_helper'
class PackageTest < ActiveSupport::TestCase
self.use_transactional_tests = false
test 'packages' do
tests = [

View file

@ -3,7 +3,6 @@ require 'integration_test_helper'
class ZendeskImportTest < ActiveSupport::TestCase
self.test_order = :sorted
self.use_transactional_tests = false
if !ENV['IMPORT_ZENDESK_ENDPOINT']
raise "ERROR: Need IMPORT_ZENDESK_ENDPOINT - hint IMPORT_ZENDESK_ENDPOINT='https://example.zendesk.com/api/v2'"

View file

@ -20,6 +20,9 @@ class ActiveSupport::TestCase
load Rails.root.join('db', 'seeds.rb')
load Rails.root.join('test', 'fixtures', 'seeds.rb')
# set system mode to done / to activate
Setting.set('system_init_done', true)
setup do
# clear cache
@ -31,8 +34,13 @@ class ActiveSupport::TestCase
# remove all session messages
Sessions.cleanup
# remove old delayed jobs
Delayed::Job.destroy_all
# set current user
UserInfo.current_user_id = nil
travel_back
end
# Add more helper methods to be used by all tests here...