diff --git a/.rubocop/default.yml b/.rubocop/default.yml index 7f350213f..49e5cb767 100644 --- a/.rubocop/default.yml +++ b/.rubocop/default.yml @@ -81,11 +81,6 @@ Style/RescueStandardError: Enabled: true EnforcedStyle: implicit -Layout/SpaceInsideParens: - Description: 'No spaces after ( or before ).' - StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-spaces-braces' - Enabled: false - Layout/LeadingCommentSpace: Description: 'Comments should start with a space.' StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-space' diff --git a/app/controllers/channels_google_controller.rb b/app/controllers/channels_google_controller.rb index 88fc4ee88..ebd008639 100644 --- a/app/controllers/channels_google_controller.rb +++ b/app/controllers/channels_google_controller.rb @@ -76,7 +76,7 @@ class ChannelsGoogleController < ApplicationController channel.refresh_xoauth2!(force: true) result = EmailHelper::Probe.inbound(channel.options[:inbound]) - raise Exceptions::UnprocessableEntity, ( result[:message_human] || result[:message] ) if result[:result] == 'invalid' + raise Exceptions::UnprocessableEntity, (result[:message_human] || result[:message]) if result[:result] == 'invalid' channel.status_in = 'ok' channel.status_out = 'ok' diff --git a/app/controllers/channels_microsoft365_controller.rb b/app/controllers/channels_microsoft365_controller.rb index 0427852b4..de0e3544d 100644 --- a/app/controllers/channels_microsoft365_controller.rb +++ b/app/controllers/channels_microsoft365_controller.rb @@ -76,7 +76,7 @@ class ChannelsMicrosoft365Controller < ApplicationController channel.refresh_xoauth2!(force: true) result = EmailHelper::Probe.inbound(channel.options[:inbound]) - raise Exceptions::UnprocessableEntity, ( result[:message_human] || result[:message] ) if result[:result] == 'invalid' + raise Exceptions::UnprocessableEntity, (result[:message_human] || result[:message]) if result[:result] == 'invalid' channel.status_in = 'ok' channel.status_out = 'ok' diff --git a/app/controllers/user_devices_controller.rb b/app/controllers/user_devices_controller.rb index dc9d6e053..c5a8a3440 100644 --- a/app/controllers/user_devices_controller.rb +++ b/app/controllers/user_devices_controller.rb @@ -37,7 +37,7 @@ class UserDevicesController < ApplicationController next if !session.data['user_device_id'] next if session.data['user_device_id'] != user_device.id - SessionHelper.destroy( session.id ) + SessionHelper.destroy(session.id) end user_device.destroy end diff --git a/app/models/activity_stream.rb b/app/models/activity_stream.rb index 881052822..18d82eaaf 100644 --- a/app/models/activity_stream.rb +++ b/app/models/activity_stream.rb @@ -65,7 +65,7 @@ add a new activity entry for an object # return if old entry is really fresh if result activity_record_delay = 90.seconds - return result if result.created_at.to_i >= ( data[:created_at].to_i - activity_record_delay ) + return result if result.created_at.to_i >= (data[:created_at].to_i - activity_record_delay) end # create history diff --git a/app/models/application_model/can_associations.rb b/app/models/application_model/can_associations.rb index 9886f36ba..47c8a1812 100644 --- a/app/models/application_model/can_associations.rb +++ b/app/models/application_model/can_associations.rb @@ -146,7 +146,7 @@ returns if keys.size > 1 values = ids.transpose.map(&:compact).map(&:uniq) - attributes.merge!( keys.zip( values ).to_h ) + attributes.merge!(keys.zip(values).to_h) else attributes[ keys.first ] = ids.compact end diff --git a/app/models/channel/filter/follow_up_check.rb b/app/models/channel/filter/follow_up_check.rb index 2e041505c..518032731 100644 --- a/app/models/channel/filter/follow_up_check.rb +++ b/app/models/channel/filter/follow_up_check.rb @@ -55,7 +55,7 @@ module Channel::Filter::FollowUpCheck end # get ticket# from references - return true if ( setting.include?('references') || (mail[:'x-zammad-is-auto-response'] == true || Setting.get('ticket_hook_position') == 'none') ) && follow_up_by_md5(mail) + return true if (setting.include?('references') || (mail[:'x-zammad-is-auto-response'] == true || Setting.get('ticket_hook_position') == 'none')) && follow_up_by_md5(mail) # get ticket# from references current email has same subject as initial article if mail[:subject].present? diff --git a/app/models/concerns/has_groups.rb b/app/models/concerns/has_groups.rb index 11c1d7437..a6c30af7c 100644 --- a/app/models/concerns/has_groups.rb +++ b/app/models/concerns/has_groups.rb @@ -320,7 +320,7 @@ module HasGroups # check direct access instances = joins(group_through.name) - .where( group_through.table_name => { group_id: group_id, access: access }, active: true ) + .where(group_through.table_name => { group_id: group_id, access: access }, active: true) if method_defined?(:permissions?) permissions = Permission.with_parents('ticket.agent') diff --git a/app/models/knowledge_base/menu_item.rb b/app/models/knowledge_base/menu_item.rb index 71d92df7e..dcc35ae78 100644 --- a/app/models/knowledge_base/menu_item.rb +++ b/app/models/knowledge_base/menu_item.rb @@ -10,7 +10,7 @@ class KnowledgeBase::MenuItem < ApplicationModel acts_as_list scope: %i[kb_locale_id location], top_of_list: 0 scope :sorted, -> { order(position: :asc) } - scope :using_locale, ->(locale) { locale.present? ? joins(:kb_locale).where(knowledge_base_locales: { system_locale_id: locale.id } ) : none } + scope :using_locale, ->(locale) { locale.present? ? joins(:kb_locale).where(knowledge_base_locales: { system_locale_id: locale.id }) : none } scope :location, ->(location) { sorted.where(location: location) } scope :location_header, -> { location(:header) } diff --git a/app/models/link.rb b/app/models/link.rb index 46bd3c0f2..909bcaef2 100644 --- a/app/models/link.rb +++ b/app/models/link.rb @@ -23,7 +23,7 @@ class Link < ApplicationModel =end def self.list(data) - linkobject = link_object_get( name: data[:link_object] ) + linkobject = link_object_get(name: data[:link_object]) return if !linkobject items = [] @@ -35,8 +35,8 @@ class Link < ApplicationModel list.each do |item| link = {} - link['link_type'] = @map[ Link::Type.find( item.link_type_id ).name ] - link['link_object'] = Link::Object.find( item.link_object_target_id ).name + link['link_type'] = @map[ Link::Type.find(item.link_type_id).name ] + link['link_object'] = Link::Object.find(item.link_object_target_id).name link['link_object_value'] = item.link_object_target_value items.push link end @@ -47,8 +47,8 @@ class Link < ApplicationModel ) list.each do |item| link = {} - link['link_type'] = Link::Type.find( item.link_type_id ).name - link['link_object'] = Link::Object.find( item.link_object_source_id ).name + link['link_type'] = Link::Type.find(item.link_type_id).name + link['link_object'] = Link::Object.find(item.link_object_source_id).name link['link_object_value'] = item.link_object_source_value items.push link end diff --git a/app/models/package.rb b/app/models/package.rb index 65bacaae3..22bd30d64 100644 --- a/app/models/package.rb +++ b/app/models/package.rb @@ -440,7 +440,7 @@ execute all pending package migrations at once # check if directories need to be created directories = location.split '/' - (0..(directories.length - 2) ).each do |position| + (0..(directories.length - 2)).each do |position| tmp_path = '' (1..position).each do |count| tmp_path = "#{tmp_path}/#{directories[count]}" diff --git a/app/models/ticket.rb b/app/models/ticket.rb index 79b27c889..d7e6ad191 100644 --- a/app/models/ticket.rb +++ b/app/models/ticket.rb @@ -113,7 +113,7 @@ returns end if user.permissions?('ticket.customer') - if !user.organization || ( !user.organization.shared || user.organization.shared == false ) + if !user.organization || (!user.organization.shared || user.organization.shared == false) sql.push('tickets.customer_id = ?') bind.push(user.id) else @@ -661,7 +661,7 @@ condition example biz = Calendar.lookup(id: selector['value'])&.biz next if biz.blank? - if ( selector['operator'] == 'is in working time' && !biz.in_hours?(Time.zone.now) ) || ( selector['operator'] == 'is not in working time' && biz.in_hours?(Time.zone.now) ) + if (selector['operator'] == 'is in working time' && !biz.in_hours?(Time.zone.now)) || (selector['operator'] == 'is not in working time' && biz.in_hours?(Time.zone.now)) no_result = true break end diff --git a/app/models/ticket/article.rb b/app/models/ticket/article.rb index 70bffd6ba..c33f35970 100644 --- a/app/models/ticket/article.rb +++ b/app/models/ticket/article.rb @@ -91,7 +91,7 @@ returns return article if article['body'] !~ %r{}im ) do |item| + article['body'].gsub!(%r{(}im) do |item| tag_start = $1 cid = $3 tag_end = $4 @@ -99,7 +99,7 @@ returns # look for attachment article['attachments'].each do |file| - next if !file[:preferences] || !file[:preferences]['Content-ID'] || (file[:preferences]['Content-ID'] != cid && file[:preferences]['Content-ID'] != "<#{cid}>" ) + next if !file[:preferences] || !file[:preferences]['Content-ID'] || (file[:preferences]['Content-ID'] != cid && file[:preferences]['Content-ID'] != "<#{cid}>") replace = "#{tag_start}/api/v1/ticket_attachment/#{article['ticket_id']}/#{article['id']}/#{file[:id]}?view=inline\"#{tag_end}>" inline_attachments[file[:id]] = true @@ -132,13 +132,13 @@ returns def attachments_inline inline_attachments = {} - body.gsub( %r{}im ) do |_item| + body.gsub(%r{}im) do |_item| cid = $2 # look for attachment attachments.each do |file| content_id = file.preferences['Content-ID'] || file.preferences['content_id'] - next if content_id.blank? || (content_id != cid && content_id != "<#{cid}>" ) + next if content_id.blank? || (content_id != cid && content_id != "<#{cid}>") inline_attachments[file.id] = true break diff --git a/app/models/ticket/search.rb b/app/models/ticket/search.rb index b6ab5e384..7aab19d69 100644 --- a/app/models/ticket/search.rb +++ b/app/models/ticket/search.rb @@ -138,7 +138,7 @@ returns end end if current_user.permissions?('ticket.customer') - access_condition = if !current_user.organization || ( !current_user.organization.shared || current_user.organization.shared == false ) + access_condition = if !current_user.organization || (!current_user.organization.shared || current_user.organization.shared == false) { 'query_string' => { 'default_field' => 'customer_id', 'query' => current_user.id } } @@ -202,7 +202,7 @@ returns query.delete! '*' tickets_all = Ticket.select("DISTINCT(tickets.id), #{order_select_sql}") .where(access_condition) - .where('(tickets.title LIKE ? OR tickets.number LIKE ? OR ticket_articles.body LIKE ? OR ticket_articles.from LIKE ? OR ticket_articles.to LIKE ? OR ticket_articles.subject LIKE ?)', "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%" ) + .where('(tickets.title LIKE ? OR tickets.number LIKE ? OR ticket_articles.body LIKE ? OR ticket_articles.from LIKE ? OR ticket_articles.to LIKE ? OR ticket_articles.subject LIKE ?)', "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%") .joins(:articles) .order(Arel.sql(order_sql)) .offset(offset) diff --git a/app/models/type_lookup.rb b/app/models/type_lookup.rb index 9707300ad..f88895fd5 100644 --- a/app/models/type_lookup.rb +++ b/app/models/type_lookup.rb @@ -2,16 +2,16 @@ class TypeLookup < ApplicationModel - def self.by_id( id ) - lookup = self.lookup( id: id ) + def self.by_id(id) + lookup = self.lookup(id: id) return if !lookup lookup.name end - def self.by_name( name ) + def self.by_name(name) # lookup - lookup = self.lookup( name: name ) + lookup = self.lookup(name: name) if lookup return lookup.id end diff --git a/config/initializers/core_ext.rb b/config/initializers/core_ext.rb index 92529841e..8fbeaafaf 100644 --- a/config/initializers/core_ext.rb +++ b/config/initializers/core_ext.rb @@ -1,7 +1,7 @@ # Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/ # load all core_ext extensions -Dir.glob( Rails.root.join('lib/core_ext/**/*') ).sort.each do |file| +Dir.glob(Rails.root.join('lib/core_ext/**/*')).sort.each do |file| if File.file?(file) require file end diff --git a/config/routes.rb b/config/routes.rb index 2b0ccf8c9..3aee08bc5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -14,7 +14,7 @@ Rails.application.routes.draw do # load routes from external files dir = File.expand_path(__dir__) - files = Dir.glob( "#{dir}/routes/*.rb" ) + files = Dir.glob("#{dir}/routes/*.rb") files.each do |file| if Rails.configuration.cache_classes require_dependency file diff --git a/db/migrate/20170123000002_fixed_translation.rb b/db/migrate/20170123000002_fixed_translation.rb index c7b70b6e2..1294c0ba5 100644 --- a/db/migrate/20170123000002_fixed_translation.rb +++ b/db/migrate/20170123000002_fixed_translation.rb @@ -403,7 +403,7 @@ class FixedTranslation < ActiveRecord::Migration[4.2] ] settings_update.each do |setting| - fetched_setting = Setting.find_by(name: setting['name'] ) + fetched_setting = Setting.find_by(name: setting['name']) next if !fetched_setting if setting['title'] diff --git a/lib/calendar_subscriptions/tickets.rb b/lib/calendar_subscriptions/tickets.rb index e18754813..c19c41649 100644 --- a/lib/calendar_subscriptions/tickets.rb +++ b/lib/calendar_subscriptions/tickets.rb @@ -44,7 +44,7 @@ class CalendarSubscriptions::Tickets owner_ids = [ @user.id ] end if preferences[:not_assigned] - owner_ids.push( 1 ) + owner_ids.push(1) end owner_ids diff --git a/lib/import/exchange/item_attributes.rb b/lib/import/exchange/item_attributes.rb index 91ed6d3a9..04e492ec5 100644 --- a/lib/import/exchange/item_attributes.rb +++ b/lib/import/exchange/item_attributes.rb @@ -55,9 +55,9 @@ module Import def sub_elems(elems) elems.each_with_object({}) do |elem, result| if elem[:entry] - result.merge!( sub_elem_entry( elem[:entry] ) ) + result.merge!(sub_elem_entry(elem[:entry])) else - result.merge!( normalize(elem) ) + result.merge!(normalize(elem)) end end end @@ -88,7 +88,7 @@ module Import result_key = key if prefix - result_key = if keys.include?(key) && ( !result[result_key] || result[result_key] == value ) + result_key = if keys.include?(key) && (!result[result_key] || result[result_key] == value) prefix else :"#{prefix}.#{key}" diff --git a/lib/import/otrs/ticket.rb b/lib/import/otrs/ticket.rb index dc9175a22..a4f2eff1c 100644 --- a/lib/import/otrs/ticket.rb +++ b/lib/import/otrs/ticket.rb @@ -98,7 +98,7 @@ module Import dynamic_field_name = key_string[13, key_string.length] - next if Import::OTRS::DynamicFieldFactory.skip_field?( dynamic_field_name ) + next if Import::OTRS::DynamicFieldFactory.skip_field?(dynamic_field_name) dynamic_field_name = Import::OTRS::DynamicField.convert_name(dynamic_field_name) diff --git a/lib/import/otrs/user.rb b/lib/import/otrs/user.rb index 697077287..42eafa1ab 100644 --- a/lib/import/otrs/user.rb +++ b/lib/import/otrs/user.rb @@ -164,7 +164,7 @@ module Import end return result if !group['Name'].match?(%r{^(stats|report)}) - return result if !( permissions.include?('ro') || permissions.include?('rw') ) + return result if !(permissions.include?('ro') || permissions.include?('rw')) result.push 'Report' result diff --git a/lib/import/zendesk/object_attribute/base.rb b/lib/import/zendesk/object_attribute/base.rb index 526089d80..bf4c469f4 100644 --- a/lib/import/zendesk/object_attribute/base.rb +++ b/lib/import/zendesk/object_attribute/base.rb @@ -18,7 +18,7 @@ module Import def init_callback(_attribute); end def add(object, name, attribute) - ObjectManager::Attribute.add( attribute_config(object, name, attribute) ) + ObjectManager::Attribute.add(attribute_config(object, name, attribute)) ObjectManager::Attribute.migration_execute(false) rescue # rubocop:disable Style/SpecialGlobalVars diff --git a/lib/report/base.rb b/lib/report/base.rb index 96a0ee3b2..276b39b4a 100644 --- a/lib/report/base.rb +++ b/lib/report/base.rb @@ -333,7 +333,7 @@ class Report::Base end def self.ticket_condition(ticket_id, condition) - ticket = Ticket.lookup( id: ticket_id ) + ticket = Ticket.lookup(id: ticket_id) condition.each do |key, value| if ticket[key.to_sym] != value return false diff --git a/lib/report/ticket_first_solution.rb b/lib/report/ticket_first_solution.rb index c9b740697..2f84a8485 100644 --- a/lib/report/ticket_first_solution.rb +++ b/lib/report/ticket_first_solution.rb @@ -62,7 +62,7 @@ returns ticket_list.each do |ticket| closed_at = ticket.close_at created_at = ticket.created_at - if (closed_at - (60 * 15) ) < created_at + if (closed_at - (60 * 15)) < created_at count += 1 end end @@ -112,7 +112,7 @@ returns ticket_list.each do |ticket| closed_at = ticket.close_at created_at = ticket.created_at - if (closed_at - (60 * 15) ) < created_at + if (closed_at - (60 * 15)) < created_at count += 1 ticket_ids.push ticket.id end diff --git a/lib/sequencer/unit/import/zendesk/user_group_map.rb b/lib/sequencer/unit/import/zendesk/user_group_map.rb index 7e19d20e8..6f70ec9db 100644 --- a/lib/sequencer/unit/import/zendesk/user_group_map.rb +++ b/lib/sequencer/unit/import/zendesk/user_group_map.rb @@ -19,7 +19,7 @@ class Sequencer result = {} client.group_memberships.all! do |group_membership| result[ group_membership.user_id ] ||= [] - result[ group_membership.user_id ].push( group_membership.group_id ) + result[ group_membership.user_id ].push(group_membership.group_id) end result end diff --git a/lib/session_helper.rb b/lib/session_helper.rb index bd8350bae..9b3f8c826 100644 --- a/lib/session_helper.rb +++ b/lib/session_helper.rb @@ -19,7 +19,7 @@ module SessionHelper # load collections to deliver from external files dir = File.expand_path('..', __dir__) - files = Dir.glob( "#{dir}/lib/session_helper/collection_*.rb") + files = Dir.glob("#{dir}/lib/session_helper/collection_*.rb") files.each do |file| file =~ %r{/(session_helper/collection_.*)\.rb\z} (default_collection, assets) = $1.camelize.constantize.session(default_collection, assets, user) diff --git a/lib/session_helper/collection_base.rb b/lib/session_helper/collection_base.rb index 3f3a16351..c55224354 100644 --- a/lib/session_helper/collection_base.rb +++ b/lib/session_helper/collection_base.rb @@ -4,7 +4,7 @@ module SessionHelper::CollectionBase module_function - def session( collections, assets, user ) + def session(collections, assets, user) # all base stuff collections[ Locale.to_app_model ] = Locale.where(active: true) diff --git a/lib/session_helper/collection_dashboard.rb b/lib/session_helper/collection_dashboard.rb index 39b9049b3..331fc055e 100644 --- a/lib/session_helper/collection_dashboard.rb +++ b/lib/session_helper/collection_dashboard.rb @@ -4,7 +4,7 @@ module SessionHelper::CollectionDashboard module_function - def session( collections, assets, user ) + def session(collections, assets, user) return [collections, assets] if !user item = StatsStore.find_by( diff --git a/lib/session_helper/collection_ticket.rb b/lib/session_helper/collection_ticket.rb index 1423731ae..d0d385a76 100644 --- a/lib/session_helper/collection_ticket.rb +++ b/lib/session_helper/collection_ticket.rb @@ -4,7 +4,7 @@ module SessionHelper::CollectionTicket module_function - def session( collections, assets, user ) + def session(collections, assets, user) # all ticket stuff collections[ Ticket::StateType.to_app_model ] = [] diff --git a/lib/sessions.rb b/lib/sessions.rb index f6f177e29..deaad120e 100644 --- a/lib/sessions.rb +++ b/lib/sessions.rb @@ -152,7 +152,7 @@ returns list_of_closed_sessions = [] clients = Sessions.list clients.each do |client_id, client| - if !client[:meta] || !client[:meta][:last_ping] || ( client[:meta][:last_ping].to_i + idle_time_in_sec ) < Time.now.utc.to_i + if !client[:meta] || !client[:meta][:last_ping] || (client[:meta][:last_ping].to_i + idle_time_in_sec) < Time.now.utc.to_i list_of_closed_sessions.push client_id Sessions.destroy(client_id) end @@ -579,7 +579,7 @@ returns Sessions::Client.new(client_id, node_id) rescue => e log('error', "thread_client #{client_id} exited with error #{e.inspect}") - log('error', e.backtrace.join("\n ") ) + log('error', e.backtrace.join("\n ")) sleep 10 begin ActiveRecord::Base.connection_pool.release_connection @@ -591,7 +591,7 @@ returns try_count += 1 # reset error counter if to old - if try_run_time + ( 60 * 5 ) < Time.now.utc + if try_run_time + (60 * 5) < Time.now.utc try_count = 0 end try_run_time = Time.now.utc diff --git a/lib/sessions/store/file.rb b/lib/sessions/store/file.rb index 107e5ec84..c9dc52ba3 100644 --- a/lib/sessions/store/file.rb +++ b/lib/sessions/store/file.rb @@ -70,7 +70,7 @@ class Sessions::Store::File def set(client_id, data) path = "#{@path}/#{client_id}" - File.open("#{path}/session", 'wb' ) do |file| + File.open("#{path}/session", 'wb') do |file| file.flock(File::LOCK_EX) file.write data.to_json file.flock(File::LOCK_UN) diff --git a/lib/sessions/store/redis.rb b/lib/sessions/store/redis.rb index a7e44d50e..607df4b18 100644 --- a/lib/sessions/store/redis.rb +++ b/lib/sessions/store/redis.rb @@ -10,7 +10,7 @@ class Sessions::Store::Redis # Only load redis if it is really used. require 'redis' require 'hiredis' - @redis = Redis.new( driver: :hiredis ) + @redis = Redis.new(driver: :hiredis) end def create(client_id, data) diff --git a/lib/sql_helper.rb b/lib/sql_helper.rb index 01c581a93..e38c17d02 100644 --- a/lib/sql_helper.rb +++ b/lib/sql_helper.rb @@ -128,7 +128,7 @@ sql = 'tickets.created_at, tickets.updated_at' next if value.blank? next if order_by[index].blank? - sql.push( "#{ActiveRecord::Base.connection.quote_table_name(@object.table_name)}.#{ActiveRecord::Base.connection.quote_column_name(value)}" ) + sql.push("#{ActiveRecord::Base.connection.quote_table_name(@object.table_name)}.#{ActiveRecord::Base.connection.quote_column_name(value)}") end sql = set_sql_order_default(sql, default) @@ -162,7 +162,7 @@ sql = 'tickets.created_at ASC, tickets.updated_at DESC' next if value.blank? next if order_by[index].blank? - sql.push( "#{ActiveRecord::Base.connection.quote_table_name(@object.table_name)}.#{ActiveRecord::Base.connection.quote_column_name(value)} #{order_by[index]}" ) + sql.push("#{ActiveRecord::Base.connection.quote_table_name(@object.table_name)}.#{ActiveRecord::Base.connection.quote_column_name(value)} #{order_by[index]}") end sql = set_sql_order_default(sql, default) diff --git a/lib/static_assets.rb b/lib/static_assets.rb index cfab8f587..2be25b1f5 100644 --- a/lib/static_assets.rb +++ b/lib/static_assets.rb @@ -71,7 +71,7 @@ returns def self.read_raw list = Store.list(object: 'System::Logo', o_id: 1) if list && list[0] - return Store.find( list[0] ) + return Store.find(list[0]) end raise 'No such raw logo!' diff --git a/lib/stats.rb b/lib/stats.rb index fd517fa22..d7efe01a5 100644 --- a/lib/stats.rb +++ b/lib/stats.rb @@ -63,7 +63,7 @@ returns # generate average param and icon state backend_average_sum.each do |backend_model_average, result| - average = ( result.to_f / agent_count ).round(1) + average = (result.to_f / agent_count).round(1) user_result.each do |user, data| next if !data[backend_model_average] next if !data[backend_model_average].key?(:used_for_average) diff --git a/lib/stats/ticket_channel_distribution.rb b/lib/stats/ticket_channel_distribution.rb index f19ca6c61..71704fcc6 100644 --- a/lib/stats/ticket_channel_distribution.rb +++ b/lib/stats/ticket_channel_distribution.rb @@ -91,7 +91,7 @@ class Stats::TicketChannelDistribution type_ids.push type.id end - sender = Ticket::Article::Sender.lookup( name: 'Customer' ) + sender = Ticket::Article::Sender.lookup(name: 'Customer') count = Ticket.where(group_id: group_ids).joins(:articles).where( ticket_articles: { sender_id: sender, type_id: type_ids } ).where( @@ -100,7 +100,7 @@ class Stats::TicketChannelDistribution result[channel[:sender].to_sym][:inbound] = count total_in += count - sender = Ticket::Article::Sender.lookup( name: 'Agent' ) + sender = Ticket::Article::Sender.lookup(name: 'Agent') count = Ticket.where(group_id: group_ids).joins(:articles).where( ticket_articles: { sender_id: sender, type_id: type_ids } ).where( diff --git a/lib/stats/ticket_in_process.rb b/lib/stats/ticket_in_process.rb index 625a4fff9..4dcd0ee78 100644 --- a/lib/stats/ticket_in_process.rb +++ b/lib/stats/ticket_in_process.rb @@ -40,7 +40,7 @@ class Stats::TicketInProcess average_in_percent = '-' if total.nonzero? - in_process_precent = ( count.to_f / (total.to_f / 100) ).round(1) + in_process_precent = (count.to_f / (total.to_f / 100)).round(1) end { @@ -62,7 +62,7 @@ class Stats::TicketInProcess return result end - in_percent = ( result[:used_for_average].to_f / (result[:average_per_agent].to_f / 100) ).round(1) + in_percent = (result[:used_for_average].to_f / (result[:average_per_agent].to_f / 100)).round(1) result[:state] = if in_percent >= 90 'supergood' elsif in_percent >= 65 diff --git a/lib/stats/ticket_load_measure.rb b/lib/stats/ticket_load_measure.rb index eb227ac74..68ec1a4e6 100644 --- a/lib/stats/ticket_load_measure.rb +++ b/lib/stats/ticket_load_measure.rb @@ -21,7 +21,7 @@ class Stats::TicketLoadMeasure end if total.nonzero? - load_measure_precent = ( count.to_f / (total.to_f / 100) ).round(1) + load_measure_precent = (count.to_f / (total.to_f / 100)).round(1) end { used_for_average: load_measure_precent, @@ -42,7 +42,7 @@ class Stats::TicketLoadMeasure return result end - in_percent = ( result[:used_for_average].to_f / (result[:average_per_agent].to_f / 100) ).round(1) + in_percent = (result[:used_for_average].to_f / (result[:average_per_agent].to_f / 100)).round(1) result[:average_per_agent_in_percent] = in_percent result[:state] = if in_percent >= 90 'supergood' @@ -57,7 +57,7 @@ class Stats::TicketLoadMeasure end # convert result[:used_for_average] in percent to related total - result[:average_per_agent] = ( (result[:total].to_f / 100) * result[:average_per_agent] ).round(1) + result[:average_per_agent] = ((result[:total].to_f / 100) * result[:average_per_agent]).round(1) result end diff --git a/lib/stats/ticket_reopen.rb b/lib/stats/ticket_reopen.rb index 9d6b721ea..dcb31092b 100644 --- a/lib/stats/ticket_reopen.rb +++ b/lib/stats/ticket_reopen.rb @@ -22,7 +22,7 @@ class Stats::TicketReopen reopen_in_precent = 0 if total.nonzero? - reopen_in_precent = ( count.to_f / (total.to_f / 100) ).round(1) + reopen_in_precent = (count.to_f / (total.to_f / 100)).round(1) end { used_for_average: reopen_in_precent, @@ -45,7 +45,7 @@ class Stats::TicketReopen #in_percent = ( result[:used_for_average].to_f / (result[:average_per_agent].to_f / 100) ).round(1) #result[:average_per_agent_in_percent] = in_percent - in_percent = ( result[:count].to_f / (result[:total].to_f / 100) ).round(1) + in_percent = (result[:count].to_f / (result[:total].to_f / 100)).round(1) result[:state] = if in_percent >= 90 'superbad' elsif in_percent >= 65 diff --git a/lib/stats/ticket_response_time.rb b/lib/stats/ticket_response_time.rb index 0d772f3a4..54fab16e9 100644 --- a/lib/stats/ticket_response_time.rb +++ b/lib/stats/ticket_response_time.rb @@ -54,7 +54,7 @@ class Stats::TicketResponseTime return result end - in_percent = ( result[:used_for_average].to_f / (result[:total].to_f / 100) ).round(1) + in_percent = (result[:used_for_average].to_f / (result[:total].to_f / 100)).round(1) result[:state] = if in_percent >= 90 'supergood' elsif in_percent >= 65 diff --git a/lib/tasks/zammad/package/uninstall.rb b/lib/tasks/zammad/package/uninstall.rb index 72f8f5130..ace41274c 100644 --- a/lib/tasks/zammad/package/uninstall.rb +++ b/lib/tasks/zammad/package/uninstall.rb @@ -19,7 +19,7 @@ module Tasks abort "Error: please provide a package name: #{ARGV[0]} MyPackage" end # Find the package so that we don't need to require the version from the command line. - package = ::Package.find_by( name: name ) + package = ::Package.find_by(name: name) if package.blank? abort "Error: package #{name} was not found." end diff --git a/lib/websocket_server.rb b/lib/websocket_server.rb index b6501ceb1..023d42c9d 100644 --- a/lib/websocket_server.rb +++ b/lib/websocket_server.rb @@ -10,7 +10,7 @@ class WebsocketServer Rails.configuration.interface = 'websocket' EventMachine.run do - EventMachine::WebSocket.start( host: @options[:b], port: @options[:p], secure: @options[:s], tls_options: @options[:tls_options] ) do |ws| + EventMachine::WebSocket.start(host: @options[:b], port: @options[:p], secure: @options[:s], tls_options: @options[:tls_options]) do |ws| # register client connection ws.onopen do |handshake| @@ -52,7 +52,7 @@ class WebsocketServer headers = handshake.headers client_id = websocket.object_id.to_s log 'info', 'Client connected.', client_id - Sessions.create( client_id, {}, { type: 'websocket' } ) + Sessions.create(client_id, {}, { type: 'websocket' }) return if @clients.include? client_id @@ -138,7 +138,7 @@ class WebsocketServer # close unused web socket sessions @clients.each do |client_id, client| - next if ( client[:last_ping].to_i + idle_time_in_sec ) >= Time.now.utc.to_i + next if (client[:last_ping].to_i + idle_time_in_sec) >= Time.now.utc.to_i log 'info', 'closing idle websocket connection', client_id diff --git a/spec/db/migrate/issue_2541_fix_notification_email_without_body_spec.rb b/spec/db/migrate/issue_2541_fix_notification_email_without_body_spec.rb index 766a7e75a..b08e87715 100644 --- a/spec/db/migrate/issue_2541_fix_notification_email_without_body_spec.rb +++ b/spec/db/migrate/issue_2541_fix_notification_email_without_body_spec.rb @@ -51,7 +51,7 @@ RSpec.describe Issue2541FixNotificationEmailWithoutBody, type: :db_migration do subject(:job) do UserInfo.ensure_current_user_id do - create(:job, condition: { 'ticket.owner_id' => { 'operator' => 'is', 'pre_condition' => 'current_user.id', 'value' => '', 'value_completion' => '' } } ) + create(:job, condition: { 'ticket.owner_id' => { 'operator' => 'is', 'pre_condition' => 'current_user.id', 'value' => '', 'value_completion' => '' } }) end end diff --git a/spec/factories/smime_certificate.rb b/spec/factories/smime_certificate.rb index 1d853bc05..b288a2389 100644 --- a/spec/factories/smime_certificate.rb +++ b/spec/factories/smime_certificate.rb @@ -9,11 +9,11 @@ FactoryBot.define do fixture { nil } end - public_key { File.read( Rails.root.join("spec/fixtures/smime/#{fixture}.crt") ) if fixture } + public_key { File.read(Rails.root.join("spec/fixtures/smime/#{fixture}.crt")) if fixture } trait :with_private do - private_key { File.read( Rails.root.join("spec/fixtures/smime/#{fixture}.key") ) } - private_key_secret { File.read( Rails.root.join("spec/fixtures/smime/#{fixture}.secret") ).strip! } + private_key { File.read(Rails.root.join("spec/fixtures/smime/#{fixture}.key")) } + private_key_secret { File.read(Rails.root.join("spec/fixtures/smime/#{fixture}.secret")).strip! } end end end diff --git a/spec/factories/user.rb b/spec/factories/user.rb index f42557c41..34a3201fe 100644 --- a/spec/factories/user.rb +++ b/spec/factories/user.rb @@ -33,7 +33,7 @@ FactoryBot.define do end factory :agent_and_customer do - role_ids { Role.signup_role_ids.push( Role.find_by(name: 'Agent').id ).sort } + role_ids { Role.signup_role_ids.push(Role.find_by(name: 'Agent').id).sort } trait :with_org do organization diff --git a/spec/jobs/communicate_twitter_job_spec.rb b/spec/jobs/communicate_twitter_job_spec.rb index ed8ad8657..f45be45a4 100644 --- a/spec/jobs/communicate_twitter_job_spec.rb +++ b/spec/jobs/communicate_twitter_job_spec.rb @@ -42,7 +42,7 @@ RSpec.describe CommunicateTwitterJob, type: :job, required_envs: %w[TWITTER_CONS expect(WebMock) .to have_requested(:post, 'https://api.twitter.com/1.1/statuses/update.json') - .with(body: "in_reply_to_status_id&status=#{CGI.escape(article.body)}" ) + .with(body: "in_reply_to_status_id&status=#{CGI.escape(article.body)}") end it 'updates the article with tweet attributes' do @@ -152,7 +152,7 @@ RSpec.describe CommunicateTwitterJob, type: :job, required_envs: %w[TWITTER_CONS expect(WebMock) .to have_requested(:post, 'https://api.twitter.com/1.1/statuses/update.json') - .with(body: "in_reply_to_status_id&status=#{CGI.escape(article.body)}" ) + .with(body: "in_reply_to_status_id&status=#{CGI.escape(article.body)}") end end end diff --git a/spec/jobs/trigger_webhook_job_spec.rb b/spec/jobs/trigger_webhook_job_spec.rb index 6cae48b29..7bddf3684 100644 --- a/spec/jobs/trigger_webhook_job_spec.rb +++ b/spec/jobs/trigger_webhook_job_spec.rb @@ -90,7 +90,7 @@ RSpec.describe TriggerWebhookJob, type: :job do context 'with trigger token configured' do it 'includes X-Hub-Signature header' do expect(WebMock).to have_requested(:post, endpoint) - .with( body: payload, headers: headers ) + .with(body: payload, headers: headers) .with { |req| req.headers['X-Zammad-Delivery'].is_a?(String) } .with { |req| req.headers['X-Hub-Signature'].is_a?(String) } end @@ -101,7 +101,7 @@ RSpec.describe TriggerWebhookJob, type: :job do it "doesn't include X-Hub-Signature header" do expect(WebMock).to have_requested(:post, endpoint) - .with( body: payload, headers: headers ) + .with(body: payload, headers: headers) .with { |req| req.headers['X-Zammad-Delivery'].is_a?(String) } .with { |req| !req.headers.key?('X-Hub-Signature') } end diff --git a/spec/lib/external_credential/google_spec.rb b/spec/lib/external_credential/google_spec.rb index 6ab7698b5..135dc52af 100644 --- a/spec/lib/external_credential/google_spec.rb +++ b/spec/lib/external_credential/google_spec.rb @@ -108,7 +108,7 @@ RSpec.describe ExternalCredential::Google do .to_return(status: 200, body: token_response_payload.to_json, headers: {}) stub_request(:get, alias_url).to_return(status: 200, body: alias_response_payload.to_json, headers: {}) - create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret } ) + create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret }) end it 'creates a Channel instance' do @@ -157,7 +157,7 @@ RSpec.describe ExternalCredential::Google do before do stub_request(:post, token_url).to_return(status: response_status, body: response_payload&.to_json, headers: {}) - create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret } ) + create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret }) end shared_examples 'failed attempt' do @@ -208,7 +208,7 @@ RSpec.describe ExternalCredential::Google do stub_request(:post, token_url).to_return(status: 200, body: token_response_payload.to_json, headers: {}) stub_request(:get, alias_url).to_return(status: 200, body: alias_response_payload.to_json, headers: {}) - create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret } ) + create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret }) channel = described_class.link_account(request_token, authorization_payload) # remove stubs and allow new stubbing for tested requests @@ -318,7 +318,7 @@ RSpec.describe ExternalCredential::Google do describe '.request_account_to_link' do it 'generates authorize_url from credentials' do - google = create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret } ) + google = create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret }) request = described_class.request_account_to_link(google.credentials) expect(request[:authorize_url]).to eq(authorize_url) diff --git a/spec/lib/external_credential/microsoft365_spec.rb b/spec/lib/external_credential/microsoft365_spec.rb index d07f06e81..d2c1df753 100644 --- a/spec/lib/external_credential/microsoft365_spec.rb +++ b/spec/lib/external_credential/microsoft365_spec.rb @@ -74,7 +74,7 @@ RSpec.describe ExternalCredential::Microsoft365 do .with(body: hash_including(request_payload)) .to_return(status: 200, body: token_response_payload.to_json, headers: {}) - create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret } ) + create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret }) end it 'creates a Channel instance' do @@ -122,7 +122,7 @@ RSpec.describe ExternalCredential::Microsoft365 do before do stub_request(:post, token_url).to_return(status: response_status, body: response_payload&.to_json, headers: {}) - create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret } ) + create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret }) end shared_examples 'failed attempt' do @@ -172,7 +172,7 @@ RSpec.describe ExternalCredential::Microsoft365 do let!(:channel) do stub_request(:post, token_url).to_return(status: 200, body: token_response_payload.to_json, headers: {}) - create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret } ) + create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret }) channel = described_class.link_account(request_token, authorization_payload) # remove stubs and allow new stubbing for tested requests @@ -282,7 +282,7 @@ RSpec.describe ExternalCredential::Microsoft365 do describe '.request_account_to_link' do it 'generates authorize_url from credentials' do - microsoft365 = create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret } ) + microsoft365 = create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret }) request = described_class.request_account_to_link(microsoft365.credentials) expect(request[:authorize_url]).to eq(authorize_url) diff --git a/spec/lib/import/helper_spec.rb b/spec/lib/import/helper_spec.rb index 4ccb3fc4c..390f7828e 100644 --- a/spec/lib/import/helper_spec.rb +++ b/spec/lib/import/helper_spec.rb @@ -11,7 +11,7 @@ RSpec.describe Import::Helper do it 'checks if import_mode is active' do allow(Setting).to receive(:get).with('import_mode').and_return(true) - expect( described_class.check_import_mode ).to be true + expect(described_class.check_import_mode).to be true end it 'throws an exception if import_mode is disabled' do @@ -26,7 +26,7 @@ RSpec.describe Import::Helper do it 'checks if system_init_done is active' do allow(Setting).to receive(:get).with('system_init_done').and_return(false) - expect( described_class.check_system_init_done ).to be true + expect(described_class.check_system_init_done).to be true end it 'throws an exception if system_init_done is disabled' do diff --git a/spec/lib/notification_factory/mailer_spec.rb b/spec/lib/notification_factory/mailer_spec.rb index 308cb4152..03b432ac9 100644 --- a/spec/lib/notification_factory/mailer_spec.rb +++ b/spec/lib/notification_factory/mailer_spec.rb @@ -106,7 +106,7 @@ RSpec.describe NotificationFactory::Mailer do let(:user) { create(:agent, email: 'somebody@example.com') } it 'returns a Mail::Message' do - expect( result ).to be_kind_of(Mail::Message) + expect(result).to be_kind_of(Mail::Message) end end diff --git a/spec/lib/report/ticket_generic_time_spec.rb b/spec/lib/report/ticket_generic_time_spec.rb index 01656fb91..20f2fc512 100644 --- a/spec/lib/report/ticket_generic_time_spec.rb +++ b/spec/lib/report/ticket_generic_time_spec.rb @@ -27,7 +27,7 @@ returns # Regression test for issue #2246 - Records in Reporting not updated when single ActiveRecord can not be found it 'correctly handles missing tickets' do - class_double('SearchIndexBackend', selectors: { ticket_ids: [-1] } ).as_stubbed_const + class_double('SearchIndexBackend', selectors: { ticket_ids: [-1] }).as_stubbed_const expect do described_class.items( diff --git a/spec/lib/secure_mailing/smime_spec.rb b/spec/lib/secure_mailing/smime_spec.rb index 5d57ad2c7..cb501469c 100644 --- a/spec/lib/secure_mailing/smime_spec.rb +++ b/spec/lib/secure_mailing/smime_spec.rb @@ -606,7 +606,7 @@ RSpec.describe SecureMailing::SMIME do end let!(:article) do - _ticket, article, _user, _mail = Channel::EmailParser.new.process({}, mail['raw'] ) + _ticket, article, _user, _mail = Channel::EmailParser.new.process({}, mail['raw']) article end diff --git a/spec/lib/sequencer/sequence/import/freshdesk/agent_spec.rb b/spec/lib/sequencer/sequence/import/freshdesk/agent_spec.rb index d7d4f08c3..a6d67963e 100644 --- a/spec/lib/sequencer/sequence/import/freshdesk/agent_spec.rb +++ b/spec/lib/sequencer/sequence/import/freshdesk/agent_spec.rb @@ -72,7 +72,7 @@ RSpec.describe ::Sequencer::Sequence::Import::Freshdesk::Agent, sequencer: :sequ end it 'sets user roles correctly for admin user' do - allow( Sequencer::Unit::Import::Freshdesk::Agent::Mapping).to receive(:admin_id).and_return(1001) + allow(Sequencer::Unit::Import::Freshdesk::Agent::Mapping).to receive(:admin_id).and_return(1001) process(process_payload) expect(User.last.roles.sort.map(&:name)).to eq %w[Admin Agent] end diff --git a/spec/lib/sequencer/sequence/import/freshdesk/ticket_field_spec.rb b/spec/lib/sequencer/sequence/import/freshdesk/ticket_field_spec.rb index 24c4da710..012977b88 100644 --- a/spec/lib/sequencer/sequence/import/freshdesk/ticket_field_spec.rb +++ b/spec/lib/sequencer/sequence/import/freshdesk/ticket_field_spec.rb @@ -157,7 +157,7 @@ RSpec.describe ::Sequencer::Sequence::Import::Freshdesk::TicketField, sequencer: it 'the custom field has type "tel"' do process(process_payload) - expect( ObjectManager::Attribute.find_by(name: 'cf_custom_phone_number').data_option ).to include( 'type' => 'tel' ) + expect(ObjectManager::Attribute.find_by(name: 'cf_custom_phone_number').data_option).to include('type' => 'tel') end end @@ -177,7 +177,7 @@ RSpec.describe ::Sequencer::Sequence::Import::Freshdesk::TicketField, sequencer: it 'the custom field has type "url"' do process(process_payload) - expect( ObjectManager::Attribute.find_by(name: 'cf_custom_url').data_option ).to include( 'type' => 'url' ) + expect(ObjectManager::Attribute.find_by(name: 'cf_custom_url').data_option).to include('type' => 'url') end end diff --git a/spec/models/channel/filter/follow_up_merged_spec.rb b/spec/models/channel/filter/follow_up_merged_spec.rb index 907bbcfd5..949d10d2c 100644 --- a/spec/models/channel/filter/follow_up_merged_spec.rb +++ b/spec/models/channel/filter/follow_up_merged_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Channel::Filter::FollowUpMerged, type: :channel_filter do ticket1 = create(:ticket) ticket2 = create(:ticket) - ticket1.merge_to( ticket_id: ticket2.id, user_id: 1 ) + ticket1.merge_to(ticket_id: ticket2.id, user_id: 1) mail = { 'x-zammad-ticket-id': ticket1.id @@ -26,8 +26,8 @@ RSpec.describe Channel::Filter::FollowUpMerged, type: :channel_filter do ticket2 = create(:ticket) ticket3 = create(:ticket) - ticket1.merge_to( ticket_id: ticket2.id, user_id: 1 ) - ticket2.merge_to( ticket_id: ticket3.id, user_id: 1 ) + ticket1.merge_to(ticket_id: ticket2.id, user_id: 1) + ticket2.merge_to(ticket_id: ticket3.id, user_id: 1) mail = { 'x-zammad-ticket-id': ticket1.id @@ -44,9 +44,9 @@ RSpec.describe Channel::Filter::FollowUpMerged, type: :channel_filter do ticket3 = create(:ticket) ticket4 = create(:ticket) - ticket1.merge_to( ticket_id: ticket2.id, user_id: 1 ) - ticket2.merge_to( ticket_id: ticket3.id, user_id: 1 ) - ticket3.merge_to( ticket_id: ticket4.id, user_id: 1 ) + ticket1.merge_to(ticket_id: ticket2.id, user_id: 1) + ticket2.merge_to(ticket_id: ticket3.id, user_id: 1) + ticket3.merge_to(ticket_id: ticket4.id, user_id: 1) mail = { 'x-zammad-ticket-id': ticket2.id diff --git a/spec/models/cti/driver/base_spec.rb b/spec/models/cti/driver/base_spec.rb index bccd4d94f..6816df560 100644 --- a/spec/models/cti/driver/base_spec.rb +++ b/spec/models/cti/driver/base_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' RSpec.describe Cti::Driver::Base do - subject!(:driver) { described_class.new(mapping: {}, params: params, config: config ) } + subject!(:driver) { described_class.new(mapping: {}, params: params, config: config) } let(:direction) { 'in' } let(:event) { 'newCall' } diff --git a/spec/models/session_spec.rb b/spec/models/session_spec.rb index e69a3bcb8..68a1c59d5 100644 --- a/spec/models/session_spec.rb +++ b/spec/models/session_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Session, type: :model do describe 'Check that session creation' do context 'without persistent flag in data payload' do - subject(:session) { described_class.create( session_id: SecureRandom.urlsafe_base64(64), data: {} ) } + subject(:session) { described_class.create(session_id: SecureRandom.urlsafe_base64(64), data: {}) } it 'does not set the persistent attribute' do expect(session.persistent).to be_nil @@ -14,7 +14,7 @@ RSpec.describe Session, type: :model do end context 'with true persistent flag in data payload' do - subject(:session) { described_class.create( session_id: SecureRandom.urlsafe_base64(64), data: { 'persistent' => true }) } + subject(:session) { described_class.create(session_id: SecureRandom.urlsafe_base64(64), data: { 'persistent' => true }) } it 'sets the persistent attribute in the session and removes the persistent attribute from the data payload' do expect(session.persistent).to eq(true) @@ -23,7 +23,7 @@ RSpec.describe Session, type: :model do end context 'with false persistent flag in data payload' do - subject(:session) { described_class.create( session_id: SecureRandom.urlsafe_base64(64), data: { 'persistent' => false }) } + subject(:session) { described_class.create(session_id: SecureRandom.urlsafe_base64(64), data: { 'persistent' => false }) } it 'does not set the persistent attribute' do expect(session.persistent).to be_nil diff --git a/spec/models/ticket/article/adds_metadata_general_spec.rb b/spec/models/ticket/article/adds_metadata_general_spec.rb index c5627466d..79b2c6d5f 100644 --- a/spec/models/ticket/article/adds_metadata_general_spec.rb +++ b/spec/models/ticket/article/adds_metadata_general_spec.rb @@ -7,7 +7,7 @@ RSpec.describe Ticket::Article::AddsMetadataGeneral do context 'when Agent creates Article' do shared_examples 'not including email in from' do |factory| - subject(:article) { create(:ticket_article, factory, ticket: ticket, created_by_id: agent.id, updated_by_id: agent.id ) } + subject(:article) { create(:ticket_article, factory, ticket: ticket, created_by_id: agent.id, updated_by_id: agent.id) } let(:ticket) { create(:ticket) } let!(:agent) { create(:agent, groups: [ticket.group]) } diff --git a/spec/models/ticket/article_spec.rb b/spec/models/ticket/article_spec.rb index 0bd810ecb..eaf6622fd 100644 --- a/spec/models/ticket/article_spec.rb +++ b/spec/models/ticket/article_spec.rb @@ -615,7 +615,7 @@ RSpec.describe Ticket::Article, type: :model do article_new = create(:ticket_article) UserInfo.current_user_id = 1 - attachments = article_parent.clone_attachments(article_new.class.name, article_new.id, only_inline_attachments: true ) + attachments = article_parent.clone_attachments(article_new.class.name, article_new.id, only_inline_attachments: true) expect(attachments.count).to eq(1) expect(attachments[0].filename).to eq('some_file1.jpg') diff --git a/spec/models/ticket_spec.rb b/spec/models/ticket_spec.rb index e9c07d111..be495245a 100644 --- a/spec/models/ticket_spec.rb +++ b/spec/models/ticket_spec.rb @@ -1250,13 +1250,13 @@ RSpec.describe Ticket, type: :model do shared_examples 'permitted' do it 'finds Ticket' do - expect( described_class.search(query: ticket.number, current_user: current_user).count ).to eq(1) + expect(described_class.search(query: ticket.number, current_user: current_user).count).to eq(1) end end shared_examples 'no permission' do it "doesn't find Ticket" do - expect( described_class.search(query: ticket.number, current_user: current_user) ).to be_blank + expect(described_class.search(query: ticket.number, current_user: current_user)).to be_blank end end diff --git a/spec/requests/external_credentials_spec.rb b/spec/requests/external_credentials_spec.rb index 8b3bd651b..4cb2a4ca5 100644 --- a/spec/requests/external_credentials_spec.rb +++ b/spec/requests/external_credentials_spec.rb @@ -293,7 +293,7 @@ RSpec.describe 'External Credentials', type: :request do expect(WebMock) .to have_requested(:post, "https://api.twitter.com/1.1/account_activity/all/#{env_name}/webhooks.json") - .with(body: "url=#{CGI.escape(webhook_url)}" ) + .with(body: "url=#{CGI.escape(webhook_url)}") end end @@ -374,7 +374,7 @@ RSpec.describe 'External Credentials', type: :request do expect(WebMock) .to have_requested(:post, 'https://api.twitter.com/oauth/request_token') - .with(headers: { 'Authorization' => %r{oauth_consumer_key="#{twitter_credential.credentials[:consumer_key]}"} } ) + .with(headers: { 'Authorization' => %r{oauth_consumer_key="#{twitter_credential.credentials[:consumer_key]}"} }) end it 'redirects to Twitter authorization URL' do diff --git a/spec/requests/integration/monitoring_spec.rb b/spec/requests/integration/monitoring_spec.rb index 6fb237151..989b257d8 100644 --- a/spec/requests/integration/monitoring_spec.rb +++ b/spec/requests/integration/monitoring_spec.rb @@ -612,7 +612,7 @@ RSpec.describe 'Monitoring', type: :request do expect(json_response['message']).to be_truthy expect(json_response['issues']).to be_truthy expect(json_response['healthy']).to eq(false) - expect( json_response['message']).to eq("Failed to run background job #1 'SearchIndexAssociationsJob' 1 time(s) with 1 attempt(s).") + expect(json_response['message']).to eq("Failed to run background job #1 'SearchIndexAssociationsJob' 1 time(s) with 1 attempt(s).") # add another job manual_added = SearchIndexJob.perform_later('Ticket', 1) @@ -626,7 +626,7 @@ RSpec.describe 'Monitoring', type: :request do expect(json_response['message']).to be_truthy expect(json_response['issues']).to be_truthy expect(json_response['healthy']).to eq(false) - expect( json_response['message']).to eq("Failed to run background job #1 'SearchIndexAssociationsJob' 1 time(s) with 1 attempt(s).;Failed to run background job #2 'SearchIndexJob' 1 time(s) with 10 attempt(s).") + expect(json_response['message']).to eq("Failed to run background job #1 'SearchIndexAssociationsJob' 1 time(s) with 1 attempt(s).;Failed to run background job #2 'SearchIndexJob' 1 time(s) with 10 attempt(s).") # add another job dummy_class = Class.new(ApplicationJob) do @@ -636,7 +636,7 @@ RSpec.describe 'Monitoring', type: :request do end end - manual_added = Delayed::Job.enqueue( dummy_class.new ) + manual_added = Delayed::Job.enqueue(dummy_class.new) manual_added.update!(attempts: 5) # health_check @@ -654,7 +654,7 @@ RSpec.describe 'Monitoring', type: :request do # add some more failing job 10.times do - manual_added = Delayed::Job.enqueue( dummy_class.new ) + manual_added = Delayed::Job.enqueue(dummy_class.new) manual_added.update!(attempts: 5) end diff --git a/spec/requests/long_polling_spec.rb b/spec/requests/long_polling_spec.rb index 5e3a11a1e..e8f202364 100644 --- a/spec/requests/long_polling_spec.rb +++ b/spec/requests/long_polling_spec.rb @@ -79,7 +79,7 @@ RSpec.describe 'LongPolling', type: :request do # here we use a token for the authentication because the basic auth way with username and password # will update the user by every request and return a different result for the test - authenticated_as(agent, token: create(:token, action: 'api', user_id: agent.id) ) + authenticated_as(agent, token: create(:token, action: 'api', user_id: agent.id)) get '/api/v1/message_send', params: { data: { event: 'login' } }, as: :json expect(response).to have_http_status(:ok) expect(json_response['client_id'].to_i).to be_between(1, 9_999_999_999) diff --git a/spec/requests/report_spec.rb b/spec/requests/report_spec.rb index 78a2f74ee..94cf3067d 100644 --- a/spec/requests/report_spec.rb +++ b/spec/requests/report_spec.rb @@ -54,7 +54,7 @@ RSpec.describe 'Report', type: :request, searchindex: true do create(:ticket, title: 'ticket for report #1', created_at: today.midday) create(:ticket, title: 'ticket for report #2', created_at: today.midday + 2.hours) create(:ticket, title: 'ticket for report #3', created_at: today.midday + 2.hours) - create(:ticket, title: 'ticket for report #4', created_at: today.midday + 10.hours, state: Ticket::State.lookup(name: 'closed') ) + create(:ticket, title: 'ticket for report #4', created_at: today.midday + 10.hours, state: Ticket::State.lookup(name: 'closed')) create(:ticket, title: 'ticket for report #5', created_at: today.midday + 11.hours) create(:ticket, title: 'ticket for report #6', created_at: today.midday - 11.hours) create(:ticket, title: 'ticket for report #7', created_at: Time.zone.parse('2019-02-28T23:30:00Z')) diff --git a/spec/requests/tag_spec.rb b/spec/requests/tag_spec.rb index 9595bf5ef..fbef423f6 100644 --- a/spec/requests/tag_spec.rb +++ b/spec/requests/tag_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Tag, type: :request do it "found 1 tag using search term '#{search_term}'" do get '/api/v1/tag_search', params: { term: search_term } expect(response).to have_http_status(:ok) - expect(json_response).to contain_exactly( 'id' => foobar_tag.id, 'value' => foobar_tag.name ) + expect(json_response).to contain_exactly('id' => foobar_tag.id, 'value' => foobar_tag.name) end end diff --git a/spec/requests/ticket/article_spec.rb b/spec/requests/ticket/article_spec.rb index 22e481f0d..547845ac1 100644 --- a/spec/requests/ticket/article_spec.rb +++ b/spec/requests/ticket/article_spec.rb @@ -530,25 +530,25 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO let(:article_communication) do create(:ticket_article, sender_name: 'Agent', type_name: 'email', ticket: ticket, - updated_by_id: agent.id, created_by_id: agent.id ) + updated_by_id: agent.id, created_by_id: agent.id) end let(:article_note_self) do create(:ticket_article, sender_name: 'Agent', internal: true, type_name: 'note', ticket: ticket, - updated_by_id: user.id, created_by_id: user.id ) + updated_by_id: user.id, created_by_id: user.id) end let(:article_note_other) do create(:ticket_article, sender_name: 'Agent', internal: true, type_name: 'note', ticket: ticket, - updated_by_id: other_agent.id, created_by_id: other_agent.id ) + updated_by_id: other_agent.id, created_by_id: other_agent.id) end let(:article_note_customer) do create(:ticket_article, sender_name: 'Customer', internal: false, type_name: 'note', ticket: ticket, - updated_by_id: customer.id, created_by_id: customer.id ) + updated_by_id: customer.id, created_by_id: customer.id) end let(:article_note_communication_self) do @@ -556,7 +556,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO create(:ticket_article, sender_name: 'Agent', internal: true, type_name: 'note_communication', ticket: ticket, - updated_by_id: user.id, created_by_id: user.id ) + updated_by_id: user.id, created_by_id: user.id) end let(:article_note_communication_other) do @@ -564,7 +564,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO create(:ticket_article, sender_name: 'Agent', internal: true, type_name: 'note_communication', ticket: ticket, - updated_by_id: other_agent.id, created_by_id: other_agent.id ) + updated_by_id: other_agent.id, created_by_id: other_agent.id) end def delete_article_via_rest(article) diff --git a/spec/requests/ticket/escalation_spec.rb b/spec/requests/ticket/escalation_spec.rb index b3c376990..da71adec5 100644 --- a/spec/requests/ticket/escalation_spec.rb +++ b/spec/requests/ticket/escalation_spec.rb @@ -7,7 +7,7 @@ RSpec.describe 'Ticket Escalation', type: :request do let(:sla_update) { 3.hours } let(:sla_close) { 4.hours } - let!(:mail_group) { create(:group, email_address: create(:email_address) ) } + let!(:mail_group) { create(:group, email_address: create(:email_address)) } let(:calendar) { create(:calendar, :'24/7') } let(:sla) do diff --git a/spec/requests/ticket_spec.rb b/spec/requests/ticket_spec.rb index 08d83e18b..778fed4e3 100644 --- a/spec/requests/ticket_spec.rb +++ b/spec/requests/ticket_spec.rb @@ -5,10 +5,10 @@ require 'rails_helper' RSpec.describe 'Ticket', type: :request do let!(:ticket_group) do - create(:group, email_address: create(:email_address) ) + create(:group, email_address: create(:email_address)) end let!(:ticket_group_without_create) do - create(:group, email_address: create(:email_address) ) + create(:group, email_address: create(:email_address)) end let(:admin) do create(:admin, groups: Group.all, firstname: 'Tickets', lastname: 'Admin') diff --git a/spec/requests/time_accounting_spec.rb b/spec/requests/time_accounting_spec.rb index 23aa301f9..db684397e 100644 --- a/spec/requests/time_accounting_spec.rb +++ b/spec/requests/time_accounting_spec.rb @@ -27,8 +27,8 @@ RSpec.describe 'Time Accounting API endpoints', type: :request do context 'when requesting a log report download' do it 'responds with an Excel spreadsheet' do create(:group) - ticket = create(:ticket, state: Ticket::State.lookup(name: 'open'), customer: customer ) - article = create(:ticket_article, ticket: ticket, type: Ticket::Article::Type.lookup(name: 'note') ) + ticket = create(:ticket, state: Ticket::State.lookup(name: 'open'), customer: customer) + article = create(:ticket_article, ticket: ticket, type: Ticket::Article::Type.lookup(name: 'note')) create(:ticket_time_accounting, ticket_id: ticket.id, ticket_article_id: article.id) @@ -49,8 +49,8 @@ RSpec.describe 'Time Accounting API endpoints', type: :request do ObjectManager::Attribute.add attributes_for :object_manager_attribute_select create(:group) - ticket = create(:ticket, state: Ticket::State.lookup(name: 'open'), customer: customer ) - article = create(:ticket_article, ticket: ticket, type: Ticket::Article::Type.lookup(name: 'note') ) + ticket = create(:ticket, state: Ticket::State.lookup(name: 'open'), customer: customer) + article = create(:ticket_article, ticket: ticket, type: Ticket::Article::Type.lookup(name: 'note')) create(:ticket_time_accounting, ticket_id: ticket.id, ticket_article_id: article.id) diff --git a/spec/requests/user_spec.rb b/spec/requests/user_spec.rb index efcd776e2..af925f855 100644 --- a/spec/requests/user_spec.rb +++ b/spec/requests/user_spec.rb @@ -1150,8 +1150,8 @@ RSpec.describe 'User', type: :request do end let(:successful_params) { { email: attributes_for(:admin)[:email] } } - let(:params_with_role) { successful_params.merge({ role_ids: [Role.find_by(name: 'Admin').id] } ) } - let(:params_with_invite) { successful_params.merge({ invite: true } ) } + let(:params_with_role) { successful_params.merge({ role_ids: [Role.find_by(name: 'Admin').id] }) } + let(:params_with_invite) { successful_params.merge({ invite: true }) } it 'succeeds' do make_request successful_params diff --git a/spec/support/vcr_mask_freshdesk_endpoint_auth.rb b/spec/support/vcr_mask_freshdesk_endpoint_auth.rb index e62f7916c..d139404bb 100644 --- a/spec/support/vcr_mask_freshdesk_endpoint_auth.rb +++ b/spec/support/vcr_mask_freshdesk_endpoint_auth.rb @@ -2,5 +2,5 @@ # The API key is used only inside the base64 encoded Basic Auth string, so mask that as well. VCR.configure do |c| - c.filter_sensitive_data('') { Base64.encode64( "#{ENV['IMPORT_FRESHDESK_ENDPOINT_KEY']}:X" ).chomp } + c.filter_sensitive_data('') { Base64.encode64("#{ENV['IMPORT_FRESHDESK_ENDPOINT_KEY']}:X").chomp } end diff --git a/spec/system/cti_spec.rb b/spec/system/cti_spec.rb index 465038fa2..ea2be15b3 100644 --- a/spec/system/cti_spec.rb +++ b/spec/system/cti_spec.rb @@ -36,7 +36,7 @@ RSpec.describe 'Caller log', type: %i[system request], authenticated_as: true do visit 'cti' post "#{Capybara.app_host}/api/v1/cti/token1234", params: params.merge(event: 'newCall'), as: :json - post "#{Capybara.app_host}/api/v1/cti/token1234", params: params.merge(event: 'answer', answeringNumber: '0190111' ), as: :json + post "#{Capybara.app_host}/api/v1/cti/token1234", params: params.merge(event: 'answer', answeringNumber: '0190111'), as: :json within(:active_content) do expect(page).to have_text('New Ticket', wait: 5) @@ -53,7 +53,7 @@ RSpec.describe 'Caller log', type: %i[system request], authenticated_as: true do visit 'cti' post "#{Capybara.app_host}/api/v1/cti/token1234", params: params.merge(event: 'newCall'), as: :json - post "#{Capybara.app_host}/api/v1/cti/token1234", params: params.merge(event: 'answer', answeringNumber: '0190111' ), as: :json + post "#{Capybara.app_host}/api/v1/cti/token1234", params: params.merge(event: 'answer', answeringNumber: '0190111'), as: :json within(:active_content) do expect(page).to have_text(customer.fullname, wait: 5) diff --git a/spec/system/profile_spec.rb b/spec/system/profile_spec.rb index 412eee83e..b4094acbf 100644 --- a/spec/system/profile_spec.rb +++ b/spec/system/profile_spec.rb @@ -13,7 +13,7 @@ RSpec.describe 'Profile', type: :system do context 'when user is an agent with no user_preferences permission', authenticated_as: :new_user do let(:role) { create(:role, permissions: [Permission.find_by(name: 'ticket.agent')]) } - let(:new_user) { create(:user, roles: [role] ) } + let(:new_user) { create(:user, roles: [role]) } it 'does not show profile link in navigation' do visit 'dashboard' diff --git a/spec/system/system/integration/smime_spec.rb b/spec/system/system/integration/smime_spec.rb index e5ee2e366..0d1ad99ce 100644 --- a/spec/system/system/integration/smime_spec.rb +++ b/spec/system/system/integration/smime_spec.rb @@ -40,10 +40,10 @@ RSpec.describe 'Manage > Integration > S/MIME', type: :system do expect(page).to have_css('td', text: 'Including private key') # check result - expect( Setting.get('smime_integration') ).to be true - expect( SMIMECertificate.last.fingerprint ).to be_present - expect( SMIMECertificate.last.raw ).to be_present - expect( SMIMECertificate.last.private_key ).to be_present + expect(Setting.get('smime_integration')).to be true + expect(SMIMECertificate.last.fingerprint).to be_present + expect(SMIMECertificate.last.raw).to be_present + expect(SMIMECertificate.last.private_key).to be_present end it 'adding of multiple certificates at once' do diff --git a/spec/system/ticket/zoom_spec.rb b/spec/system/ticket/zoom_spec.rb index 61e776517..eec68e6a4 100644 --- a/spec/system/ticket/zoom_spec.rb +++ b/spec/system/ticket/zoom_spec.rb @@ -991,8 +991,8 @@ RSpec.describe 'Ticket zoom', type: :system do end context 'as agent with full permissions' do - let(:current_user) { create(:agent, groups: [ group_users ] ) } - let(:ticket) { create(:ticket, group: group_users ) } + let(:current_user) { create(:agent, groups: [ group_users ]) } + let(:ticket) { create(:ticket, group: group_users) } include_examples 'shows attributes and values for agent view and editable' end @@ -1024,16 +1024,16 @@ RSpec.describe 'Ticket zoom', type: :system do end context 'as agent+customer with full permissions' do - let!(:current_user) { create(:agent_and_customer, groups: [ group_users ] ) } + let!(:current_user) { create(:agent_and_customer, groups: [ group_users ]) } context 'normal ticket' do - let(:ticket) { create(:ticket, group: group_users ) } + let(:ticket) { create(:ticket, group: group_users) } include_examples 'shows attributes and values for agent view and editable' end context 'ticket where current_user is also customer' do - let(:ticket) { create(:ticket, customer: current_user, group: group_users ) } + let(:ticket) { create(:ticket, customer: current_user, group: group_users) } include_examples 'shows attributes and values for agent view and editable' end diff --git a/test/browser/admin_object_manager_test.rb b/test/browser/admin_object_manager_test.rb index f98d7eaf2..fe5c636ab 100644 --- a/test/browser/admin_object_manager_test.rb +++ b/test/browser/admin_object_manager_test.rb @@ -818,13 +818,13 @@ class AdminObjectManagerTest < TestCase ticket_open_by_title(title: 'select') - click( css: '.content.active .tabsSidebar-tab[data-tab="organization"]' ) - click( css: '.content.active .sidebar[data-tab="organization"] .js-actions .dropdown-toggle' ) - click( css: '.content.active .sidebar[data-tab="organization"] .js-actions [data-type="organization-edit"]' ) + click(css: '.content.active .tabsSidebar-tab[data-tab="organization"]') + click(css: '.content.active .sidebar[data-tab="organization"] .js-actions .dropdown-toggle') + click(css: '.content.active .sidebar[data-tab="organization"] .js-actions [data-type="organization-edit"]') modal_ready select(css: '.content.active .modal select[name="bool_test"]', value: 'NO') - click( css: '.content.active .modal .js-submit' ) + click(css: '.content.active .modal .js-submit') modal_disappear watch_for( @@ -894,13 +894,13 @@ class AdminObjectManagerTest < TestCase ticket_open_by_title(title: 'select') - click( css: '.content.active .tabsSidebar-tab[data-tab="customer"]' ) - click( css: '.content.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle' ) - click( css: '.content.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]' ) + click(css: '.content.active .tabsSidebar-tab[data-tab="customer"]') + click(css: '.content.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle') + click(css: '.content.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]') modal_ready select(css: '.content.active .modal select[name="bool_test"]', value: 'NO') - click( css: '.content.active .modal .js-submit' ) + click(css: '.content.active .modal .js-submit') modal_disappear watch_for( diff --git a/test/browser/admin_overview_test.rb b/test/browser/admin_overview_test.rb index 17a8a3864..9b950b727 100644 --- a/test/browser/admin_overview_test.rb +++ b/test/browser/admin_overview_test.rb @@ -123,7 +123,7 @@ class AdminOverviewTest < TestCase def ordered_ticket_titles(ticket_titles) ticket_titles.map do |title| [title, - get_location( css: "td[title='#{title}']").y] + get_location(css: "td[title='#{title}']").y] end.sort_by { |x| x[1] }.map { |x| x[0] } end @@ -140,11 +140,11 @@ class AdminOverviewTest < TestCase out_of_office_css = '.content.active .modal select[name="out_of_office"]' first_overview_css = '.content.active tr[data-id="1"] td' - click( css: 'a[href="#manage"]' ) - click( css: '.content.active a[href="#manage/overviews"]' ) + click(css: 'a[href="#manage"]') + click(css: '.content.active a[href="#manage/overviews"]') # round 1, open the overview and set out_of_office to true - click( css: first_overview_css ) + click(css: first_overview_css) modal_ready watch_for( css: out_of_office_css, @@ -154,11 +154,11 @@ class AdminOverviewTest < TestCase css: out_of_office_css, value: 'yes', ) - click( css: '.content.active .modal .js-submit' ) + click(css: '.content.active .modal .js-submit') modal_disappear # round 2, open the overview and set out_of_office back to false - click( css: first_overview_css ) + click(css: first_overview_css) modal_ready watch_for( css: out_of_office_css, @@ -168,17 +168,17 @@ class AdminOverviewTest < TestCase css: out_of_office_css, value: 'no', ) - click( css: '.content.active .modal .js-submit' ) + click(css: '.content.active .modal .js-submit') modal_disappear # round 3, open the overview and confirm that it's still false - click( css: first_overview_css ) + click(css: first_overview_css) modal_ready watch_for( css: out_of_office_css, value: 'no', ) - click( css: '.content.active .modal .js-submit' ) + click(css: '.content.active .modal .js-submit') modal_disappear end end diff --git a/test/browser/agent_ticket_create_reset_customer_selection_test.rb b/test/browser/agent_ticket_create_reset_customer_selection_test.rb index 3a653d449..881214a5e 100644 --- a/test/browser/agent_ticket_create_reset_customer_selection_test.rb +++ b/test/browser/agent_ticket_create_reset_customer_selection_test.rb @@ -30,7 +30,7 @@ class AgentTicketCreateResetCustomerSelectionTest < TestCase click(css: '.content.active .newTicket [name="customer_id_completion"]') # check if pulldown is open, it's not working stable via selenium - @browser.execute_script( "$('.content.active .newTicket .js-recipientDropdown').addClass('open')" ) + @browser.execute_script("$('.content.active .newTicket .js-recipientDropdown').addClass('open')") set( css: '.content.active .newTicket input[name="customer_id_completion"]', @@ -110,7 +110,7 @@ class AgentTicketCreateResetCustomerSelectionTest < TestCase click(css: '.content.active .newTicket [name="customer_id_completion"]') # check if pulldown is open, it's not working stable via selenium - @browser.execute_script( "$('.content.active .newTicket .js-recipientDropdown').addClass('open')" ) + @browser.execute_script("$('.content.active .newTicket .js-recipientDropdown').addClass('open')") set( css: '.content.active .newTicket input[name="customer_id_completion"]', diff --git a/test/browser/agent_ticket_merge_test.rb b/test/browser/agent_ticket_merge_test.rb index d04fa5250..1870437f3 100644 --- a/test/browser/agent_ticket_merge_test.rb +++ b/test/browser/agent_ticket_merge_test.rb @@ -57,8 +57,8 @@ class AgentTicketMergeTest < TestCase ) # merge tickets - click( css: '.active div[data-tab="ticket"] .js-actions .icon-arrow-down' ) - click( css: '.active div[data-tab="ticket"] .js-actions [data-type="ticket-merge"]' ) + click(css: '.active div[data-tab="ticket"] .js-actions .icon-arrow-down') + click(css: '.active div[data-tab="ticket"] .js-actions [data-type="ticket-merge"]') modal_ready set( @@ -66,7 +66,7 @@ class AgentTicketMergeTest < TestCase value: ticket1[:number], ) - click( css: '.modal button[type="submit"]' ) + click(css: '.modal button[type="submit"]') # check if merged to ticket is shown now watch_for( @@ -111,15 +111,15 @@ class AgentTicketMergeTest < TestCase ) # merge tickets - click( css: '.active div[data-tab="ticket"] .js-actions .icon-arrow-down' ) - click( css: '.active div[data-tab="ticket"] .js-actions [data-type="ticket-merge"]' ) + click(css: '.active div[data-tab="ticket"] .js-actions .icon-arrow-down') + click(css: '.active div[data-tab="ticket"] .js-actions [data-type="ticket-merge"]') modal_ready set( css: '.modal input[name="target_ticket_number"]', value: ticket3[:number], ) - click( css: '.modal button[type="submit"]' ) + click(css: '.modal button[type="submit"]') # check if merged to ticket is shown now watch_for( diff --git a/test/browser/agent_ticket_task_changed_test.rb b/test/browser/agent_ticket_task_changed_test.rb index 6f29e1525..577a8af96 100644 --- a/test/browser/agent_ticket_task_changed_test.rb +++ b/test/browser/agent_ticket_task_changed_test.rb @@ -40,7 +40,7 @@ class AgentTicketTaskChangedTest < TestCase tasks_close_all sleep 0.5 - exists_not( css: '.modal') + exists_not(css: '.modal') object_manager_attribute_delete( data: { diff --git a/test/browser/chat_no_jquery_test.rb b/test/browser/chat_no_jquery_test.rb index 147767ff0..7d57bea54 100644 --- a/test/browser/chat_no_jquery_test.rb +++ b/test/browser/chat_no_jquery_test.rb @@ -785,7 +785,7 @@ class ChatNoJqueryTest < TestCase timeout: 150, ) - agent.find_elements( { css: '.active .chat-window .js-close' } ).each(&:click) + agent.find_elements({ css: '.active .chat-window .js-close' }).each(&:click) sleep 2 click( browser: customer, diff --git a/test/browser/chat_test.rb b/test/browser/chat_test.rb index 5bc7693ec..d5f24c278 100644 --- a/test/browser/chat_test.rb +++ b/test/browser/chat_test.rb @@ -785,7 +785,7 @@ class ChatTest < TestCase timeout: 150, ) - agent.find_elements( { css: '.active .chat-window .js-close' } ).each(&:click) + agent.find_elements({ css: '.active .chat-window .js-close' }).each(&:click) sleep 2 click( browser: customer, diff --git a/test/browser/setting_test.rb b/test/browser/setting_test.rb index 27abf1330..a04d3fccc 100644 --- a/test/browser/setting_test.rb +++ b/test/browser/setting_test.rb @@ -64,7 +64,7 @@ class SettingTest < TestCase css: '[data-name="auth_facebook_credentials"] input[name=app_secret]', value: 'secret_test1234äöüß', ) - click( css: '[data-name="auth_facebook_credentials"] button[type=submit]') + click(css: '[data-name="auth_facebook_credentials"] button[type=submit]') watch_for( css: '#notify', value: 'update successful', diff --git a/test/browser/switch_to_user_test.rb b/test/browser/switch_to_user_test.rb index 8646a8dc4..2cbe6e87a 100644 --- a/test/browser/switch_to_user_test.rb +++ b/test/browser/switch_to_user_test.rb @@ -21,7 +21,7 @@ class SwitchToUserTest < TestCase ) sleep 3 - @browser.action.move_to(@browser.find_elements({ css: '.content.active .table-overview tbody tr:first-child' } )[0]).release.perform + @browser.action.move_to(@browser.find_elements({ css: '.content.active .table-overview tbody tr:first-child' })[0]).release.perform sleep 0.5 click( diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index 9a54d203e..71fa11dd3 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -3248,7 +3248,7 @@ wait untill text in selector disabppears element.send_keys(data[:phone]) end if data[:active].present? - select(css: 'select[name="active"]', value: data[:active] ? 'active' : 'inactive' ) + select(css: 'select[name="active"]', value: data[:active] ? 'active' : 'inactive') end if data[:organization] diff --git a/test/integration/otrs_import_test.rb b/test/integration/otrs_import_test.rb index 24a36cf45..65ed38a6f 100644 --- a/test/integration/otrs_import_test.rb +++ b/test/integration/otrs_import_test.rb @@ -23,9 +23,9 @@ class OtrsImportTest < ActiveSupport::TestCase if ENV['IMPORT_OTRS_ENDPOINT'] =~ %r{^(http|https)://} http = $1 end - assert( Setting.get('system_id'), 'system_id' ) - assert_equal( http, Setting.get('http_type'), 'http_type' ) - assert_equal( 'Example Company', Setting.get('organization'), 'organization' ) + assert(Setting.get('system_id'), 'system_id') + assert_equal(http, Setting.get('http_type'), 'http_type') + assert_equal('Example Company', Setting.get('organization'), 'organization') end test 'check dynamic fields' do @@ -43,129 +43,129 @@ class OtrsImportTest < ActiveSupport::TestCase # check count of imported items test 'check counts' do - assert_equal( 603, Ticket.count, 'tickets' ) - assert_equal( 3182, Ticket::Article.count, 'ticket articles' ) - assert_equal( 274, Store.count, 'ticket article attachments' ) - assert_equal( 10, Ticket::State.count, 'ticket states' ) - assert_equal( 24, Group.count, 'groups' ) + assert_equal(603, Ticket.count, 'tickets') + assert_equal(3182, Ticket::Article.count, 'ticket articles') + assert_equal(274, Store.count, 'ticket article attachments') + assert_equal(10, Ticket::State.count, 'ticket states') + assert_equal(24, Group.count, 'groups') end # check imported users and permission test 'check users' do - role_admin = Role.where( name: 'Admin' ).first - role_agent = Role.where( name: 'Agent' ).first - role_customer = Role.where( name: 'Customer' ).first + role_admin = Role.where(name: 'Admin').first + role_agent = Role.where(name: 'Agent').first + role_customer = Role.where(name: 'Customer').first #role_report = Role.where( :name => 'Report' ).first user1 = User.find(2) - assert_equal( 'agent-1 firstname', user1.firstname ) - assert_equal( 'agent-1 lastname', user1.lastname ) - assert_equal( 'agent-1', user1.login ) - assert_equal( 'agent-1@example.com', user1.email ) - assert_equal( true, user1.active ) + assert_equal('agent-1 firstname', user1.firstname) + assert_equal('agent-1 lastname', user1.lastname) + assert_equal('agent-1', user1.login) + assert_equal('agent-1@example.com', user1.email) + assert_equal(true, user1.active) - assert( user1.roles.include?( role_agent ) ) - assert_not( user1.roles.include?( role_admin ) ) - assert_not( user1.roles.include?( role_customer ) ) + assert(user1.roles.include?(role_agent)) + assert_not(user1.roles.include?(role_admin)) + assert_not(user1.roles.include?(role_customer)) #assert_not( user1.roles.include?( role_report ) ) - group_dasa = Group.where( name: 'dasa' ).first - group_raw = Group.where( name: 'Raw' ).first + group_dasa = Group.where(name: 'dasa').first + group_raw = Group.where(name: 'Raw').first - assert_not( user1.groups_access('full').include?( group_dasa ) ) - assert( user1.groups_access('full').include?( group_raw ) ) + assert_not(user1.groups_access('full').include?(group_dasa)) + assert(user1.groups_access('full').include?(group_raw)) user2 = User.find(3) - assert_equal( 'agent-2 firstname äöüß', user2.firstname ) - assert_equal( 'agent-2 lastname äöüß', user2.lastname ) - assert_equal( 'agent-2', user2.login ) - assert_equal( 'agent-2@example.com', user2.email ) - assert_equal( true, user2.active ) + assert_equal('agent-2 firstname äöüß', user2.firstname) + assert_equal('agent-2 lastname äöüß', user2.lastname) + assert_equal('agent-2', user2.login) + assert_equal('agent-2@example.com', user2.email) + assert_equal(true, user2.active) - assert( user2.roles.include?( role_agent ) ) - assert( user2.roles.include?( role_admin ) ) - assert_not( user2.roles.include?( role_customer ) ) + assert(user2.roles.include?(role_agent)) + assert(user2.roles.include?(role_admin)) + assert_not(user2.roles.include?(role_customer)) #assert( user2.roles.include?( role_report ) ) - assert( user2.groups_access('full').include?( group_dasa ) ) - assert( user2.groups_access('full').include?( group_raw ) ) + assert(user2.groups_access('full').include?(group_dasa)) + assert(user2.groups_access('full').include?(group_raw)) user3 = User.find(7) - assert_equal( 'invalid', user3.firstname ) - assert_equal( 'invalid', user3.lastname ) - assert_equal( 'invalid', user3.login ) - assert_equal( 'invalid@example.com', user3.email ) - assert_equal( false, user3.active ) + assert_equal('invalid', user3.firstname) + assert_equal('invalid', user3.lastname) + assert_equal('invalid', user3.login) + assert_equal('invalid@example.com', user3.email) + assert_equal(false, user3.active) - assert( user3.roles.include?( role_agent ) ) - assert_not( user3.roles.include?( role_admin ) ) - assert_not( user3.roles.include?( role_customer ) ) + assert(user3.roles.include?(role_agent)) + assert_not(user3.roles.include?(role_admin)) + assert_not(user3.roles.include?(role_customer)) #assert( user3.roles.include?( role_report ) ) - assert_not( user3.groups_access('full').include?( group_dasa ) ) - assert_not( user3.groups_access('full').include?( group_raw ) ) + assert_not(user3.groups_access('full').include?(group_dasa)) + assert_not(user3.groups_access('full').include?(group_raw)) user4 = User.find(8) - assert_equal( 'invalid-temp', user4.firstname ) - assert_equal( 'invalid-temp', user4.lastname ) - assert_equal( 'invalid-temp', user4.login ) - assert_equal( 'invalid-temp@example.com', user4.email ) - assert_equal( false, user4.active ) + assert_equal('invalid-temp', user4.firstname) + assert_equal('invalid-temp', user4.lastname) + assert_equal('invalid-temp', user4.login) + assert_equal('invalid-temp@example.com', user4.email) + assert_equal(false, user4.active) - assert( user4.roles.include?( role_agent ) ) - assert_not( user4.roles.include?( role_admin ) ) - assert_not( user4.roles.include?( role_customer ) ) + assert(user4.roles.include?(role_agent)) + assert_not(user4.roles.include?(role_admin)) + assert_not(user4.roles.include?(role_customer)) #assert( user4.roles.include?( role_report ) ) - assert_not( user4.groups_access('full').include?( group_dasa ) ) - assert_not( user4.groups_access('full').include?( group_raw ) ) + assert_not(user4.groups_access('full').include?(group_dasa)) + assert_not(user4.groups_access('full').include?(group_raw)) end # check all synced states and state types test 'check ticket stats' do state = Ticket::State.find(1) - assert_equal( 'new', state.name ) - assert_equal( 'new', state.state_type.name ) + assert_equal('new', state.name) + assert_equal('new', state.state_type.name) state = Ticket::State.find(2) - assert_equal( 'closed successful', state.name ) - assert_equal( 'closed', state.state_type.name ) + assert_equal('closed successful', state.name) + assert_equal('closed', state.state_type.name) state = Ticket::State.find(6) - assert_equal( 'pending reminder', state.name ) - assert_equal( 'pending reminder', state.state_type.name ) + assert_equal('pending reminder', state.name) + assert_equal('pending reminder', state.state_type.name) end # check groups/queues test 'check groups' do group1 = Group.find(1) - assert_equal( 'Postmaster', group1.name ) - assert_equal( true, group1.active ) + assert_equal('Postmaster', group1.name) + assert_equal(true, group1.active) group2 = Group.find(19) - assert_equal( 'UnitTestQueue20668', group2.name ) - assert_equal( false, group2.active ) + assert_equal('UnitTestQueue20668', group2.name) + assert_equal(false, group2.active) end # check imported customers and organization relation test 'check customers / organizations' do - user1 = User.where( login: 'jn' ).first - assert_equal( 'Johannes', user1.firstname ) - assert_equal( 'Nickel', user1.lastname ) - assert_equal( 'jn', user1.login ) - assert_equal( 'jn@example.com', user1.email ) + user1 = User.where(login: 'jn').first + assert_equal('Johannes', user1.firstname) + assert_equal('Nickel', user1.lastname) + assert_equal('jn', user1.login) + assert_equal('jn@example.com', user1.email) organization1 = user1.organization - assert_equal( 'Znuny GmbH Berlin', organization1.name ) - assert_equal( 'äöüß', organization1.note ) + assert_equal('Znuny GmbH Berlin', organization1.name) + assert_equal('äöüß', organization1.note) - user2 = User.where( login: 'test90133' ).first - assert_equal( 'test90133', user2.firstname ) - assert_equal( 'test90133', user2.lastname ) - assert_equal( 'test90133', user2.login ) - assert_equal( 'qa4711@t-online.de', user2.email ) + user2 = User.where(login: 'test90133').first + assert_equal('test90133', user2.firstname) + assert_equal('test90133', user2.lastname) + assert_equal('test90133', user2.login) + assert_equal('qa4711@t-online.de', user2.email) organization2 = user2.organization - assert( organization2, nil ) + assert(organization2, nil) end # check imported tickets @@ -173,57 +173,57 @@ class OtrsImportTest < ActiveSupport::TestCase # ticket is open ticket = Ticket.find(728) - assert_equal( 'test #1', ticket.title ) - assert_equal( 'open', ticket.state.name ) - assert_equal( 'Misc', ticket.group.name ) - assert_equal( '4 high', ticket.priority.name ) - assert_equal( 'agent-2', ticket.owner.login ) - assert_equal( 'partner', ticket.customer.login ) - assert_equal( 'Partner der betreut', ticket.organization.name ) - assert_equal( Time.zone.parse('2014-11-20 22:33:41 +0000').gmtime.to_s, ticket.created_at.to_s ) - assert_nil( ticket.close_at ) + assert_equal('test #1', ticket.title) + assert_equal('open', ticket.state.name) + assert_equal('Misc', ticket.group.name) + assert_equal('4 high', ticket.priority.name) + assert_equal('agent-2', ticket.owner.login) + assert_equal('partner', ticket.customer.login) + assert_equal('Partner der betreut', ticket.organization.name) + assert_equal(Time.zone.parse('2014-11-20 22:33:41 +0000').gmtime.to_s, ticket.created_at.to_s) + assert_nil(ticket.close_at) # check history # - create entry # ticket is created with state closed ticket = Ticket.find(729) - assert_equal( 'test #2', ticket.title ) - assert_equal( 'closed successful', ticket.state.name ) - assert_equal( 'Raw', ticket.group.name ) - assert_equal( '3 normal', ticket.priority.name ) - assert_equal( 'agent-2', ticket.owner.login ) - assert_equal( 'jn2', ticket.customer.login ) - assert_equal( 'Znuny GmbH', ticket.organization.name ) - assert_equal( Time.zone.parse('2014-11-20 23:24:20 +0000').gmtime.to_s, ticket.created_at.to_s ) - assert_equal( Time.zone.parse('2014-11-20 23:24:20 +0000').gmtime.to_s, ticket.close_at.to_s ) + assert_equal('test #2', ticket.title) + assert_equal('closed successful', ticket.state.name) + assert_equal('Raw', ticket.group.name) + assert_equal('3 normal', ticket.priority.name) + assert_equal('agent-2', ticket.owner.login) + assert_equal('jn2', ticket.customer.login) + assert_equal('Znuny GmbH', ticket.organization.name) + assert_equal(Time.zone.parse('2014-11-20 23:24:20 +0000').gmtime.to_s, ticket.created_at.to_s) + assert_equal(Time.zone.parse('2014-11-20 23:24:20 +0000').gmtime.to_s, ticket.close_at.to_s) # check history # - create entry # ticket is created open and now closed ticket = Ticket.find(730) - assert_equal( 'test #3', ticket.title ) - assert_equal( 'closed successful', ticket.state.name ) - assert_equal( 'Postmaster', ticket.group.name ) - assert_equal( '3 normal', ticket.priority.name ) - assert_equal( 'agent-2', ticket.owner.login ) - assert_equal( 'betreuterkunde2', ticket.customer.login ) - assert_equal( 'Noch ein betreuter Kunde', ticket.organization.name ) - assert_equal( Time.zone.parse('2014-11-21 00:17:40 +0000').gmtime.to_s, ticket.created_at.to_s ) - assert_equal( Time.zone.parse('2014-11-21 00:21:08 +0000').gmtime.to_s, ticket.close_at.to_s ) + assert_equal('test #3', ticket.title) + assert_equal('closed successful', ticket.state.name) + assert_equal('Postmaster', ticket.group.name) + assert_equal('3 normal', ticket.priority.name) + assert_equal('agent-2', ticket.owner.login) + assert_equal('betreuterkunde2', ticket.customer.login) + assert_equal('Noch ein betreuter Kunde', ticket.organization.name) + assert_equal(Time.zone.parse('2014-11-21 00:17:40 +0000').gmtime.to_s, ticket.created_at.to_s) + assert_equal(Time.zone.parse('2014-11-21 00:21:08 +0000').gmtime.to_s, ticket.close_at.to_s) # ticket dynamic fields ticket = Ticket.find(591) - assert_equal( 'Some other smart subject!', ticket.title ) - assert_equal( '488', ticket.vertriebsweg ) - assert_equal( '["193"]', ticket.te_test ) # TODO: multiselect - assert_equal( '358', ticket.sugar_crm_remote_no ) - assert_equal( '69', ticket.sugar_crm_company_selected_no ) - assert_equal( '["382"]', ticket.sugar_crm_company_selection ) # TODO: multiselect - assert_equal( '310', ticket.topic_no ) - assert_equal( '495', ticket.open_exchange_ticket_number ) - assert_equal( '208', ticket.hostname ) + assert_equal('Some other smart subject!', ticket.title) + assert_equal('488', ticket.vertriebsweg) + assert_equal('["193"]', ticket.te_test) # TODO: multiselect + assert_equal('358', ticket.sugar_crm_remote_no) + assert_equal('69', ticket.sugar_crm_company_selected_no) + assert_equal('["382"]', ticket.sugar_crm_company_selection) # TODO: multiselect + assert_equal('310', ticket.topic_no) + assert_equal('495', ticket.open_exchange_ticket_number) + assert_equal('208', ticket.hostname) # check history # - create entry @@ -233,18 +233,18 @@ class OtrsImportTest < ActiveSupport::TestCase test 'check article attachments' do article = Ticket::Article.find(149) - assert_equal( 5, article.attachments.count ) + assert_equal(5, article.attachments.count) attachment = article.attachments.first - assert_equal( 'image/jpeg', attachment[:preferences]['Mime-Type'] ) - assert_equal( 'Cursor_und_Banners_and_Alerts_und_Paket-Verwaltung_-_Admin_-_otrs336_und_otrs336.jpg', attachment.filename ) + assert_equal('image/jpeg', attachment[:preferences]['Mime-Type']) + assert_equal('Cursor_und_Banners_and_Alerts_und_Paket-Verwaltung_-_Admin_-_otrs336_und_otrs336.jpg', attachment.filename) article = Ticket::Article.find(156) - assert_equal( 2, article.attachments.count ) + assert_equal(2, article.attachments.count) attachment = article.attachments.second - assert_equal( 'application/pdf; name="=?UTF-8?B?5ZSQ6K+X5LiJ55m+6aaWLnBkZg==?="', attachment[:preferences]['Mime-Type'] ) - assert_equal( '唐诗三百首.pdf', attachment.filename ) + assert_equal('application/pdf; name="=?UTF-8?B?5ZSQ6K+X5LiJ55m+6aaWLnBkZg==?="', attachment[:preferences]['Mime-Type']) + assert_equal('唐诗三百首.pdf', attachment.filename) end end diff --git a/test/integration/package_test.rb b/test/integration/package_test.rb index b29cab7bf..97ee7ae2e 100644 --- a/test/integration/package_test.rb +++ b/test/integration/package_test.rb @@ -366,12 +366,12 @@ class PackageTest < ActiveSupport::TestCase false end if test[:zpm] - File.delete(location ) + File.delete(location) end end if test[:verify] && test[:verify][:package] exists = Package.where(name: test[:verify][:package][:name], version: test[:verify][:package][:version]).first - assert(exists, "package '#{test[:verify][:package][:name]}' is not installed" ) + assert(exists, "package '#{test[:verify][:package][:name]}' is not installed") end next if !test[:verify] next if !test[:verify][:check_files] @@ -379,9 +379,9 @@ class PackageTest < ActiveSupport::TestCase test[:verify][:check_files].each do |item| exists = File.exist?(item[:location]) if item[:result] - assert(exists, "'#{item[:location]}' exists" ) + assert(exists, "'#{item[:location]}' exists") else - assert_not(exists, "'#{item[:location]}' doesn't exists" ) + assert_not(exists, "'#{item[:location]}' doesn't exists") end end end diff --git a/test/unit/model_test.rb b/test/unit/model_test.rb index 1d1a6184c..5b87af359 100644 --- a/test/unit/model_test.rb +++ b/test/unit/model_test.rb @@ -12,7 +12,7 @@ class ModelTest < ActiveSupport::TestCase updated_by_id: 1, created_by_id: 1, ) - assert_raises( ActiveRecord::RecordNotUnique ) do + assert_raises(ActiveRecord::RecordNotUnique) do Group.create_if_not_exists( name: 'model1-Create_If_Not_Exists', active: true, @@ -41,7 +41,7 @@ class ModelTest < ActiveSupport::TestCase updated_by_id: 1, created_by_id: 1, ) - assert_raises( ActiveRecord::RecordNotUnique ) do + assert_raises(ActiveRecord::RecordNotUnique) do Group.create_or_update( name: 'model1-Create_Or_Update', active: true, diff --git a/test/unit/object_cache_test.rb b/test/unit/object_cache_test.rb index 04c9a2a38..2d3bbf4e6 100644 --- a/test/unit/object_cache_test.rb +++ b/test/unit/object_cache_test.rb @@ -10,7 +10,7 @@ class ObjectCacheTest < ActiveSupport::TestCase created_by_id: 1, ) - roles = Role.where( name: %w[Agent Admin] ) + roles = Role.where(name: %w[Agent Admin]) groups = Group.all user1 = User.create_or_update( login: 'object_cache1@example.org', diff --git a/test/unit/object_create_update_with_ref_name_test.rb b/test/unit/object_create_update_with_ref_name_test.rb index 15becf164..49692e40d 100644 --- a/test/unit/object_create_update_with_ref_name_test.rb +++ b/test/unit/object_create_update_with_ref_name_test.rb @@ -63,7 +63,7 @@ class ObjectCreateUpdateWithRefNameTest < ActiveSupport::TestCase assert(org3.member_ids.sort.include?(user2.id)) assert_not_equal(org2.id, org3.id) - assert_raises( ActiveRecord::AssociationTypeMismatch ) do + assert_raises(ActiveRecord::AssociationTypeMismatch) do Organization.create_or_update_with_ref( name: 'some org update_with_ref member2', members: ['object_ref_name2@example.org'], diff --git a/test/unit/online_notifiaction_test.rb b/test/unit/online_notifiaction_test.rb index a7d5ac794..b5607a700 100644 --- a/test/unit/online_notifiaction_test.rb +++ b/test/unit/online_notifiaction_test.rb @@ -344,7 +344,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase owner_id: User.lookup(login: '-').id, title: 'Unit Test 4 (äöüß)!', state_id: Ticket::State.lookup(name: 'new').id, - priority_id: Ticket::Priority.lookup( name: '2 normal').id, + priority_id: Ticket::Priority.lookup(name: '2 normal').id, updated_by_id: @agent_user1.id, created_by_id: @agent_user1.id, ) diff --git a/test/unit/session_basic_test.rb b/test/unit/session_basic_test.rb index 26a54ab98..7fa50acee 100644 --- a/test/unit/session_basic_test.rb +++ b/test/unit/session_basic_test.rb @@ -114,7 +114,7 @@ class SessionBasicTest < ActiveSupport::TestCase # get as stream result1 = as_client1.push - assert( result1, 'check as agent1 - recall 3') + assert(result1, 'check as agent1 - recall 3') travel_back end diff --git a/test/unit/ticket_trigger_recursive_disabled_test.rb b/test/unit/ticket_trigger_recursive_disabled_test.rb index cf930608c..75120fc93 100644 --- a/test/unit/ticket_trigger_recursive_disabled_test.rb +++ b/test/unit/ticket_trigger_recursive_disabled_test.rb @@ -1504,7 +1504,7 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal(1, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) - ticket1.update!(customer: User.lookup(email: 'nicole.braun@zammad.org') ) + ticket1.update!(customer: User.lookup(email: 'nicole.braun@zammad.org')) UserInfo.current_user_id = agent.id Ticket::Article.create!( @@ -1617,7 +1617,7 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal(1, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) - ticket1.update!(customer: customer ) + ticket1.update!(customer: customer) UserInfo.current_user_id = agent.id Ticket::Article.create!( diff --git a/test/unit/ticket_trigger_test.rb b/test/unit/ticket_trigger_test.rb index 8709b6192..1c6f78fb8 100644 --- a/test/unit/ticket_trigger_test.rb +++ b/test/unit/ticket_trigger_test.rb @@ -1530,7 +1530,7 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal(1, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) - ticket1.update!(customer: User.lookup(email: 'nicole.braun@zammad.org') ) + ticket1.update!(customer: User.lookup(email: 'nicole.braun@zammad.org')) UserInfo.current_user_id = agent.id Ticket::Article.create!(