Browse Source

Small code cleanup.

Martin Edenhofer 6 years ago
parent
commit
f80fbf4744

+ 0 - 1
config/application.rb

@@ -38,7 +38,6 @@ module Zammad
       'observer::_ticket::_ref_object_touch',
       'observer::_ticket::_online_notification_seen',
       'observer::_ticket::_stats_reopen',
-      'observer::_ticket::_escalation_update',
       'observer::_tag::_ticket_history',
       'observer::_user::_ref_object_touch',
       'observer::_user::_ticket_organization',

+ 3 - 3
test/controllers/api_auth_controller_test.rb

@@ -12,7 +12,7 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
     groups = Group.all
 
     UserInfo.current_user_id = 1
-    @admin = User.create_or_update(
+    @admin = User.create!(
       login: 'api-admin',
       firstname: 'API',
       lastname: 'Admin',
@@ -25,7 +25,7 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
 
     # create agent
     roles = Role.where(name: 'Agent')
-    @agent = User.create_or_update(
+    @agent = User.create!(
       login: 'api-agent@example.com',
       firstname: 'API',
       lastname: 'Agent',
@@ -38,7 +38,7 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
 
     # create customer without org
     roles = Role.where(name: 'Customer')
-    @customer = User.create_or_update(
+    @customer = User.create!(
       login: 'api-customer1@example.com',
       firstname: 'API',
       lastname: 'Customer1',

+ 2 - 2
test/controllers/api_auth_on_behalf_of_controller_test.rb

@@ -12,7 +12,7 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
     groups = Group.all
 
     UserInfo.current_user_id = 1
-    @admin = User.create_or_update(
+    @admin = User.create!(
       login: 'api-admin-auth-behalf',
       firstname: 'API',
       lastname: 'Admin',
@@ -25,7 +25,7 @@ class ApiAuthControllerTest < ActionDispatch::IntegrationTest
 
     # create customer without org
     roles = Role.where(name: 'Customer')
-    @customer = User.create_or_update(
+    @customer = User.create!(
       login: 'api-customer1-auth-behalf@example.com',
       firstname: 'API',
       lastname: 'Customer1',

+ 1 - 1
test/controllers/calendar_controller_test.rb

@@ -12,7 +12,7 @@ class CalendarControllerTest < ActionDispatch::IntegrationTest
     groups = Group.all
 
     UserInfo.current_user_id = 1
-    @admin = User.create_or_update(
+    @admin = User.create!(
       login: 'calendar-admin',
       firstname: 'Packages',
       lastname: 'Admin',

+ 12 - 12
test/controllers/organization_controller_test.rb

@@ -14,7 +14,7 @@ class OrganizationControllerTest < ActionDispatch::IntegrationTest
 
     UserInfo.current_user_id = 1
 
-    @admin = User.create_or_update(
+    @admin = User.create!(
       login: 'rest-admin',
       firstname: 'Rest',
       lastname: 'Agent',
@@ -27,7 +27,7 @@ class OrganizationControllerTest < ActionDispatch::IntegrationTest
 
     # create agent
     roles = Role.where(name: 'Agent')
-    @agent = User.create_or_update(
+    @agent = User.create!(
       login: 'rest-agent@example.com',
       firstname: 'Rest',
       lastname: 'Agent',
@@ -40,7 +40,7 @@ class OrganizationControllerTest < ActionDispatch::IntegrationTest
 
     # create customer without org
     roles = Role.where(name: 'Customer')
-    @customer_without_org = User.create_or_update(
+    @customer_without_org = User.create!(
       login: 'rest-customer1@example.com',
       firstname: 'Rest',
       lastname: 'Customer1',
@@ -51,18 +51,18 @@ class OrganizationControllerTest < ActionDispatch::IntegrationTest
     )
 
     # create orgs
-    @organization = Organization.create_or_update(
+    @organization = Organization.create!(
       name: 'Rest Org',
     )
-    @organization2 = Organization.create_or_update(
+    @organization2 = Organization.create!(
       name: 'Rest Org #2',
     )
-    @organization3 = Organization.create_or_update(
+    @organization3 = Organization.create!(
       name: 'Rest Org #3',
     )
 
     # create customer with org
-    @customer_with_org = User.create_or_update(
+    @customer_with_org = User.create!(
       login: 'rest-customer2@example.com',
       firstname: 'Rest',
       lastname: 'Customer2',
@@ -229,7 +229,7 @@ class OrganizationControllerTest < ActionDispatch::IntegrationTest
   end
 
   test '04.01 organization show and response format' do
-    organization = Organization.create_or_update(
+    organization = Organization.create!(
       name: 'Rest Org NEW',
       members: [@customer_without_org],
       updated_by_id: @admin.id,
@@ -297,7 +297,7 @@ class OrganizationControllerTest < ActionDispatch::IntegrationTest
   end
 
   test '04.02 organization index and response format' do
-    organization = Organization.create_or_update(
+    organization = Organization.create!(
       name: 'Rest Org NEW',
       members: [@customer_without_org],
       updated_by_id: @admin.id,
@@ -420,7 +420,7 @@ class OrganizationControllerTest < ActionDispatch::IntegrationTest
   end
 
   test '04.04 ticket update and response formats' do
-    organization = Organization.create_or_update(
+    organization = Organization.create!(
       name: 'Rest Org NEW',
       members: [@customer_without_org],
       updated_by_id: @admin.id,
@@ -510,7 +510,7 @@ class OrganizationControllerTest < ActionDispatch::IntegrationTest
   test '05.03 csv import - admin access' do
 
     UserInfo.current_user_id = 1
-    customer1 = User.create_or_update(
+    customer1 = User.create!(
       login: 'customer1-members@example.com',
       firstname: 'Member',
       lastname: 'Customer',
@@ -518,7 +518,7 @@ class OrganizationControllerTest < ActionDispatch::IntegrationTest
       password: 'customerpw',
       active: true,
     )
-    customer2 = User.create_or_update(
+    customer2 = User.create!(
       login: 'customer2-members@example.com',
       firstname: 'Member',
       lastname: 'Customer',

+ 2 - 2
test/controllers/overviews_controller_test.rb

@@ -12,7 +12,7 @@ class OverviewsControllerTest < ActionDispatch::IntegrationTest
     groups = Group.all
 
     UserInfo.current_user_id = 1
-    @admin = User.create_or_update(
+    @admin = User.create!(
       login: 'tickets-admin',
       firstname: 'Tickets',
       lastname: 'Admin',
@@ -25,7 +25,7 @@ class OverviewsControllerTest < ActionDispatch::IntegrationTest
 
     # create agent
     roles = Role.where(name: 'Agent')
-    @agent = User.create_or_update(
+    @agent = User.create!(
       login: 'tickets-agent@example.com',
       firstname: 'Tickets',
       lastname: 'Agent',

+ 3 - 3
test/controllers/packages_controller_test.rb

@@ -12,7 +12,7 @@ class PackagesControllerTest < ActionDispatch::IntegrationTest
     groups = Group.all
 
     UserInfo.current_user_id = 1
-    @admin = User.create_or_update(
+    @admin = User.create!(
       login: 'packages-admin',
       firstname: 'Packages',
       lastname: 'Admin',
@@ -25,7 +25,7 @@ class PackagesControllerTest < ActionDispatch::IntegrationTest
 
     # create agent
     roles = Role.where(name: 'Agent')
-    @agent = User.create_or_update(
+    @agent = User.create!(
       login: 'packages-agent@example.com',
       firstname: 'Rest',
       lastname: 'Agent',
@@ -38,7 +38,7 @@ class PackagesControllerTest < ActionDispatch::IntegrationTest
 
     # create customer without org
     roles = Role.where(name: 'Customer')
-    @customer_without_org = User.create_or_update(
+    @customer_without_org = User.create!(
       login: 'packages-customer1@example.com',
       firstname: 'Packages',
       lastname: 'Customer1',

+ 3 - 3
test/controllers/reports_controller_test.rb

@@ -18,7 +18,7 @@ class ReportsControllerTest < ActionDispatch::IntegrationTest
 
     UserInfo.current_user_id = 1
 
-    @admin = User.create_or_update(
+    @admin = User.create!(
       login: 'rest-admin',
       firstname: 'Rest',
       lastname: 'Agent',
@@ -32,7 +32,7 @@ class ReportsControllerTest < ActionDispatch::IntegrationTest
     )
 
     roles = Role.where(name: 'Customer')
-    @customer_without_org = User.create_or_update(
+    @customer_without_org = User.create!(
       login: 'rest-customer1@example.com',
       firstname: 'Rest',
       lastname: 'Customer1',
@@ -44,7 +44,7 @@ class ReportsControllerTest < ActionDispatch::IntegrationTest
       created_by_id: 1
     )
 
-    @group1 = Group.create_or_update(
+    @group1 = Group.create!(
       name: "GroupWithoutPermission-#{rand(9_999_999_999)}",
       active: true,
       updated_by_id: 1,

+ 8 - 8
test/controllers/search_controller_test.rb

@@ -15,7 +15,7 @@ class SearchControllerTest < ActionDispatch::IntegrationTest
     roles  = Role.where(name: %w[Admin Agent])
     groups = Group.all
 
-    @admin = User.create_or_update(
+    @admin = User.create!(
       login: 'search-admin',
       firstname: 'Search',
       lastname: 'Admin',
@@ -28,7 +28,7 @@ class SearchControllerTest < ActionDispatch::IntegrationTest
 
     # create agent
     roles = Role.where(name: 'Agent')
-    @agent = User.create_or_update(
+    @agent = User.create!(
       login: 'search-agent@example.com',
       firstname: 'Search 1234',
       lastname: 'Agent',
@@ -41,7 +41,7 @@ class SearchControllerTest < ActionDispatch::IntegrationTest
 
     # create customer without org
     roles = Role.where(name: 'Customer')
-    @customer_without_org = User.create_or_update(
+    @customer_without_org = User.create!(
       login: 'search-customer1@example.com',
       firstname: 'Search',
       lastname: 'Customer1',
@@ -52,18 +52,18 @@ class SearchControllerTest < ActionDispatch::IntegrationTest
     )
 
     # create orgs
-    @organization = Organization.create_or_update(
+    @organization = Organization.create!(
       name: 'Rest Org',
     )
-    @organization2 = Organization.create_or_update(
+    @organization2 = Organization.create!(
       name: 'Rest Org #2',
     )
-    @organization3 = Organization.create_or_update(
+    @organization3 = Organization.create!(
       name: 'Rest Org #3',
     )
 
     # create customer with org
-    @customer_with_org2 = User.create_or_update(
+    @customer_with_org2 = User.create!(
       login: 'search-customer2@example.com',
       firstname: 'Search',
       lastname: 'Customer2',
@@ -74,7 +74,7 @@ class SearchControllerTest < ActionDispatch::IntegrationTest
       organization_id: @organization.id,
     )
 
-    @customer_with_org3 = User.create_or_update(
+    @customer_with_org3 = User.create!(
       login: 'search-customer3@example.com',
       firstname: 'Search',
       lastname: 'Customer3',

+ 5 - 5
test/controllers/settings_controller_test.rb

@@ -12,7 +12,7 @@ class SettingsControllerTest < ActionDispatch::IntegrationTest
     groups = Group.all
 
     UserInfo.current_user_id = 1
-    @admin_full = User.create_or_update(
+    @admin_full = User.create!(
       login: 'setting-admin',
       firstname: 'Setting',
       lastname: 'Admin',
@@ -23,7 +23,7 @@ class SettingsControllerTest < ActionDispatch::IntegrationTest
       groups: groups,
     )
 
-    role_api = Role.create_or_update(
+    role_api = Role.create!(
       name: 'AdminApi',
       note: 'To configure your api.',
       preferences: {
@@ -34,7 +34,7 @@ class SettingsControllerTest < ActionDispatch::IntegrationTest
       created_by_id: 1
     )
     role_api.permission_grant('admin.api')
-    @admin_api = User.create_or_update(
+    @admin_api = User.create!(
       login: 'setting-admin-api',
       firstname: 'Setting',
       lastname: 'Admin Api',
@@ -47,7 +47,7 @@ class SettingsControllerTest < ActionDispatch::IntegrationTest
 
     # create agent
     roles = Role.where(name: 'Agent')
-    @agent = User.create_or_update(
+    @agent = User.create!(
       login: 'setting-agent@example.com',
       firstname: 'Setting',
       lastname: 'Agent',
@@ -60,7 +60,7 @@ class SettingsControllerTest < ActionDispatch::IntegrationTest
 
     # create customer without org
     roles = Role.where(name: 'Customer')
-    @customer_without_org = User.create_or_update(
+    @customer_without_org = User.create!(
       login: 'setting-customer1@example.com',
       firstname: 'Setting',
       lastname: 'Customer1',

Some files were not shown because too many files changed in this diff