diff --git a/.rubocop/todo.rspec.yml b/.rubocop/todo.rspec.yml index d100a4aab..3ee2f0f92 100644 --- a/.rubocop/todo.rspec.yml +++ b/.rubocop/todo.rspec.yml @@ -326,6 +326,8 @@ RSpec/FilePath: - 'spec/db/migrate/issue_*_spec.rb' - 'spec/jobs/issue_*_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: Exclude: diff --git a/Gemfile.lock b/Gemfile.lock index 7d209bfbf..ec1e1153b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -108,7 +108,7 @@ GEM argon2 (2.0.2) ffi (~> 1.9) ffi-compiler (>= 0.1) - ast (2.4.1) + ast (2.4.2) autoprefixer-rails (9.5.1) execjs binding_of_caller (0.8.0) @@ -150,7 +150,7 @@ GEM json composite_primary_keys (11.2.0) activerecord (~> 5.2.1) - concurrent-ruby (1.1.7) + concurrent-ruby (1.1.8) coveralls (0.8.23) json (>= 1.8, < 3) simplecov (~> 0.16.1) @@ -248,7 +248,7 @@ GEM http-form_data (2.1.1) http_parser.rb (0.6.0) httpclient (2.8.3) - i18n (1.8.5) + i18n (1.8.7) concurrent-ruby (~> 1.0) icalendar (2.5.3) ice_cube (~> 0.16) @@ -291,7 +291,7 @@ GEM mini_portile2 (2.5.0) mini_racer (0.2.9) libv8 (>= 6.9.411) - minitest (5.14.2) + minitest (5.14.3) msgpack (1.2.4) multi_json (1.15.0) multi_xml (0.6.0) @@ -359,7 +359,7 @@ GEM omniauth-oauth2 (>= 1.4.0) openssl (2.1.2) parallel (1.20.1) - parser (2.7.2.0) + parser (3.0.0.0) ast (~> 2.4.1) pg (0.21.0) pluginator (1.5.0) @@ -454,28 +454,28 @@ GEM rspec-support (~> 3.9.0) rspec-support (3.9.3) rszr (0.5.2) - rubocop (1.6.1) + rubocop (1.9.1) parallel (~> 1.10) - parser (>= 2.7.1.5) + parser (>= 3.0.0.0) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml rubocop-ast (>= 1.2.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (1.3.0) + unicode-display_width (>= 1.4.0, < 3.0) + rubocop-ast (1.4.1) parser (>= 2.7.1.5) - rubocop-performance (1.9.1) + rubocop-performance (1.9.2) rubocop (>= 0.90.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.9.0) + rubocop-rails (2.9.1) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 0.90.0, < 2.0) - rubocop-rspec (2.0.1) + rubocop-rspec (2.1.0) rubocop (~> 1.0) rubocop-ast (>= 1.1.0) - ruby-progressbar (1.10.1) + ruby-progressbar (1.11.0) ruby-saml (1.10.2) nokogiri (>= 1.5.10) ruby_dep (1.5.0) @@ -536,14 +536,14 @@ GEM faraday (~> 0.9) jwt (>= 1.5, <= 2.5) nokogiri (>= 1.6, < 2.0) - tzinfo (1.2.8) + tzinfo (1.2.9) thread_safe (~> 0.1) uglifier (4.1.20) execjs (>= 0.3.0, < 3) unf (0.1.4) unf_ext unf_ext (0.0.7.5) - unicode-display_width (1.7.0) + unicode-display_width (2.0.0) unicorn (5.5.0) kgio (~> 2.6) raindrops (~> 0.7) diff --git a/app/models/ticket/search.rb b/app/models/ticket/search.rb index 64496ba2f..49b55213f 100644 --- a/app/models/ticket/search.rb +++ b/app/models/ticket/search.rb @@ -156,11 +156,11 @@ returns return [] if query_or.blank? query_extension = { - 'bool': { - 'must': [ + bool: { + must: [ { - 'bool': { - 'should': query_or, + bool: { + should: query_or, }, }, ], diff --git a/db/migrate/20170421000001_pretty_date_options_added.rb b/db/migrate/20170421000001_pretty_date_options_added.rb index 593c22b92..2959c5179 100644 --- a/db/migrate/20170421000001_pretty_date_options_added.rb +++ b/db/migrate/20170421000001_pretty_date_options_added.rb @@ -17,8 +17,8 @@ class PrettyDateOptionsAdded < ActiveRecord::Migration[4.2] name: 'pretty_date_format', tag: 'select', options: { - '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"', + 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"', }, }, ], diff --git a/db/seeds/settings.rb b/db/seeds/settings.rb index a89e8f63b..929fbb9ad 100644 --- a/db/seeds/settings.rb +++ b/db/seeds/settings.rb @@ -209,9 +209,9 @@ Setting.create_or_update( name: 'pretty_date_format', tag: 'select', options: { - '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"', - 'timestamp': 'timestamp - e. g. "2018-08-30 14:30"', + 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"', + timestamp: 'timestamp - e. g. "2018-08-30 14:30"', }, }, ], diff --git a/lib/search_index_backend.rb b/lib/search_index_backend.rb index 501349ef0..8e69ac972 100644 --- a/lib/search_index_backend.rb +++ b/lib/search_index_backend.rb @@ -959,8 +959,8 @@ helper method for making HTTP calls and raising error if response was not succes # for elasticsearch 6.x and later string_type = 'text' - string_raw = { 'type': 'keyword', 'ignore_above': 5012 } - boolean_raw = { 'type': 'boolean' } + string_raw = { type: 'keyword', ignore_above: 5012 } + boolean_raw = { type: 'boolean' } object.columns_hash.each do |key, value| if value.type == :string && value.limit && value.limit <= 5000 && store_columns.exclude?(key) diff --git a/spec/lib/core_ext/active_record/calculations/pluck_as_hash_spec.rb b/spec/lib/core_ext/active_record/calculations/pluck_as_hash_spec.rb index be816560a..d775e68ae 100644 --- a/spec/lib/core_ext/active_record/calculations/pluck_as_hash_spec.rb +++ b/spec/lib/core_ext/active_record/calculations/pluck_as_hash_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe ActiveRecord::Calculations do +RSpec.describe ActiveRecord::Calculations do # rubocop:disable RSpec/FilePath describe '#pluck_as_hash' do let(:ticket) { create(:ticket) } diff --git a/spec/lib/external_credential/google_spec.rb b/spec/lib/external_credential/google_spec.rb index f559de240..aa593f679 100644 --- a/spec/lib/external_credential/google_spec.rb +++ b/spec/lib/external_credential/google_spec.rb @@ -170,8 +170,8 @@ RSpec.describe ExternalCredential::Google do let(:response_status) { 404 } let(:response_payload) do { - "error": 'invalid_client', - "error_description": 'The OAuth client was not found.' + error: 'invalid_client', + error_description: 'The OAuth client was not found.' } end 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_payload) do { - "error": 'invalid_client', - "error_description": 'The OAuth client was not found.' + error: 'invalid_client', + error_description: 'The OAuth client was not found.' } end let(:exception_message) { /The OAuth client was not found/ } @@ -397,16 +397,16 @@ RSpec.describe ExternalCredential::Google do let(:response_status) { 401 } let(:response_payload) do { - "error": { - "code": 401, - "message": 'Invalid Credentials', - "errors": [ + error: { + code: 401, + message: 'Invalid Credentials', + errors: [ { - "locationType": 'header', - "domain": 'global', - "message": 'Invalid Credentials', - "reason": 'authError', - "location": 'Authorization' + locationType: 'header', + domain: 'global', + message: 'Invalid Credentials', + reason: 'authError', + location: 'Authorization' } ] } diff --git a/spec/lib/external_credential/microsoft365_spec.rb b/spec/lib/external_credential/microsoft365_spec.rb index caae2a1cb..7e429e43f 100644 --- a/spec/lib/external_credential/microsoft365_spec.rb +++ b/spec/lib/external_credential/microsoft365_spec.rb @@ -132,8 +132,8 @@ RSpec.describe ExternalCredential::Microsoft365 do let(:response_status) { 404 } let(:response_payload) do { - "error": 'invalid_client', - "error_description": 'The OAuth client was not found.' + error: 'invalid_client', + error_description: 'The OAuth client was not found.' } end 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_payload) do { - "error": 'invalid_client', - "error_description": 'The OAuth client was not found.' + error: 'invalid_client', + error_description: 'The OAuth client was not found.' } end let(:exception_message) { /The OAuth client was not found/ } diff --git a/spec/requests/admin/knowledge_base/public_menu_spec.rb b/spec/requests/admin/knowledge_base/public_menu_spec.rb index 48ca1a7dd..be1179fe6 100644 --- a/spec/requests/admin/knowledge_base/public_menu_spec.rb +++ b/spec/requests/admin/knowledge_base/public_menu_spec.rb @@ -5,9 +5,9 @@ RSpec.describe 'Admin Knowledge Base Public Menu', type: :request, authenticated let(:params) do { menu_items_sets: [{ - "kb_locale_id": kb_locale.id, - "location": location, - "menu_items": menu_items + kb_locale_id: kb_locale.id, + location: location, + menu_items: menu_items }] } end @@ -59,9 +59,9 @@ RSpec.describe 'Admin Knowledge Base Public Menu', type: :request, authenticated def build_params(menu_items) { menu_items_sets: [{ - "kb_locale_id": kb_locale.id, - "location": location, - "menu_items": menu_items + kb_locale_id: kb_locale.id, + location: location, + menu_items: menu_items }] } end diff --git a/spec/requests/integration/monitoring_spec.rb b/spec/requests/integration/monitoring_spec.rb index cd4a9bd84..e8c934506 100644 --- a/spec/requests/integration/monitoring_spec.rb +++ b/spec/requests/integration/monitoring_spec.rb @@ -553,37 +553,37 @@ RSpec.describe 'Monitoring', type: :request do # parameters for updating params = { - 'name': 'test4', - 'object': 'Ticket', - 'display': 'Test 4', - 'active': true, - 'data_type': 'input', - 'data_option': { - 'default': 'test', - 'type': 'text', - 'maxlength': 120 + name: 'test4', + object: 'Ticket', + display: 'Test 4', + active: true, + data_type: 'input', + data_option: { + default: 'test', + type: 'text', + maxlength: 120 }, - 'screens': { - 'create_middle': { + screens: { + create_middle: { 'ticket.customer': { - 'shown': true, - 'item_class': 'column' + shown: true, + item_class: 'column' }, 'ticket.agent': { - 'shown': true, - 'item_class': 'column' + shown: true, + item_class: 'column' } }, - 'edit': { + edit: { 'ticket.customer': { - 'shown': true + shown: true }, 'ticket.agent': { - 'shown': true + shown: true } } }, - 'id': 'c-196' + id: 'c-196' } # update the object diff --git a/spec/requests/integration/object_manager_attributes_spec.rb b/spec/requests/integration/object_manager_attributes_spec.rb index d200a9d34..fdca12174 100644 --- a/spec/requests/integration/object_manager_attributes_spec.rb +++ b/spec/requests/integration/object_manager_attributes_spec.rb @@ -14,37 +14,37 @@ RSpec.describe 'ObjectManager Attributes', type: :request do # token based on headers params = { - 'name': 'test1', - 'object': 'Ticket', - 'display': 'Test 1', - 'active': true, - 'data_type': 'input', - 'data_option': { - 'default': 'test', - 'type': 'text', - 'maxlength': 120 + name: 'test1', + object: 'Ticket', + display: 'Test 1', + active: true, + data_type: 'input', + data_option: { + default: 'test', + type: 'text', + maxlength: 120 }, - 'screens': { - 'create_middle': { + screens: { + create_middle: { 'ticket.customer': { - 'shown': true, - 'item_class': 'column' + shown: true, + item_class: 'column' }, 'ticket.agent': { - 'shown': true, - 'item_class': 'column' + shown: true, + item_class: 'column' } }, - 'edit': { + edit: { 'ticket.customer': { - 'shown': true + shown: true }, 'ticket.agent': { - 'shown': true + shown: true } } }, - 'id': 'c-196' + id: 'c-196' } 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 params = { - 'name': 'test2', - 'object': 'Ticket', - 'display': 'Test 2', - 'active': true, - 'data_type': 'input', - 'data_option': { - 'type': 'text', - 'maxlength': 120 + name: 'test2', + object: 'Ticket', + display: 'Test 2', + active: true, + data_type: 'input', + data_option: { + type: 'text', + maxlength: 120 }, - 'screens': { - 'create_middle': { + screens: { + create_middle: { 'ticket.customer': { - 'shown': true, - 'item_class': 'column' + shown: true, + item_class: 'column' }, 'ticket.agent': { - 'shown': true, - 'item_class': 'column' + shown: true, + item_class: 'column' } }, - 'edit': { + edit: { 'ticket.customer': { - 'shown': true + shown: true }, 'ticket.agent': { - 'shown': true + shown: true } } }, - 'id': 'c-196' + id: 'c-196' } post '/api/v1/object_manager_attributes', params: params, as: :json @@ -114,37 +114,37 @@ RSpec.describe 'ObjectManager Attributes', type: :request do # parameters for updating params = { - 'name': object.name, - 'object': 'Ticket', - 'display': 'Test 4', - 'active': true, - 'data_type': 'input', - 'data_option': { - 'default': 'test', - 'type': 'text', - 'maxlength': 120 + name: object.name, + object: 'Ticket', + display: 'Test 4', + active: true, + data_type: 'input', + data_option: { + default: 'test', + type: 'text', + maxlength: 120 }, - 'screens': { - 'create_middle': { + screens: { + create_middle: { 'ticket.customer': { - 'shown': true, - 'item_class': 'column' + shown: true, + item_class: 'column' }, 'ticket.agent': { - 'shown': true, - 'item_class': 'column' + shown: true, + item_class: 'column' } }, - 'edit': { + edit: { 'ticket.customer': { - 'shown': true + shown: true }, 'ticket.agent': { - 'shown': true + shown: true } } }, - 'id': 'c-196' + id: 'c-196' } # update the object @@ -162,35 +162,35 @@ RSpec.describe 'ObjectManager Attributes', type: :request do # token based on headers params = { - 'active': true, - 'data_option': { - 'options': { - 'false': 'no', - 'true': 'yes' + active: true, + data_option: { + options: { + false: 'no', + true: 'yes' } }, - 'data_type': 'boolean', - 'display': 'Boolean 2', - 'id': 'c-200', - 'name': 'bool2', - 'object': 'Ticket', - 'screens': { - 'create_middle': { + data_type: 'boolean', + display: 'Boolean 2', + id: 'c-200', + name: 'bool2', + object: 'Ticket', + screens: { + create_middle: { 'ticket.agent' => { - 'item_class': 'column', - 'shown': true + item_class: 'column', + shown: true }, 'ticket.customer' => { - 'item_class': 'column', - 'shown': true + item_class: 'column', + shown: true } }, - 'edit': { + edit: { 'ticket.agent' => { - 'shown': true + shown: true }, 'ticket.customer' => { - 'shown': true + shown: true } } } @@ -210,46 +210,46 @@ RSpec.describe 'ObjectManager Attributes', type: :request do # token based on headers params = { - 'active': true, - 'data_option': { - 'options': { - 'key1': 'foo' + active: true, + data_option: { + options: { + key1: 'foo' } }, - 'data_type': 'select', - 'display': 'Test 5', - 'id': 'c-204', - 'name': 'test5', - 'object': 'User', - 'screens': { - 'create': { + data_type: 'select', + display: 'Test 5', + id: 'c-204', + name: 'test5', + object: 'User', + screens: { + create: { 'admin.user' => { - 'shown': true + shown: true }, 'ticket.agent' => { - 'shown': true + shown: true }, 'ticket.customer' => { - 'shown': true + shown: true } }, - 'edit': { + edit: { 'admin.user' => { - 'shown': true + shown: true }, 'ticket.agent' => { - 'shown': true + shown: true } }, - 'view': { + view: { 'admin.user' => { - 'shown': true + shown: true }, 'ticket.agent' => { - 'shown': true + shown: true }, '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 params = { - 'name': "customerdescription#{rand(999_999_999)}", - 'object': 'Ticket', - 'display': "custom description#{rand(999_999_999)}", - 'active': true, - 'data_type': 'boolean', - 'data_option': { - 'options': { - 'true': '', - 'false': '', + name: "customerdescription#{rand(999_999_999)}", + object: 'Ticket', + display: "custom description#{rand(999_999_999)}", + active: true, + data_type: 'boolean', + data_option: { + options: { + true: '', + false: '', }, - 'default': 'true', - 'screens': { - 'create_middle': { + default: 'true', + screens: { + create_middle: { 'ticket.customer': { - 'shown': true, - 'item_class': 'column' + shown: true, + item_class: 'column' }, 'ticket.agent': { - 'shown': true, - 'item_class': 'column' + shown: true, + item_class: 'column' } }, - 'edit': { + edit: { 'ticket.customer': { - 'shown': true + shown: true }, 'ticket.agent': { - 'shown': true + shown: true } } } }, - 'id': 'c-201' + id: 'c-201' } 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 params = { - 'name': "customerdescription_#{rand(999_999_999)}", - 'object': 'Ticket', - 'display': "custom description #{rand(999_999_999)}", - 'active': true, - 'data_type': 'boolean', - 'data_option': { - 'options': { - 'true': '', - 'false': '', + name: "customerdescription_#{rand(999_999_999)}", + object: 'Ticket', + display: "custom description #{rand(999_999_999)}", + active: true, + data_type: 'boolean', + data_option: { + options: { + true: '', + false: '', }, - 'default': 'false', - 'screens': { - 'create_middle': { + default: 'false', + screens: { + create_middle: { 'ticket.customer': { - 'shown': true, - 'item_class': 'column' + shown: true, + item_class: 'column' }, 'ticket.agent': { - 'shown': true, - 'item_class': 'column' + shown: true, + item_class: 'column' } }, - 'edit': { + edit: { 'ticket.customer': { - 'shown': true + shown: true }, 'ticket.agent': { - 'shown': true + shown: true } } } @@ -436,36 +436,36 @@ RSpec.describe 'ObjectManager Attributes', type: :request do ObjectManager::Attribute.migration_execute params = { - 'name': 'test_attribute_referenced_by_an_overview', - 'object': 'Ticket', - 'display': 'Test Attribute', - 'active': true, - 'data_type': 'input', - 'data_option': { - 'default': '', - 'type': 'text', - 'maxlength': 120, - 'null': true, - 'options': {}, - 'relation': '' + name: 'test_attribute_referenced_by_an_overview', + object: 'Ticket', + display: 'Test Attribute', + active: true, + data_type: 'input', + data_option: { + default: '', + type: 'text', + maxlength: 120, + null: true, + options: {}, + relation: '' }, - 'screens': { - 'create_middle': { + screens: { + create_middle: { 'ticket.customer': { - 'shown': true, - 'item_class': 'column' + shown: true, + item_class: 'column' }, 'ticket.agent': { - 'shown': true, - 'item_class': 'column' + shown: true, + item_class: 'column' } }, - 'edit': { + edit: { 'ticket.customer': { - 'shown': true + shown: true }, 'ticket.agent': { - 'shown': true + shown: true } } }, @@ -483,12 +483,12 @@ RSpec.describe 'ObjectManager Attributes', type: :request do roles: Role.where(name: 'Agent').pluck(:name), condition: { 'ticket.state_id': { - 'operator': 'is', - 'value': Ticket::State.all.pluck(:id), + operator: 'is', + value: Ticket::State.all.pluck(:id), }, 'ticket.test_attribute_referenced_by_an_overview': { - 'operator': 'contains', - 'value': 'DUMMY' + operator: 'contains', + value: 'DUMMY' }, }, order: { @@ -531,36 +531,36 @@ RSpec.describe 'ObjectManager Attributes', type: :request do ObjectManager::Attribute.migration_execute params = { - 'name': 'test_attribute_referenced_by_a_trigger', - 'object': 'Ticket', - 'display': 'Test Attribute', - 'active': true, - 'data_type': 'input', - 'data_option': { - 'default': '', - 'type': 'text', - 'maxlength': 120, - 'null': true, - 'options': {}, - 'relation': '' + name: 'test_attribute_referenced_by_a_trigger', + object: 'Ticket', + display: 'Test Attribute', + active: true, + data_type: 'input', + data_option: { + default: '', + type: 'text', + maxlength: 120, + null: true, + options: {}, + relation: '' }, - 'screens': { - 'create_middle': { + screens: { + create_middle: { 'ticket.customer': { - 'shown': true, - 'item_class': 'column' + shown: true, + item_class: 'column' }, 'ticket.agent': { - 'shown': true, - 'item_class': 'column' + shown: true, + item_class: 'column' } }, - 'edit': { + edit: { 'ticket.customer': { - 'shown': true + shown: true }, 'ticket.agent': { - 'shown': true + shown: true } } }, @@ -577,17 +577,17 @@ RSpec.describe 'ObjectManager Attributes', type: :request do name: 'test_trigger', condition: { 'ticket.test_attribute_referenced_by_a_trigger': { - 'operator': 'contains', - 'value': 'DUMMY' + operator: 'contains', + value: 'DUMMY' } }, - 'perform': { + perform: { 'ticket.state_id': { - 'value': '2' + value: '2' } }, - 'active': true, - 'id': 'c-3' + active: true, + id: 'c-3' } if Trigger.where('name like ?', '%test%').empty? @@ -617,36 +617,36 @@ RSpec.describe 'ObjectManager Attributes', type: :request do ObjectManager::Attribute.migration_execute params = { - 'name': 'test_attribute_referenced_by_a_scheduler', - 'object': 'Ticket', - 'display': 'Test Attribute', - 'active': true, - 'data_type': 'input', - 'data_option': { - 'default': '', - 'type': 'text', - 'maxlength': 120, - 'null': true, - 'options': {}, - 'relation': '' + name: 'test_attribute_referenced_by_a_scheduler', + object: 'Ticket', + display: 'Test Attribute', + active: true, + data_type: 'input', + data_option: { + default: '', + type: 'text', + maxlength: 120, + null: true, + options: {}, + relation: '' }, - 'screens': { - 'create_middle': { + screens: { + create_middle: { 'ticket.customer': { - 'shown': true, - 'item_class': 'column' + shown: true, + item_class: 'column' }, 'ticket.agent': { - 'shown': true, - 'item_class': 'column' + shown: true, + item_class: 'column' } }, - 'edit': { + edit: { 'ticket.customer': { - 'shown': true + shown: true }, 'ticket.agent': { - 'shown': true + shown: true } } }, @@ -660,18 +660,18 @@ RSpec.describe 'ObjectManager Attributes', type: :request do # 2. create a scheduler that uses the attribute params = { - name: 'test_scheduler', - 'timeplan': { - 'days': { - 'Mon': true, - 'Tue': false, - 'Wed': false, - 'Thu': false, - 'Fri': false, - 'Sat': false, - 'Sun': false + name: 'test_scheduler', + timeplan: { + days: { + Mon: true, + Tue: false, + Wed: false, + Thu: false, + Fri: false, + Sat: false, + Sun: false }, - 'hours': { + hours: { '0': true, '1': false, '2': false, @@ -697,7 +697,7 @@ RSpec.describe 'ObjectManager Attributes', type: :request do '22': false, '23': false }, - 'minutes': { + minutes: { '0': true, '10': false, '20': false, @@ -706,21 +706,21 @@ RSpec.describe 'ObjectManager Attributes', type: :request do '50': false } }, - 'condition': { + condition: { 'ticket.test_attribute_referenced_by_a_scheduler': { - 'operator': 'contains', - 'value': 'DUMMY' + operator: 'contains', + value: 'DUMMY' } }, - 'perform': { + perform: { 'ticket.state_id': { - 'value': '2' + value: '2' } }, - 'disable_notification': true, - 'note': '', - 'active': true, - 'id': 'c-0' + disable_notification: true, + note: '', + active: true, + id: 'c-0' } if Job.where('name like ?', '%test%').empty? @@ -750,36 +750,36 @@ RSpec.describe 'ObjectManager Attributes', type: :request do ObjectManager::Attribute.migration_execute params = { - 'name': 'test_attribute_referenced_by_an_overview', - 'object': 'Ticket', - 'display': 'Test Attribute', - 'active': true, - 'data_type': 'input', - 'data_option': { - 'default': '', - 'type': 'text', - 'maxlength': 120, - 'null': true, - 'options': {}, - 'relation': '' + name: 'test_attribute_referenced_by_an_overview', + object: 'Ticket', + display: 'Test Attribute', + active: true, + data_type: 'input', + data_option: { + default: '', + type: 'text', + maxlength: 120, + null: true, + options: {}, + relation: '' }, - 'screens': { - 'create_middle': { + screens: { + create_middle: { 'ticket.customer': { - 'shown': true, - 'item_class': 'column' + shown: true, + item_class: 'column' }, 'ticket.agent': { - 'shown': true, - 'item_class': 'column' + shown: true, + item_class: 'column' } }, - 'edit': { + edit: { 'ticket.customer': { - 'shown': true + shown: true }, '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 params = { - 'name': 'test_attribute_referenced_by_an_overview', - 'object': 'User', - 'display': 'Test Attribute', - 'active': true, - 'data_type': 'input', - 'data_option': { - 'default': '', - 'type': 'text', - 'maxlength': 120, - 'null': true, - 'options': {}, - 'relation': '' + name: 'test_attribute_referenced_by_an_overview', + object: 'User', + display: 'Test Attribute', + active: true, + data_type: 'input', + data_option: { + default: '', + type: 'text', + maxlength: 120, + null: true, + options: {}, + relation: '' }, - 'screens': { - 'create_middle': { + screens: { + create_middle: { 'ticket.customer': { - 'shown': true, - 'item_class': 'column' + shown: true, + item_class: 'column' }, 'ticket.agent': { - 'shown': true, - 'item_class': 'column' + shown: true, + item_class: 'column' } }, - 'edit': { + edit: { 'ticket.customer': { - 'shown': true + shown: true }, 'ticket.agent': { - 'shown': true + shown: true } } }, @@ -835,12 +835,12 @@ RSpec.describe 'ObjectManager Attributes', type: :request do roles: Role.where(name: 'Agent').pluck(:name), condition: { 'ticket.state_id': { - 'operator': 'is', - 'value': Ticket::State.all.pluck(:id), + operator: 'is', + value: Ticket::State.all.pluck(:id), }, 'ticket.test_attribute_referenced_by_an_overview': { - 'operator': 'contains', - 'value': 'DUMMY' + operator: 'contains', + value: 'DUMMY' }, }, 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 params = { - 'name': "customerdescription_#{rand(999_999_999)}", - 'object': 'Ticket', - 'display': "custom description #{rand(999_999_999)}", - 'active': true, - 'data_type': 'boolean', - 'data_option': { - 'options': { - 'true': '', - 'false': '', + name: "customerdescription_#{rand(999_999_999)}", + object: 'Ticket', + display: "custom description #{rand(999_999_999)}", + active: true, + data_type: 'boolean', + data_option: { + options: { + true: '', + false: '', }, - 'default': 'false', - 'screens': { - 'create_middle': { + default: 'false', + screens: { + create_middle: { 'ticket.customer': { - 'shown': true, - 'item_class': 'column' + shown: true, + item_class: 'column' }, 'ticket.agent': { - 'shown': true, - 'item_class': 'column' + shown: true, + item_class: 'column' } }, - 'edit': { + edit: { 'ticket.customer': { - 'shown': true + shown: true }, 'ticket.agent': { - 'shown': true + shown: true } } } @@ -941,9 +941,9 @@ RSpec.describe 'ObjectManager Attributes', type: :request do params['data_type'] = 'input' params['data_option'] = { - 'default': 'test', - 'type': 'text', - 'maxlength': 120 + default: 'test', + type: 'text', + maxlength: 120 } 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 params = { - 'name': "customerdescription_#{rand(999_999_999)}", - 'object': 'Ticket', - 'display': "custom description #{rand(999_999_999)}", - 'active': true, - 'data_type': 'input', - 'data_option': { - 'default': 'test', - 'type': 'text', - 'maxlength': 120, + name: "customerdescription_#{rand(999_999_999)}", + object: 'Ticket', + display: "custom description #{rand(999_999_999)}", + active: true, + data_type: 'input', + data_option: { + default: 'test', + type: 'text', + maxlength: 120, }, - 'screens': { - 'create_middle': { + screens: { + create_middle: { 'ticket.customer': { - 'shown': true, - 'item_class': 'column' + shown: true, + item_class: 'column' }, 'ticket.agent': { - 'shown': true, - 'item_class': 'column' + shown: true, + item_class: 'column' } }, - 'edit': { + edit: { 'ticket.customer': { - 'shown': true + shown: true }, 'ticket.agent': { - 'shown': true + shown: true } }, }, @@ -1002,10 +1002,10 @@ RSpec.describe 'ObjectManager Attributes', type: :request do params['data_type'] = 'select' params['data_option'] = { - 'default': 'fuu', - 'options': { - 'key1': 'foo', - 'key2': 'fuu', + default: 'fuu', + options: { + key1: 'foo', + key2: 'fuu', } } @@ -1039,15 +1039,15 @@ RSpec.describe 'ObjectManager Attributes', type: :request do context 'position handling', authenticated_as: -> { admin } do let(:params) do { - 'name': "customerdescription_#{rand(999_999_999)}", - 'object': 'Ticket', - 'display': "custom description #{rand(999_999_999)}", - 'active': true, - 'data_type': 'input', - 'data_option': { - 'default': 'test', - 'type': 'text', - 'maxlength': 120, + name: "customerdescription_#{rand(999_999_999)}", + object: 'Ticket', + display: "custom description #{rand(999_999_999)}", + active: true, + data_type: 'input', + data_option: { + default: 'test', + type: 'text', + maxlength: 120, }, } end diff --git a/spec/requests/knowledge_base/translation_update_spec.rb b/spec/requests/knowledge_base/translation_update_spec.rb index 6ddb047fa..ef8462c96 100644 --- a/spec/requests/knowledge_base/translation_update_spec.rb +++ b/spec/requests/knowledge_base/translation_update_spec.rb @@ -8,11 +8,11 @@ RSpec.describe 'KnowledgeBase translation update', type: :request, authenticated let(:params_for_updating) do { - "translations_attributes": [ + translations_attributes: [ { - "title": new_title, - "footer_note": 'new footer', - "id": knowledge_base.kb_locales.first.id + title: new_title, + footer_note: 'new footer', + id: knowledge_base.kb_locales.first.id } ] } diff --git a/test/unit/model_test.rb b/test/unit/model_test.rb index b5489e940..5cce00522 100644 --- a/test/unit/model_test.rb +++ b/test/unit/model_test.rb @@ -355,7 +355,7 @@ class ModelTest < ActiveSupport::TestCase params = { firstname: '123 ABC', - preferences: { 'B' => 3, 'C': 4 }, + preferences: { 'B' => 3, C: 4 }, } clean_params = User.param_cleanup(params) clean_user_params = user.param_preferences_merge(clean_params)