Maintenance: Updated rubocop(-* gems) to latest version (1.9.1).

This commit is contained in:
Thorsten Eckel 2021-02-01 13:42:44 +01:00
parent c4a237a203
commit 4a48fe3bf6
14 changed files with 404 additions and 402 deletions

View file

@ -326,6 +326,8 @@ RSpec/FilePath:
- 'spec/db/migrate/issue_*_spec.rb' - 'spec/db/migrate/issue_*_spec.rb'
- 'spec/jobs/issue_*_spec.rb' - 'spec/jobs/issue_*_spec.rb'
- 'spec/lib/import/base_factory_spec.rb' - 'spec/lib/import/base_factory_spec.rb'
- 'spec/models/knowledge_base/answer/translation/search_with_attachment_spec.rb'
- 'spec/models/trigger/sms_spec.rb'
RSpec/InstanceVariable: RSpec/InstanceVariable:
Exclude: Exclude:

View file

@ -108,7 +108,7 @@ GEM
argon2 (2.0.2) argon2 (2.0.2)
ffi (~> 1.9) ffi (~> 1.9)
ffi-compiler (>= 0.1) ffi-compiler (>= 0.1)
ast (2.4.1) ast (2.4.2)
autoprefixer-rails (9.5.1) autoprefixer-rails (9.5.1)
execjs execjs
binding_of_caller (0.8.0) binding_of_caller (0.8.0)
@ -150,7 +150,7 @@ GEM
json json
composite_primary_keys (11.2.0) composite_primary_keys (11.2.0)
activerecord (~> 5.2.1) activerecord (~> 5.2.1)
concurrent-ruby (1.1.7) concurrent-ruby (1.1.8)
coveralls (0.8.23) coveralls (0.8.23)
json (>= 1.8, < 3) json (>= 1.8, < 3)
simplecov (~> 0.16.1) simplecov (~> 0.16.1)
@ -248,7 +248,7 @@ GEM
http-form_data (2.1.1) http-form_data (2.1.1)
http_parser.rb (0.6.0) http_parser.rb (0.6.0)
httpclient (2.8.3) httpclient (2.8.3)
i18n (1.8.5) i18n (1.8.7)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
icalendar (2.5.3) icalendar (2.5.3)
ice_cube (~> 0.16) ice_cube (~> 0.16)
@ -291,7 +291,7 @@ GEM
mini_portile2 (2.5.0) mini_portile2 (2.5.0)
mini_racer (0.2.9) mini_racer (0.2.9)
libv8 (>= 6.9.411) libv8 (>= 6.9.411)
minitest (5.14.2) minitest (5.14.3)
msgpack (1.2.4) msgpack (1.2.4)
multi_json (1.15.0) multi_json (1.15.0)
multi_xml (0.6.0) multi_xml (0.6.0)
@ -359,7 +359,7 @@ GEM
omniauth-oauth2 (>= 1.4.0) omniauth-oauth2 (>= 1.4.0)
openssl (2.1.2) openssl (2.1.2)
parallel (1.20.1) parallel (1.20.1)
parser (2.7.2.0) parser (3.0.0.0)
ast (~> 2.4.1) ast (~> 2.4.1)
pg (0.21.0) pg (0.21.0)
pluginator (1.5.0) pluginator (1.5.0)
@ -454,28 +454,28 @@ GEM
rspec-support (~> 3.9.0) rspec-support (~> 3.9.0)
rspec-support (3.9.3) rspec-support (3.9.3)
rszr (0.5.2) rszr (0.5.2)
rubocop (1.6.1) rubocop (1.9.1)
parallel (~> 1.10) parallel (~> 1.10)
parser (>= 2.7.1.5) parser (>= 3.0.0.0)
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0) regexp_parser (>= 1.8, < 3.0)
rexml rexml
rubocop-ast (>= 1.2.0, < 2.0) rubocop-ast (>= 1.2.0, < 2.0)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0) unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.3.0) rubocop-ast (1.4.1)
parser (>= 2.7.1.5) parser (>= 2.7.1.5)
rubocop-performance (1.9.1) rubocop-performance (1.9.2)
rubocop (>= 0.90.0, < 2.0) rubocop (>= 0.90.0, < 2.0)
rubocop-ast (>= 0.4.0) rubocop-ast (>= 0.4.0)
rubocop-rails (2.9.0) rubocop-rails (2.9.1)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
rack (>= 1.1) rack (>= 1.1)
rubocop (>= 0.90.0, < 2.0) rubocop (>= 0.90.0, < 2.0)
rubocop-rspec (2.0.1) rubocop-rspec (2.1.0)
rubocop (~> 1.0) rubocop (~> 1.0)
rubocop-ast (>= 1.1.0) rubocop-ast (>= 1.1.0)
ruby-progressbar (1.10.1) ruby-progressbar (1.11.0)
ruby-saml (1.10.2) ruby-saml (1.10.2)
nokogiri (>= 1.5.10) nokogiri (>= 1.5.10)
ruby_dep (1.5.0) ruby_dep (1.5.0)
@ -536,14 +536,14 @@ GEM
faraday (~> 0.9) faraday (~> 0.9)
jwt (>= 1.5, <= 2.5) jwt (>= 1.5, <= 2.5)
nokogiri (>= 1.6, < 2.0) nokogiri (>= 1.6, < 2.0)
tzinfo (1.2.8) tzinfo (1.2.9)
thread_safe (~> 0.1) thread_safe (~> 0.1)
uglifier (4.1.20) uglifier (4.1.20)
execjs (>= 0.3.0, < 3) execjs (>= 0.3.0, < 3)
unf (0.1.4) unf (0.1.4)
unf_ext unf_ext
unf_ext (0.0.7.5) unf_ext (0.0.7.5)
unicode-display_width (1.7.0) unicode-display_width (2.0.0)
unicorn (5.5.0) unicorn (5.5.0)
kgio (~> 2.6) kgio (~> 2.6)
raindrops (~> 0.7) raindrops (~> 0.7)

