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 class ClearbitTest < ActiveSupport::TestCase
self.use_transactional_tests = true
# check # check
test 'base' do test 'base' do

View file

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

View file

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

View file

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

View file

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

View file

@ -3,7 +3,6 @@ require 'integration_test_helper'
class ZendeskImportTest < ActiveSupport::TestCase class ZendeskImportTest < ActiveSupport::TestCase
self.test_order = :sorted self.test_order = :sorted
self.use_transactional_tests = false
if !ENV['IMPORT_ZENDESK_ENDPOINT'] if !ENV['IMPORT_ZENDESK_ENDPOINT']
raise "ERROR: Need IMPORT_ZENDESK_ENDPOINT - hint IMPORT_ZENDESK_ENDPOINT='https://example.zendesk.com/api/v2'" 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('db', 'seeds.rb')
load Rails.root.join('test', 'fixtures', '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 setup do
# clear cache # clear cache
@ -31,8 +34,13 @@ class ActiveSupport::TestCase
# remove all session messages # remove all session messages
Sessions.cleanup Sessions.cleanup
# remove old delayed jobs
Delayed::Job.destroy_all
# set current user # set current user
UserInfo.current_user_id = nil UserInfo.current_user_id = nil
travel_back
end end
# Add more helper methods to be used by all tests here... # Add more helper methods to be used by all tests here...