diff --git a/test/browser/integration_cti_test.rb b/test/browser/integration_cti_test.rb index f4ecbb3c1..1253c6430 100644 --- a/test/browser/integration_cti_test.rb +++ b/test/browser/integration_cti_test.rb @@ -3,7 +3,7 @@ require 'browser_test_helper' class IntegrationCtiTest < TestCase - setup do + before do if !ENV['CTI_TOKEN'] raise "ERROR: Need CTI_TOKEN - hint CTI_TOKEN='some_token'" end diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index 83991aca8..b868d9c7f 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -24,7 +24,7 @@ class TestCase < ActiveSupport::TestCase DEBUG = true - setup do + before do # print current test case to STDOUT # for status reasoning and debugging purposes source_location = self.class.instance_method(method_name).source_location diff --git a/test/integration/elasticsearch_active_test.rb b/test/integration/elasticsearch_active_test.rb index ac73a332f..1f5b04a27 100644 --- a/test/integration/elasticsearch_active_test.rb +++ b/test/integration/elasticsearch_active_test.rb @@ -5,7 +5,7 @@ require 'test_helper' class ElasticsearchActiveTest < ActiveSupport::TestCase include SearchindexHelper - setup do + before do configure_elasticsearch(required: true) diff --git a/test/integration/elasticsearch_test.rb b/test/integration/elasticsearch_test.rb index 90bee129a..bc0d7ad64 100644 --- a/test/integration/elasticsearch_test.rb +++ b/test/integration/elasticsearch_test.rb @@ -5,7 +5,7 @@ require 'test_helper' class ElasticsearchTest < ActiveSupport::TestCase include SearchindexHelper - setup do + before do configure_elasticsearch(required: true) diff --git a/test/integration/email_keep_on_server_test.rb b/test/integration/email_keep_on_server_test.rb index a921ad8d9..5d52abb37 100644 --- a/test/integration/email_keep_on_server_test.rb +++ b/test/integration/email_keep_on_server_test.rb @@ -4,7 +4,7 @@ require 'test_helper' require 'net/imap' class EmailKeepOnServerTest < ActiveSupport::TestCase - setup do + before do if ENV['KEEP_ON_MAIL_SERVER'].blank? raise "Need KEEP_ON_MAIL_SERVER as ENV variable like export KEEP_ON_MAIL_SERVER='mx.example.com'" diff --git a/test/integration/email_postmaster_to_sender.rb b/test/integration/email_postmaster_to_sender.rb index 60e5f7bbb..73f91b0d0 100644 --- a/test/integration/email_postmaster_to_sender.rb +++ b/test/integration/email_postmaster_to_sender.rb @@ -5,7 +5,7 @@ require 'net/imap' class EmailPostmasterToSender < ActiveSupport::TestCase - setup do + before do Setting.set('postmaster_max_size', 0.1) @test_id = rand(999_999_999) diff --git a/test/integration/geo_location_test.rb b/test/integration/geo_location_test.rb index 9cb6caebb..f9cedd87d 100644 --- a/test/integration/geo_location_test.rb +++ b/test/integration/geo_location_test.rb @@ -5,7 +5,7 @@ require 'webmock/minitest' class GeoLocationTest < ActiveSupport::TestCase - setup do + before do @mock = true #WebMock.allow_net_connect! end diff --git a/test/integration/report_test.rb b/test/integration/report_test.rb index 48db03649..ee3f22f8d 100644 --- a/test/integration/report_test.rb +++ b/test/integration/report_test.rb @@ -5,7 +5,7 @@ require 'integration_test_helper' class ReportTest < ActiveSupport::TestCase include SearchindexHelper - setup do + before do # create attribute ObjectManager::Attribute.add( diff --git a/test/integration/user_agent_test.rb b/test/integration/user_agent_test.rb index 5e90bbed7..45fcf2c07 100644 --- a/test/integration/user_agent_test.rb +++ b/test/integration/user_agent_test.rb @@ -6,7 +6,7 @@ class UserAgentTest < ActiveSupport::TestCase host = 'https://web-test.dc.zammad.com' #host = 'http://127.0.0.1:3003' - setup do + before do if ENV['ZAMMAD_PROXY_TEST'] == 'true' Setting.set('proxy', ENV['ZAMMAD_PROXY']) Setting.set('proxy_username', ENV['ZAMMAD_PROXY_USERNAME']) diff --git a/test/integration_test_helper.rb b/test/integration_test_helper.rb index 8ff17f734..fc04bc7ba 100644 --- a/test/integration_test_helper.rb +++ b/test/integration_test_helper.rb @@ -25,7 +25,7 @@ class ActiveSupport::TestCase # set system mode to done / to activate Setting.set('system_init_done', true) - setup do + before do # clear cache Cache.clear diff --git a/test/test_helper.rb b/test/test_helper.rb index ad9295bfe..108653f40 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -22,7 +22,7 @@ class ActiveSupport::TestCase # set system mode to done / to activate Setting.set('system_init_done', true) - setup do + before do # exit all threads Thread.list.each do |thread| diff --git a/test/unit/activity_stream_test.rb b/test/unit/activity_stream_test.rb index c3d5e3c25..eacef67b2 100644 --- a/test/unit/activity_stream_test.rb +++ b/test/unit/activity_stream_test.rb @@ -4,7 +4,7 @@ require 'test_helper' class ActivityStreamTest < ActiveSupport::TestCase - setup do + before do roles = Role.where(name: %w[Admin Agent]) groups = Group.where(name: 'Users') @admin_user = User.create_or_update( diff --git a/test/unit/chat_test.rb b/test/unit/chat_test.rb index 3d014adaf..8f2b85370 100644 --- a/test/unit/chat_test.rb +++ b/test/unit/chat_test.rb @@ -4,7 +4,7 @@ require 'test_helper' class ChatTest < ActiveSupport::TestCase - setup do + before do groups = Group.all roles = Role.where(name: %w[Agent]) @agent1 = User.create!( diff --git a/test/unit/email_process_sender_is_system_address_or_agent_test.rb b/test/unit/email_process_sender_is_system_address_or_agent_test.rb index 1589ebd16..d3f6f30e9 100644 --- a/test/unit/email_process_sender_is_system_address_or_agent_test.rb +++ b/test/unit/email_process_sender_is_system_address_or_agent_test.rb @@ -4,7 +4,7 @@ require 'test_helper' class EmailProcessSenderIsSystemAddressOrAgent < ActiveSupport::TestCase - setup do + before do EmailAddress.create_or_update( channel_id: 1, realname: 'My System', diff --git a/test/unit/integration_icinga_test.rb b/test/unit/integration_icinga_test.rb index 48e545d89..86cfc122f 100644 --- a/test/unit/integration_icinga_test.rb +++ b/test/unit/integration_icinga_test.rb @@ -9,7 +9,7 @@ class IntegrationIcingaTest < ActiveSupport::TestCase # http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/monitoring-basics#host-states # http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/monitoring-basics#service-states - setup do + before do Setting.set('icinga_integration', true) Setting.set('icinga_sender', 'icinga2@monitoring.example.com') end diff --git a/test/unit/integration_monit_test.rb b/test/unit/integration_monit_test.rb index 96bf7b51d..801600fb5 100644 --- a/test/unit/integration_monit_test.rb +++ b/test/unit/integration_monit_test.rb @@ -7,7 +7,7 @@ class IntegrationMonitTest < ActiveSupport::TestCase # according # https://mmonit.com/monit/documentation/#ALERT-MESSAGES - setup do + before do Setting.set('monit_integration', true) Setting.set('monit_sender', 'monit@monitoring.example.com') end diff --git a/test/unit/integration_nagios_test.rb b/test/unit/integration_nagios_test.rb index 69b636af3..7a41fa3b3 100644 --- a/test/unit/integration_nagios_test.rb +++ b/test/unit/integration_nagios_test.rb @@ -7,7 +7,7 @@ class IntegrationNagiosTest < ActiveSupport::TestCase # according # https://github.com/NagiosEnterprises/nagioscore/blob/754218e67653929a58938b99ef6b6039b6474fe4/sample-config/template-object/commands.cfg.in#L35 - setup do + before do Setting.set('nagios_integration', true) Setting.set('nagios_sender', 'nagios2@monitoring.example.com') end diff --git a/test/unit/online_notifiaction_test.rb b/test/unit/online_notifiaction_test.rb index a7d5ac794..cd1dbdef1 100644 --- a/test/unit/online_notifiaction_test.rb +++ b/test/unit/online_notifiaction_test.rb @@ -4,7 +4,7 @@ require 'test_helper' class OnlineNotificationTest < ActiveSupport::TestCase - setup do + before do role = Role.lookup(name: 'Agent') @group = Group.create_or_update( name: 'OnlineNotificationTest', diff --git a/test/unit/ticket_last_owner_update_test.rb b/test/unit/ticket_last_owner_update_test.rb index 2eabc86d7..c097b21fd 100644 --- a/test/unit/ticket_last_owner_update_test.rb +++ b/test/unit/ticket_last_owner_update_test.rb @@ -4,7 +4,7 @@ require 'test_helper' class TicketLastOwnerUpdateTest < ActiveSupport::TestCase - setup do + before do Group.create_or_update( name: 'LastOwnerUpdate', email_address: EmailAddress.first, diff --git a/test/unit/ticket_notification_test.rb b/test/unit/ticket_notification_test.rb index 609ed1a6e..2eadba3f5 100644 --- a/test/unit/ticket_notification_test.rb +++ b/test/unit/ticket_notification_test.rb @@ -3,7 +3,7 @@ require 'test_helper' class TicketNotificationTest < ActiveSupport::TestCase - setup do + before do Setting.set('timezone_default', 'Europe/Berlin') Trigger.create_or_update( name: 'auto reply - new ticket', diff --git a/test/unit/ticket_overview_out_of_office_test.rb b/test/unit/ticket_overview_out_of_office_test.rb index 9cbcdaba7..c30df930c 100644 --- a/test/unit/ticket_overview_out_of_office_test.rb +++ b/test/unit/ticket_overview_out_of_office_test.rb @@ -4,7 +4,7 @@ require 'test_helper' class TicketOverviewOutOfOfficeTest < ActiveSupport::TestCase - setup do + before do group = Group.create_or_update( name: 'OverviewReplacementTest', updated_at: '2015-02-05 16:37:00', diff --git a/test/unit/ticket_overview_test.rb b/test/unit/ticket_overview_test.rb index 85e3f6a55..5a08534f1 100644 --- a/test/unit/ticket_overview_test.rb +++ b/test/unit/ticket_overview_test.rb @@ -4,7 +4,7 @@ require 'test_helper' class TicketOverviewTest < ActiveSupport::TestCase - setup do + before do group = Group.create_or_update( name: 'OverviewTest', updated_at: '2015-02-05 16:37:00', diff --git a/test/unit/ticket_selector_test.rb b/test/unit/ticket_selector_test.rb index 8b44dfe7f..954e08a63 100644 --- a/test/unit/ticket_selector_test.rb +++ b/test/unit/ticket_selector_test.rb @@ -4,7 +4,7 @@ require 'test_helper' class TicketSelectorTest < ActiveSupport::TestCase - setup do + before do @group = Group.create_or_update( name: 'SelectorTest', updated_at: '2015-02-05 16:37:00', diff --git a/test/unit/ticket_test.rb b/test/unit/ticket_test.rb index 60f32cc48..e0ef25e85 100644 --- a/test/unit/ticket_test.rb +++ b/test/unit/ticket_test.rb @@ -4,7 +4,7 @@ require 'test_helper' class TicketTest < ActiveSupport::TestCase - setup do + before do Ticket.destroy_all end diff --git a/test/unit/ticket_trigger_extended_test.rb b/test/unit/ticket_trigger_extended_test.rb index 0ef837d62..70f0214f0 100644 --- a/test/unit/ticket_trigger_extended_test.rb +++ b/test/unit/ticket_trigger_extended_test.rb @@ -4,7 +4,7 @@ require 'test_helper' class TicketTriggerExtendedTest < ActiveSupport::TestCase - setup do + before do Setting.set('ticket_trigger_recursive', true) end diff --git a/test/unit/ticket_trigger_recursive_disabled_test.rb b/test/unit/ticket_trigger_recursive_disabled_test.rb index cf930608c..c023c6d6d 100644 --- a/test/unit/ticket_trigger_recursive_disabled_test.rb +++ b/test/unit/ticket_trigger_recursive_disabled_test.rb @@ -4,7 +4,7 @@ require 'test_helper' class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase - setup do + before do Setting.set('ticket_trigger_recursive', false) end diff --git a/test/unit/ticket_trigger_test.rb b/test/unit/ticket_trigger_test.rb index 8709b6192..ea9b3d9ea 100644 --- a/test/unit/ticket_trigger_test.rb +++ b/test/unit/ticket_trigger_test.rb @@ -4,7 +4,7 @@ require 'test_helper' class TicketTriggerTest < ActiveSupport::TestCase - setup do + before do Setting.set('ticket_trigger_recursive', true) end