View file

@ -156,11 +156,11 @@ returns
return [] if query_or.blank? return [] if query_or.blank?
query_extension = { query_extension = {
'bool': { bool: {
'must': [ must: [
{ {
'bool': { bool: {
'should': query_or, should: query_or,
}, },
}, },
], ],

View file

@ -17,8 +17,8 @@ class PrettyDateOptionsAdded < ActiveRecord::Migration[4.2]
name: 'pretty_date_format', name: 'pretty_date_format',
tag: 'select', tag: 'select',
options: { options: {
'relative': 'relative - e. g. "2 hours ago" or "2 days and 15 minutes ago"', relative: 'relative - e. g. "2 hours ago" or "2 days and 15 minutes ago"',
'absolute': 'absolute - e. g. "Monday 09:30" or "Tuesday 23. Feb 14:20"', absolute: 'absolute - e. g. "Monday 09:30" or "Tuesday 23. Feb 14:20"',
}, },
}, },
], ],

View file

@ -209,9 +209,9 @@ Setting.create_or_update(
name: 'pretty_date_format', name: 'pretty_date_format',
tag: 'select', tag: 'select',
options: { options: {
'relative': 'relative - e. g. "2 hours ago" or "2 days and 15 minutes ago"', relative: 'relative - e. g. "2 hours ago" or "2 days and 15 minutes ago"',
'absolute': 'absolute - e. g. "Monday 09:30" or "Tuesday 23. Feb 14:20"', absolute: 'absolute - e. g. "Monday 09:30" or "Tuesday 23. Feb 14:20"',
'timestamp': 'timestamp - e. g. "2018-08-30 14:30"', timestamp: 'timestamp - e. g. "2018-08-30 14:30"',
}, },
}, },
], ],

View file

@ -959,8 +959,8 @@ helper method for making HTTP calls and raising error if response was not succes
# for elasticsearch 6.x and later # for elasticsearch 6.x and later
string_type = 'text' string_type = 'text'
string_raw = { 'type': 'keyword', 'ignore_above': 5012 } string_raw = { type: 'keyword', ignore_above: 5012 }
boolean_raw = { 'type': 'boolean' } boolean_raw = { type: 'boolean' }
object.columns_hash.each do |key, value| object.columns_hash.each do |key, value|
if value.type == :string && value.limit && value.limit <= 5000 && store_columns.exclude?(key) if value.type == :string && value.limit && value.limit <= 5000 && store_columns.exclude?(key)

View file

@ -2,7 +2,7 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe ActiveRecord::Calculations do RSpec.describe ActiveRecord::Calculations do # rubocop:disable RSpec/FilePath
describe '#pluck_as_hash' do describe '#pluck_as_hash' do
let(:ticket) { create(:ticket) } let(:ticket) { create(:ticket) }

View file

@ -170,8 +170,8 @@ RSpec.describe ExternalCredential::Google do
let(:response_status) { 404 } let(:response_status) { 404 }
let(:response_payload) do let(:response_payload) do
{ {
"error": 'invalid_client', error: 'invalid_client',
"error_description": 'The OAuth client was not found.' error_description: 'The OAuth client was not found.'
} }
end end
let(:exception_message) { 'Request failed! ERROR: invalid_client (The OAuth client was not found.)' } let(:exception_message) { 'Request failed! ERROR: invalid_client (The OAuth client was not found.)' }
@ -295,8 +295,8 @@ RSpec.describe ExternalCredential::Google do
let(:response_status) { 400 } let(:response_status) { 400 }
let(:response_payload) do let(:response_payload) do
{ {
"error": 'invalid_client', error: 'invalid_client',
"error_description": 'The OAuth client was not found.' error_description: 'The OAuth client was not found.'
} }
end end
let(:exception_message) { /The OAuth client was not found/ } let(:exception_message) { /The OAuth client was not found/ }
@ -397,16 +397,16 @@ RSpec.describe ExternalCredential::Google do
let(:response_status) { 401 } let(:response_status) { 401 }
let(:response_payload) do let(:response_payload) do
{ {
"error": { error: {
"code": 401, code: 401,
"message": 'Invalid Credentials', message: 'Invalid Credentials',
"errors": [ errors: [
{ {
"locationType": 'header', locationType: 'header',
"domain": 'global', domain: 'global',
"message": 'Invalid Credentials', message: 'Invalid Credentials',
"reason": 'authError', reason: 'authError',
"location": 'Authorization' location: 'Authorization'
} }
] ]
} }

View file

@ -132,8 +132,8 @@ RSpec.describe ExternalCredential::Microsoft365 do
let(:response_status) { 404 } let(:response_status) { 404 }
let(:response_payload) do let(:response_payload) do
{ {
"error": 'invalid_client', error: 'invalid_client',
"error_description": 'The OAuth client was not found.' error_description: 'The OAuth client was not found.'
} }
end end
let(:exception_message) { 'Request failed! ERROR: invalid_client (The OAuth client was not found.)' } let(:exception_message) { 'Request failed! ERROR: invalid_client (The OAuth client was not found.)' }
@ -256,8 +256,8 @@ RSpec.describe ExternalCredential::Microsoft365 do
let(:response_status) { 400 } let(:response_status) { 400 }
let(:response_payload) do let(:response_payload) do
{ {
"error": 'invalid_client', error: 'invalid_client',
"error_description": 'The OAuth client was not found.' error_description: 'The OAuth client was not found.'
} }
end end
let(:exception_message) { /The OAuth client was not found/ } let(:exception_message) { /The OAuth client was not found/ }

View file

@ -5,9 +5,9 @@ RSpec.describe 'Admin Knowledge Base Public Menu', type: :request, authenticated
let(:params) do let(:params) do
{ {
menu_items_sets: [{ menu_items_sets: [{
"kb_locale_id": kb_locale.id, kb_locale_id: kb_locale.id,
"location": location, location: location,
"menu_items": menu_items menu_items: menu_items
}] }]
} }
end end
@ -59,9 +59,9 @@ RSpec.describe 'Admin Knowledge Base Public Menu', type: :request, authenticated
def build_params(menu_items) def build_params(menu_items)
{ {
menu_items_sets: [{ menu_items_sets: [{
"kb_locale_id": kb_locale.id, kb_locale_id: kb_locale.id,
"location": location, location: location,
"menu_items": menu_items menu_items: menu_items
}] }]
} }
end end

View file

@ -553,37 +553,37 @@ RSpec.describe 'Monitoring', type: :request do
# parameters for updating # parameters for updating
params = { params = {
'name': 'test4', name: 'test4',
'object': 'Ticket', object: 'Ticket',
'display': 'Test 4', display: 'Test 4',
'active': true, active: true,
'data_type': 'input', data_type: 'input',
'data_option': { data_option: {
'default': 'test', default: 'test',
'type': 'text', type: 'text',
'maxlength': 120 maxlength: 120
}, },
'screens': { screens: {
'create_middle': { create_middle: {
'ticket.customer': { 'ticket.customer': {
'shown': true, shown: true,
'item_class': 'column' item_class: 'column'
}, },
'ticket.agent': { 'ticket.agent': {
'shown': true, shown: true,
'item_class': 'column' item_class: 'column'
} }
}, },
'edit': { edit: {
'ticket.customer': { 'ticket.customer': {
'shown': true shown: true
}, },
'ticket.agent': { 'ticket.agent': {
'shown': true shown: true
} }
} }
}, },
'id': 'c-196' id: 'c-196'
} }
# update the object # update the object

View file

@ -14,37 +14,37 @@ RSpec.describe 'ObjectManager Attributes', type: :request do
# token based on headers # token based on headers
params = { params = {
'name': 'test1', name: 'test1',
'object': 'Ticket', object: 'Ticket',
'display': 'Test 1', display: 'Test 1',
'active': true, active: true,
'data_type': 'input', data_type: 'input',
'data_option': { data_option: {
'default': 'test', default: 'test',
'type': 'text', type: 'text',
'maxlength': 120 maxlength: 120
}, },
'screens': { screens: {
'create_middle': { create_middle: {
'ticket.customer': { 'ticket.customer': {
'shown': true, shown: true,
'item_class': 'column' item_class: 'column'
}, },
'ticket.agent': { 'ticket.agent': {
'shown': true, shown: true,
'item_class': 'column' item_class: 'column'
} }
}, },
'edit': { edit: {
'ticket.customer': { 'ticket.customer': {
'shown': true shown: true
}, },
'ticket.agent': { 'ticket.agent': {
'shown': true shown: true
} }
} }
}, },
'id': 'c-196' id: 'c-196'
} }
post '/api/v1/object_manager_attributes', params: params, as: :json post '/api/v1/object_manager_attributes', params: params, as: :json
@ -61,36 +61,36 @@ RSpec.describe 'ObjectManager Attributes', type: :request do
# token based on headers # token based on headers
params = { params = {
'name': 'test2', name: 'test2',
'object': 'Ticket', object: 'Ticket',
'display': 'Test 2', display: 'Test 2',
'active': true, active: true,
'data_type': 'input', data_type: 'input',
'data_option': { data_option: {
'type': 'text', type: 'text',
'maxlength': 120 maxlength: 120
}, },
'screens': { screens: {
'create_middle': { create_middle: {
'ticket.customer': { 'ticket.customer': {
'shown': true, shown: true,
'item_class': 'column' item_class: 'column'
}, },
'ticket.agent': { 'ticket.agent': {
'shown': true, shown: true,
'item_class': 'column' item_class: 'column'
} }
}, },
'edit': { edit: {
'ticket.customer': { 'ticket.customer': {
'shown': true shown: true
}, },
'ticket.agent': { 'ticket.agent': {
'shown': true shown: true
} }
} }
}, },
'id': 'c-196' id: 'c-196'
} }
post '/api/v1/object_manager_attributes', params: params, as: :json post '/api/v1/object_manager_attributes', params: params, as: :json
@ -114,37 +114,37 @@ RSpec.describe 'ObjectManager Attributes', type: :request do
# parameters for updating # parameters for updating
params = { params = {
'name': object.name, name: object.name,
'object': 'Ticket', object: 'Ticket',
'display': 'Test 4', display: 'Test 4',
'active': true, active: true,
'data_type': 'input', data_type: 'input',
'data_option': { data_option: {
'default': 'test', default: 'test',
'type': 'text', type: 'text',
'maxlength': 120 maxlength: 120
}, },
'screens': { screens: {
'create_middle': { create_middle: {
'ticket.customer': { 'ticket.customer': {
'shown': true, shown: true,
'item_class': 'column' item_class: 'column'
}, },
'ticket.agent': { 'ticket.agent': {
'shown': true, shown: true,
'item_class': 'column' item_class: 'column'
} }
}, },
'edit': { edit: {
'ticket.customer': { 'ticket.customer': {
'shown': true shown: true
}, },
'ticket.agent': { 'ticket.agent': {
'shown': true shown: true
} }
} }
}, },
'id': 'c-196' id: 'c-196'
} }
# update the object # update the object
@ -162,35 +162,35 @@ RSpec.describe 'ObjectManager Attributes', type: :request do
# token based on headers # token based on headers
params = { params = {
'active': true, active: true,
'data_option': { data_option: {
'options': { options: {
'false': 'no', false: 'no',
'true': 'yes' true: 'yes'
} }
}, },
'data_type': 'boolean', data_type: 'boolean',
'display': 'Boolean 2', display: 'Boolean 2',
'id': 'c-200', id: 'c-200',
'name': 'bool2', name: 'bool2',
'object': 'Ticket', object: 'Ticket',
'screens': { screens: {
'create_middle': { create_middle: {
'ticket.agent' => { 'ticket.agent' => {
'item_class': 'column', item_class: 'column',
'shown': true shown: true
}, },
'ticket.customer' => { 'ticket.customer' => {
'item_class': 'column', item_class: 'column',
'shown': true shown: true
} }
}, },
'edit': { edit: {
'ticket.agent' => { 'ticket.agent' => {
'shown': true shown: true
}, },
'ticket.customer' => { 'ticket.customer' => {
'shown': true shown: true
} }
} }
} }
@ -210,46 +210,46 @@ RSpec.describe 'ObjectManager Attributes', type: :request do
# token based on headers # token based on headers
params = { params = {
'active': true, active: true,
'data_option': { data_option: {
'options': { options: {
'key1': 'foo' key1: 'foo'
} }
}, },
'data_type': 'select', data_type: 'select',
'display': 'Test 5', display: 'Test 5',
'id': 'c-204', id: 'c-204',
'name': 'test5', name: 'test5',
'object': 'User', object: 'User',
'screens': { screens: {
'create': { create: {
'admin.user' => { 'admin.user' => {
'shown': true shown: true
}, },
'ticket.agent' => { 'ticket.agent' => {
'shown': true shown: true
}, },
'ticket.customer' => { 'ticket.customer' => {
'shown': true shown: true
} }
}, },
'edit': { edit: {
'admin.user' => { 'admin.user' => {
'shown': true shown: true
}, },
'ticket.agent' => { 'ticket.agent' => {
'shown': true shown: true
} }
}, },
'view': { view: {
'admin.user' => { 'admin.user' => {
'shown': true shown: true
}, },
'ticket.agent' => { 'ticket.agent' => {
'shown': true shown: true
}, },
'ticket.customer' => { 'ticket.customer' => {
'shown': true shown: true
} }
} }
} }
@ -331,39 +331,39 @@ RSpec.describe 'ObjectManager Attributes', type: :request do
it 'does converts string to boolean for default value for boolean data type with true (01)', db_strategy: :reset do it 'does converts string to boolean for default value for boolean data type with true (01)', db_strategy: :reset do
params = { params = {
'name': "customerdescription#{rand(999_999_999)}", name: "customerdescription#{rand(999_999_999)}",
'object': 'Ticket', object: 'Ticket',
'display': "custom description#{rand(999_999_999)}", display: "custom description#{rand(999_999_999)}",
'active': true, active: true,
'data_type': 'boolean', data_type: 'boolean',
'data_option': { data_option: {
'options': { options: {
'true': '', true: '',
'false': '', false: '',
}, },
'default': 'true', default: 'true',
'screens': { screens: {
'create_middle': { create_middle: {
'ticket.customer': { 'ticket.customer': {
'shown': true, shown: true,
'item_class': 'column' item_class: 'column'
}, },
'ticket.agent': { 'ticket.agent': {
'shown': true, shown: true,
'item_class': 'column' item_class: 'column'
} }
}, },
'edit': { edit: {
'ticket.customer': { 'ticket.customer': {
'shown': true shown: true
}, },
'ticket.agent': { 'ticket.agent': {
'shown': true shown: true
} }
} }
} }
}, },
'id': 'c-201' id: 'c-201'
} }
authenticated_as(admin) authenticated_as(admin)
@ -382,34 +382,34 @@ RSpec.describe 'ObjectManager Attributes', type: :request do
it 'does converts string to boolean for default value for boolean data type with false (02)', db_strategy: :reset do it 'does converts string to boolean for default value for boolean data type with false (02)', db_strategy: :reset do
params = { params = {
'name': "customerdescription_#{rand(999_999_999)}", name: "customerdescription_#{rand(999_999_999)}",
'object': 'Ticket', object: 'Ticket',
'display': "custom description #{rand(999_999_999)}", display: "custom description #{rand(999_999_999)}",
'active': true, active: true,
'data_type': 'boolean', data_type: 'boolean',
'data_option': { data_option: {
'options': { options: {
'true': '', true: '',
'false': '', false: '',
}, },
'default': 'false', default: 'false',
'screens': { screens: {
'create_middle': { create_middle: {
'ticket.customer': { 'ticket.customer': {
'shown': true, shown: true,
'item_class': 'column' item_class: 'column'
}, },
'ticket.agent': { 'ticket.agent': {
'shown': true, shown: true,
'item_class': 'column' item_class: 'column'
} }
}, },
'edit': { edit: {
'ticket.customer': { 'ticket.customer': {
'shown': true shown: true
}, },
'ticket.agent': { 'ticket.agent': {
'shown': true shown: true
} }
} }
} }
@ -436,36 +436,36 @@ RSpec.describe 'ObjectManager Attributes', type: :request do
ObjectManager::Attribute.migration_execute ObjectManager::Attribute.migration_execute
params = { params = {
'name': 'test_attribute_referenced_by_an_overview', name: 'test_attribute_referenced_by_an_overview',
'object': 'Ticket', object: 'Ticket',
'display': 'Test Attribute', display: 'Test Attribute',
'active': true, active: true,
'data_type': 'input', data_type: 'input',
'data_option': { data_option: {
'default': '', default: '',
'type': 'text', type: 'text',
'maxlength': 120, maxlength: 120,
'null': true, null: true,
'options': {}, options: {},
'relation': '' relation: ''
}, },
'screens': { screens: {
'create_middle': { create_middle: {
'ticket.customer': { 'ticket.customer': {
'shown': true, shown: true,
'item_class': 'column' item_class: 'column'
}, },
'ticket.agent': { 'ticket.agent': {
'shown': true, shown: true,
'item_class': 'column' item_class: 'column'
} }
}, },
'edit': { edit: {
'ticket.customer': { 'ticket.customer': {
'shown': true shown: true
}, },
'ticket.agent': { 'ticket.agent': {
'shown': true shown: true
} }
} }
}, },
@ -483,12 +483,12 @@ RSpec.describe 'ObjectManager Attributes', type: :request do
roles: Role.where(name: 'Agent').pluck(:name), roles: Role.where(name: 'Agent').pluck(:name),
condition: { condition: {
'ticket.state_id': { 'ticket.state_id': {
'operator': 'is', operator: 'is',
'value': Ticket::State.all.pluck(:id), value: Ticket::State.all.pluck(:id),
}, },
'ticket.test_attribute_referenced_by_an_overview': { 'ticket.test_attribute_referenced_by_an_overview': {
'operator': 'contains', operator: 'contains',
'value': 'DUMMY' value: 'DUMMY'
}, },
}, },
order: { order: {
@ -531,36 +531,36 @@ RSpec.describe 'ObjectManager Attributes', type: :request do
ObjectManager::Attribute.migration_execute ObjectManager::Attribute.migration_execute
params = { params = {
'name': 'test_attribute_referenced_by_a_trigger', name: 'test_attribute_referenced_by_a_trigger',
'object': 'Ticket', object: 'Ticket',
'display': 'Test Attribute', display: 'Test Attribute',
'active': true, active: true,
'data_type': 'input', data_type: 'input',
'data_option': { data_option: {
'default': '', default: '',
'type': 'text', type: 'text',
'maxlength': 120, maxlength: 120,
'null': true, null: true,
'options': {}, options: {},
'relation': '' relation: ''
}, },
'screens': { screens: {
'create_middle': { create_middle: {
'ticket.customer': { 'ticket.customer': {
'shown': true, shown: true,
'item_class': 'column' item_class: 'column'
}, },
'ticket.agent': { 'ticket.agent': {
'shown': true, shown: true,
'item_class': 'column' item_class: 'column'
} }
}, },
'edit': { edit: {
'ticket.customer': { 'ticket.customer': {
'shown': true shown: true
}, },
'ticket.agent': { 'ticket.agent': {
'shown': true shown: true
} }
} }
}, },
@ -577,17 +577,17 @@ RSpec.describe 'ObjectManager Attributes', type: :request do
name: 'test_trigger', name: 'test_trigger',
condition: { condition: {
'ticket.test_attribute_referenced_by_a_trigger': { 'ticket.test_attribute_referenced_by_a_trigger': {
'operator': 'contains', operator: 'contains',
'value': 'DUMMY' value: 'DUMMY'
} }
}, },
'perform': { perform: {
'ticket.state_id': { 'ticket.state_id': {
'value': '2' value: '2'
} }
}, },
'active': true, active: true,
'id': 'c-3' id: 'c-3'
} }
if Trigger.where('name like ?', '%test%').empty? if Trigger.where('name like ?', '%test%').empty?
@ -617,36 +617,36 @@ RSpec.describe 'ObjectManager Attributes', type: :request do
ObjectManager::Attribute.migration_execute ObjectManager::Attribute.migration_execute
params = { params = {
'name': 'test_attribute_referenced_by_a_scheduler', name: 'test_attribute_referenced_by_a_scheduler',
'object': 'Ticket', object: 'Ticket',
'display': 'Test Attribute', display: 'Test Attribute',
'active': true, active: true,
'data_type': 'input', data_type: 'input',
'data_option': { data_option: {
'default': '', default: '',
'type': 'text', type: 'text',
'maxlength': 120, maxlength: 120,
'null': true, null: true,
'options': {}, options: {},
'relation': '' relation: ''
}, },
'screens': { screens: {
'create_middle': { create_middle: {
'ticket.customer': { 'ticket.customer': {
'shown': true, shown: true,
'item_class': 'column' item_class: 'column'
}, },
'ticket.agent': { 'ticket.agent': {
'shown': true, shown: true,
'item_class': 'column' item_class: 'column'
} }
}, },
'edit': { edit: {
'ticket.customer': { 'ticket.customer': {
'shown': true shown: true
}, },
'ticket.agent': { 'ticket.agent': {
'shown': true shown: true
} }
} }
}, },
@ -661,17 +661,17 @@ RSpec.describe 'ObjectManager Attributes', type: :request do
# 2. create a scheduler that uses the attribute # 2. create a scheduler that uses the attribute
params = { params = {
name: 'test_scheduler', name: 'test_scheduler',
'timeplan': { timeplan: {
'days': { days: {
'Mon': true, Mon: true,
'Tue': false, Tue: false,
'Wed': false, Wed: false,
'Thu': false, Thu: false,
'Fri': false, Fri: false,
'Sat': false, Sat: false,
'Sun': false Sun: false
}, },
'hours': { hours: {
'0': true, '0': true,
'1': false, '1': false,
'2': false, '2': false,
@ -697,7 +697,7 @@ RSpec.describe 'ObjectManager Attributes', type: :request do
'22': false, '22': false,
'23': false '23': false
}, },
'minutes': { minutes: {
'0': true, '0': true,
'10': false, '10': false,
'20': false, '20': false,
@ -706,21 +706,21 @@ RSpec.describe 'ObjectManager Attributes', type: :request do
'50': false '50': false
} }
}, },
'condition': { condition: {
'ticket.test_attribute_referenced_by_a_scheduler': { 'ticket.test_attribute_referenced_by_a_scheduler': {
'operator': 'contains', operator: 'contains',
'value': 'DUMMY' value: 'DUMMY'
} }
}, },
'perform': { perform: {
'ticket.state_id': { 'ticket.state_id': {
'value': '2' value: '2'
} }
}, },
'disable_notification': true, disable_notification: true,
'note': '', note: '',
'active': true, active: true,
'id': 'c-0' id: 'c-0'
} }
if Job.where('name like ?', '%test%').empty? if Job.where('name like ?', '%test%').empty?
@ -750,36 +750,36 @@ RSpec.describe 'ObjectManager Attributes', type: :request do
ObjectManager::Attribute.migration_execute ObjectManager::Attribute.migration_execute
params = { params = {
'name': 'test_attribute_referenced_by_an_overview', name: 'test_attribute_referenced_by_an_overview',
'object': 'Ticket', object: 'Ticket',
'display': 'Test Attribute', display: 'Test Attribute',
'active': true, active: true,
'data_type': 'input', data_type: 'input',
'data_option': { data_option: {
'default': '', default: '',
'type': 'text', type: 'text',
'maxlength': 120, maxlength: 120,
'null': true, null: true,
'options': {}, options: {},
'relation': '' relation: ''
}, },
'screens': { screens: {
'create_middle': { create_middle: {
'ticket.customer': { 'ticket.customer': {
'shown': true, shown: true,
'item_class': 'column' item_class: 'column'
}, },
'ticket.agent': { 'ticket.agent': {
'shown': true, shown: true,
'item_class': 'column' item_class: 'column'
} }
}, },
'edit': { edit: {
'ticket.customer': { 'ticket.customer': {
'shown': true shown: true
}, },
'ticket.agent': { 'ticket.agent': {
'shown': true shown: true
} }
} }
}, },
@ -789,36 +789,36 @@ RSpec.describe 'ObjectManager Attributes', type: :request do
post '/api/v1/object_manager_attributes', params: params, as: :json post '/api/v1/object_manager_attributes', params: params, as: :json
params = { params = {
'name': 'test_attribute_referenced_by_an_overview', name: 'test_attribute_referenced_by_an_overview',
'object': 'User', object: 'User',
'display': 'Test Attribute', display: 'Test Attribute',
'active': true, active: true,
'data_type': 'input', data_type: 'input',
'data_option': { data_option: {
'default': '', default: '',
'type': 'text', type: 'text',
'maxlength': 120, maxlength: 120,
'null': true, null: true,
'options': {}, options: {},
'relation': '' relation: ''
}, },
'screens': { screens: {
'create_middle': { create_middle: {
'ticket.customer': { 'ticket.customer': {
'shown': true, shown: true,
'item_class': 'column' item_class: 'column'
}, },
'ticket.agent': { 'ticket.agent': {
'shown': true, shown: true,
'item_class': 'column' item_class: 'column'
} }
}, },
'edit': { edit: {
'ticket.customer': { 'ticket.customer': {
'shown': true shown: true
}, },
'ticket.agent': { 'ticket.agent': {
'shown': true shown: true
} }
} }
}, },
@ -835,12 +835,12 @@ RSpec.describe 'ObjectManager Attributes', type: :request do
roles: Role.where(name: 'Agent').pluck(:name), roles: Role.where(name: 'Agent').pluck(:name),
condition: { condition: {
'ticket.state_id': { 'ticket.state_id': {
'operator': 'is', operator: 'is',
'value': Ticket::State.all.pluck(:id), value: Ticket::State.all.pluck(:id),
}, },
'ticket.test_attribute_referenced_by_an_overview': { 'ticket.test_attribute_referenced_by_an_overview': {
'operator': 'contains', operator: 'contains',
'value': 'DUMMY' value: 'DUMMY'
}, },
}, },
order: { order: {
@ -892,34 +892,34 @@ RSpec.describe 'ObjectManager Attributes', type: :request do
it 'does verify if attribute type can not be changed (07)', db_strategy: :reset do it 'does verify if attribute type can not be changed (07)', db_strategy: :reset do
params = { params = {
'name': "customerdescription_#{rand(999_999_999)}", name: "customerdescription_#{rand(999_999_999)}",
'object': 'Ticket', object: 'Ticket',
'display': "custom description #{rand(999_999_999)}", display: "custom description #{rand(999_999_999)}",
'active': true, active: true,
'data_type': 'boolean', data_type: 'boolean',
'data_option': { data_option: {
'options': { options: {
'true': '', true: '',
'false': '', false: '',
}, },
'default': 'false', default: 'false',
'screens': { screens: {
'create_middle': { create_middle: {
'ticket.customer': { 'ticket.customer': {
'shown': true, shown: true,
'item_class': 'column' item_class: 'column'
}, },
'ticket.agent': { 'ticket.agent': {
'shown': true, shown: true,
'item_class': 'column' item_class: 'column'
} }
}, },
'edit': { edit: {
'ticket.customer': { 'ticket.customer': {
'shown': true shown: true
}, },
'ticket.agent': { 'ticket.agent': {
'shown': true shown: true
} }
} }
} }
@ -941,9 +941,9 @@ RSpec.describe 'ObjectManager Attributes', type: :request do
params['data_type'] = 'input' params['data_type'] = 'input'
params['data_option'] = { params['data_option'] = {
'default': 'test', default: 'test',
'type': 'text', type: 'text',
'maxlength': 120 maxlength: 120
} }
put "/api/v1/object_manager_attributes/#{json_response['id']}", params: params, as: :json put "/api/v1/object_manager_attributes/#{json_response['id']}", params: params, as: :json
@ -956,33 +956,33 @@ RSpec.describe 'ObjectManager Attributes', type: :request do
it 'does verify if attribute type can be changed (08)', db_strategy: :reset do it 'does verify if attribute type can be changed (08)', db_strategy: :reset do
params = { params = {
'name': "customerdescription_#{rand(999_999_999)}", name: "customerdescription_#{rand(999_999_999)}",
'object': 'Ticket', object: 'Ticket',
'display': "custom description #{rand(999_999_999)}", display: "custom description #{rand(999_999_999)}",
'active': true, active: true,
'data_type': 'input', data_type: 'input',
'data_option': { data_option: {
'default': 'test', default: 'test',
'type': 'text', type: 'text',
'maxlength': 120, maxlength: 120,
}, },
'screens': { screens: {
'create_middle': { create_middle: {
'ticket.customer': { 'ticket.customer': {
'shown': true, shown: true,
'item_class': 'column' item_class: 'column'
}, },
'ticket.agent': { 'ticket.agent': {
'shown': true, shown: true,
'item_class': 'column' item_class: 'column'
} }
}, },
'edit': { edit: {
'ticket.customer': { 'ticket.customer': {
'shown': true shown: true
}, },
'ticket.agent': { 'ticket.agent': {
'shown': true shown: true
} }
}, },
}, },
@ -1002,10 +1002,10 @@ RSpec.describe 'ObjectManager Attributes', type: :request do
params['data_type'] = 'select' params['data_type'] = 'select'
params['data_option'] = { params['data_option'] = {
'default': 'fuu', default: 'fuu',
'options': { options: {
'key1': 'foo', key1: 'foo',
'key2': 'fuu', key2: 'fuu',
} }
} }
@ -1039,15 +1039,15 @@ RSpec.describe 'ObjectManager Attributes', type: :request do
context 'position handling', authenticated_as: -> { admin } do context 'position handling', authenticated_as: -> { admin } do
let(:params) do let(:params) do
{ {
'name': "customerdescription_#{rand(999_999_999)}", name: "customerdescription_#{rand(999_999_999)}",
'object': 'Ticket', object: 'Ticket',
'display': "custom description #{rand(999_999_999)}", display: "custom description #{rand(999_999_999)}",
'active': true, active: true,
'data_type': 'input', data_type: 'input',
'data_option': { data_option: {
'default': 'test', default: 'test',
'type': 'text', type: 'text',
'maxlength': 120, maxlength: 120,
}, },
} }
end end

View file

@ -8,11 +8,11 @@ RSpec.describe 'KnowledgeBase translation update', type: :request, authenticated
let(:params_for_updating) do let(:params_for_updating) do
{ {
"translations_attributes": [ translations_attributes: [
{ {
"title": new_title, title: new_title,
"footer_note": 'new footer', footer_note: 'new footer',
"id": knowledge_base.kb_locales.first.id id: knowledge_base.kb_locales.first.id
} }
] ]
} }

View file

@ -355,7 +355,7 @@ class ModelTest < ActiveSupport::TestCase
params = { params = {
firstname: '123 ABC', firstname: '123 ABC',
preferences: { 'B' => 3, 'C': 4 }, preferences: { 'B' => 3, C: 4 },
} }
clean_params = User.param_cleanup(params) clean_params = User.param_cleanup(params)
clean_user_params = user.param_preferences_merge(clean_params) clean_user_params = user.param_preferences_merge(clean_params)