diff --git a/.rubocop.yml b/.rubocop.yml index e165f8234..8a8e392b8 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -139,6 +139,14 @@ Layout/EmptyLinesAroundModuleBody: Description: "Keeps track of empty lines around module bodies." Enabled: false +Layout/ExtraSpacing: + Description: 'Do not use unnecessary spacing.' + Enabled: true + Exclude: + - 'config/routes/**/*' + - 'db/migrate/20120101000001_create_base.rb' + - 'db/migrate/20120101000010_create_ticket.rb' + Style/MultilineBlockChain: Description: 'Avoid multi-line chains of blocks.' StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks' diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 77ea7405f..8fdc90e73 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -6,12 +6,6 @@ # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 163 -# Cop supports --auto-correct. -# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment. -Layout/ExtraSpacing: - Enabled: false - # Offense count: 8 # Configuration parameters: MaximumRangeSize. Lint/MissingCopEnableDirective: diff --git a/app/jobs/checks_kb_client_notification_job.rb b/app/jobs/checks_kb_client_notification_job.rb index 88f8963b6..0f1149d5c 100644 --- a/app/jobs/checks_kb_client_notification_job.rb +++ b/app/jobs/checks_kb_client_notification_job.rb @@ -53,9 +53,9 @@ class ChecksKbClientNotificationJob < ApplicationJob .sessions .map { |client_id| Sessions.get(client_id)&.dig(:user, 'id') } .compact - .map { |user_id| User.find_by(id: user_id) } + .map { |user_id| User.find_by(id: user_id) } .compact - .select { |user| user.permissions? "knowledge_base.#{permission_suffix}" } + .select { |user| user.permissions? "knowledge_base.#{permission_suffix}" } end def self.notify_later(object, event) diff --git a/app/jobs/ticket_article_communicate_email_job.rb b/app/jobs/ticket_article_communicate_email_job.rb index 64b1ad486..1453a9d6e 100644 --- a/app/jobs/ticket_article_communicate_email_job.rb +++ b/app/jobs/ticket_article_communicate_email_job.rb @@ -12,7 +12,7 @@ class TicketArticleCommunicateEmailJob < ApplicationJob subject_prefix_mode = record.preferences[:subtype] - subject = ticket.subject_build(record.subject, subject_prefix_mode) + subject = ticket.subject_build(record.subject, subject_prefix_mode) # set retry count record.preferences['delivery_retry'] ||= 0 diff --git a/app/models/application_model/can_creates_and_updates.rb b/app/models/application_model/can_creates_and_updates.rb index 34e7dd041..c04bac29c 100644 --- a/app/models/application_model/can_creates_and_updates.rb +++ b/app/models/application_model/can_creates_and_updates.rb @@ -163,7 +163,7 @@ returns # do lookup with == to handle case insensitive databases records = if Rails.application.config.db_case_sensitive - where('LOWER(email) = LOWER(?)', data[:email]) + where('LOWER(email) = LOWER(?)', data[:email]) else where(email: data[:email]) end diff --git a/app/models/application_model/can_lookup.rb b/app/models/application_model/can_lookup.rb index fba30306b..e5c41219e 100644 --- a/app/models/application_model/can_lookup.rb +++ b/app/models/application_model/can_lookup.rb @@ -48,8 +48,8 @@ returns def find_and_save_to_cache_by(attr) record = find_by(attr) - return nil if string_key?(attr.keys.first) && (record&.send(attr.keys.first) != attr.values.first) # enforce case-sensitivity on MySQL - return record if ActiveRecord::Base.connection.transaction_open? # rollbacks can invalidate cache entries + return nil if string_key?(attr.keys.first) && (record&.send(attr.keys.first) != attr.values.first) # enforce case-sensitivity on MySQL + return record if ActiveRecord::Base.connection.transaction_open? # rollbacks can invalidate cache entries cache_set(attr.values.first, record) record diff --git a/app/models/email_address.rb b/app/models/email_address.rb index 592a6db23..232fada0e 100644 --- a/app/models/email_address.rb +++ b/app/models/email_address.rb @@ -4,7 +4,7 @@ class EmailAddress < ApplicationModel include ChecksLatestChangeObserved include HasCollectionUpdate - has_many :groups, after_add: :cache_update, after_remove: :cache_update + has_many :groups, after_add: :cache_update, after_remove: :cache_update belongs_to :channel, optional: true validates :realname, presence: true validates :email, presence: true diff --git a/app/models/karma/activity.rb b/app/models/karma/activity.rb index 16a53bbce..997cb398e 100644 --- a/app/models/karma/activity.rb +++ b/app/models/karma/activity.rb @@ -2,5 +2,5 @@ class Karma::Activity < ApplicationModel self.table_name = 'karma_activities' - validates :name, presence: true + validates :name, presence: true end diff --git a/app/models/knowledge_base/answer.rb b/app/models/knowledge_base/answer.rb index 3574d8bb5..61b253232 100644 --- a/app/models/knowledge_base/answer.rb +++ b/app/models/knowledge_base/answer.rb @@ -10,7 +10,7 @@ class KnowledgeBase::Answer < ApplicationModel AGENT_ALLOWED_ATTRIBUTES = %i[category_id promoted internal_note].freeze AGENT_ALLOWED_NESTED_RELATIONS = %i[translations].freeze - belongs_to :category, class_name: 'KnowledgeBase::Category', inverse_of: :answers, touch: true + belongs_to :category, class_name: 'KnowledgeBase::Category', inverse_of: :answers, touch: true scope :include_contents, -> { eager_load(translations: :content) } scope :sorted, -> { order(position: :asc) } diff --git a/app/models/knowledge_base/answer/translation.rb b/app/models/knowledge_base/answer/translation.rb index f829121b2..1733ca140 100644 --- a/app/models/knowledge_base/answer/translation.rb +++ b/app/models/knowledge_base/answer/translation.rb @@ -16,7 +16,7 @@ class KnowledgeBase::Answer::Translation < ApplicationModel belongs_to :content, class_name: 'KnowledgeBase::Answer::Translation::Content', inverse_of: :translation, dependent: :destroy accepts_nested_attributes_for :content, update_only: true - validates :title, presence: true, length: { maximum: 250 } + validates :title, presence: true, length: { maximum: 250 } validates :content, presence: true validates :kb_locale_id, uniqueness: { scope: :answer_id } diff --git a/app/models/knowledge_base/category/translation.rb b/app/models/knowledge_base/category/translation.rb index b52e9d076..8ca1b05ab 100644 --- a/app/models/knowledge_base/category/translation.rb +++ b/app/models/knowledge_base/category/translation.rb @@ -7,7 +7,7 @@ class KnowledgeBase::Category::Translation < ApplicationModel AGENT_ALLOWED_ATTRIBUTES = %i[title kb_locale_id].freeze - belongs_to :kb_locale, class_name: 'KnowledgeBase::Locale', inverse_of: :category_translations + belongs_to :kb_locale, class_name: 'KnowledgeBase::Locale', inverse_of: :category_translations validates :kb_locale, presence: true belongs_to :category, class_name: 'KnowledgeBase::Category', inverse_of: :translations, touch: true diff --git a/app/models/knowledge_base/locale.rb b/app/models/knowledge_base/locale.rb index efc8b2a71..cd3d77f00 100644 --- a/app/models/knowledge_base/locale.rb +++ b/app/models/knowledge_base/locale.rb @@ -50,5 +50,5 @@ class KnowledgeBase::Locale < ApplicationModel knowledge_base.kb_locales.find_by(primary: true) end - scope :available_for, ->(object) { where(id: object.translations.select(:kb_locale_id)) } + scope :available_for, ->(object) { where(id: object.translations.select(:kb_locale_id)) } end diff --git a/app/models/object_manager/attribute.rb b/app/models/object_manager/attribute.rb index 25f6f88c3..1b25cf6e6 100644 --- a/app/models/object_manager/attribute.rb +++ b/app/models/object_manager/attribute.rb @@ -932,7 +932,7 @@ is certain attribute used by triggers, overviews or schedulers # fixes issue #2236 - Naming an attribute "attribute" causes ActiveRecord failure begin ObjectLookup.by_id(object_lookup_id).constantize.instance_method_already_implemented? name - rescue ActiveRecord::DangerousAttributeError + rescue ActiveRecord::DangerousAttributeError errors.add(:name, "#{name} is a reserved word! (2)") end diff --git a/app/models/report/profile.rb b/app/models/report/profile.rb index a5770ccf7..b6b34479a 100644 --- a/app/models/report/profile.rb +++ b/app/models/report/profile.rb @@ -1,6 +1,6 @@ class Report::Profile < ApplicationModel self.table_name = 'report_profiles' - validates :name, presence: true + validates :name, presence: true store :condition def self.list diff --git a/app/models/role.rb b/app/models/role.rb index 240c639ae..015acdeac 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -17,7 +17,7 @@ class Role < ApplicationModel after_add: :cache_update, before_remove: :last_admin_check_by_permission, after_remove: :cache_update - validates :name, presence: true + validates :name, presence: true store :preferences before_create :check_default_at_signup_permissions diff --git a/app/models/setting.rb b/app/models/setting.rb index 514baa02b..ca18f9a07 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -176,7 +176,7 @@ reload config settings # convert state into hash to be able to store it as store def state_check - return true if state.nil? # allow false value + return true if state.nil? # allow false value return true if state.try(:key?, :value) self.state_current = { value: state } diff --git a/app/models/translation.rb b/app/models/translation.rb index 26560b79e..41b665fc4 100644 --- a/app/models/translation.rb +++ b/app/models/translation.rb @@ -405,7 +405,7 @@ Get source file at https://i18n.zammad.com/api/v1/translations_empty_translation col_sep: ',', } rows = ::CSV.parse(content, params) - rows.shift # remove header + rows.shift # remove header translation_raw = [] rows.each do |row| diff --git a/config.ru b/config.ru index 710f6ee39..0523eadaf 100644 --- a/config.ru +++ b/config.ru @@ -1,6 +1,6 @@ # This file is used by Rack-based servers to start the application. -require ::File.expand_path('../config/environment', __FILE__) +require ::File.expand_path('../config/environment', __FILE__) run Zammad::Application # set config to do no self notification diff --git a/db/migrate/20120101000010_create_ticket.rb b/db/migrate/20120101000010_create_ticket.rb index 694a4a27d..6c27ae1fc 100644 --- a/db/migrate/20120101000010_create_ticket.rb +++ b/db/migrate/20120101000010_create_ticket.rb @@ -79,7 +79,7 @@ class CreateTicket < ActiveRecord::Migration[4.2] t.column :pending_time, :timestamp, limit: 3, null: true t.column :type, :string, limit: 100, null: true t.column :time_unit, :decimal, precision: 6, scale: 2, null: true - t.column :preferences, :text, limit: 500.kilobytes + 1, null: true + t.column :preferences, :text, limit: 500.kilobytes + 1, null: true t.column :updated_by_id, :integer, null: false t.column :created_by_id, :integer, null: false t.timestamps limit: 3, null: false @@ -185,8 +185,8 @@ class CreateTicket < ActiveRecord::Migration[4.2] t.column :content_type, :string, limit: 20, null: false, default: 'text/plain' t.column :references, :string, limit: 3200, null: true t.column :body, :text, limit: 20.megabytes + 1, null: false - t.column :internal, :boolean, null: false, default: false - t.column :preferences, :text, limit: 500.kilobytes + 1, null: true + t.column :internal, :boolean, null: false, default: false + t.column :preferences, :text, limit: 500.kilobytes + 1, null: true t.column :updated_by_id, :integer, null: false t.column :created_by_id, :integer, null: false t.column :origin_by_id, :integer @@ -212,7 +212,7 @@ class CreateTicket < ActiveRecord::Migration[4.2] t.column :key, :string, limit: 50, null: false t.column :value, :string, limit: 50, null: true t.column :created_by_id, :integer, null: false - t.timestamps limit: 3, null: false + t.timestamps limit: 3, null: false end add_index :ticket_article_flags, %i[ticket_article_id created_by_id], name: 'index_ticket_article_flags_on_articles_id_and_created_by_id' add_index :ticket_article_flags, %i[ticket_article_id key] @@ -252,7 +252,7 @@ class CreateTicket < ActiveRecord::Migration[4.2] t.column :group_direction, :string, limit: 250, null: true t.column :organization_shared, :boolean, null: false, default: false t.column :out_of_office, :boolean, null: false, default: false - t.column :view, :string, limit: 1000, null: false + t.column :view, :string, limit: 1000, null: false t.column :active, :boolean, null: false, default: true t.column :updated_by_id, :integer, null: false t.column :created_by_id, :integer, null: false @@ -290,7 +290,7 @@ class CreateTicket < ActiveRecord::Migration[4.2] add_foreign_key :overviews_groups, :groups create_table :triggers do |t| - t.column :name, :string, limit: 250, null: false + t.column :name, :string, limit: 250, null: false t.column :condition, :text, limit: 500.kilobytes + 1, null: false t.column :perform, :text, limit: 500.kilobytes + 1, null: false t.column :disable_notification, :boolean, null: false, default: true @@ -349,7 +349,7 @@ class CreateTicket < ActiveRecord::Migration[4.2] t.column :active, :boolean, null: false, default: true t.timestamps limit: 3, null: false end - add_index :link_objects, [:name], unique: true + add_index :link_objects, [:name], unique: true create_table :links do |t| t.references :link_type, null: false @@ -462,11 +462,11 @@ class CreateTicket < ActiveRecord::Migration[4.2] add_foreign_key :slas, :users, column: :updated_by_id create_table :macros do |t| - t.string :name, limit: 250, null: true + t.string :name, limit: 250, null: true t.text :perform, limit: 500.kilobytes + 1, null: false t.boolean :active, null: false, default: true t.string :ux_flow_next_up, null: false, default: 'none' - t.string :note, limit: 250, null: true + t.string :note, limit: 250, null: true t.integer :updated_by_id, null: false t.integer :created_by_id, null: false t.timestamps limit: 3, null: false @@ -476,9 +476,9 @@ class CreateTicket < ActiveRecord::Migration[4.2] add_foreign_key :macros, :users, column: :updated_by_id create_table :chats do |t| - t.string :name, limit: 250, null: true - t.integer :max_queue, null: false, default: 5 - t.string :note, limit: 250, null: true + t.string :name, limit: 250, null: true + t.integer :max_queue, null: false, default: 5 + t.string :note, limit: 250, null: true t.boolean :active, null: false, default: true t.boolean :public, null: false, default: false t.string :block_ip, limit: 5000, null: true @@ -511,7 +511,7 @@ class CreateTicket < ActiveRecord::Migration[4.2] t.string :name, limit: 250, null: true t.string :state, limit: 50, null: false, default: 'waiting' # running, closed t.references :user, null: true - t.text :preferences, limit: 100.kilobytes + 1, null: true + t.text :preferences, limit: 100.kilobytes + 1, null: true t.integer :updated_by_id, null: true t.integer :created_by_id, null: true t.timestamps limit: 3, null: false @@ -526,9 +526,9 @@ class CreateTicket < ActiveRecord::Migration[4.2] add_foreign_key :chat_sessions, :users, column: :updated_by_id create_table :chat_messages do |t| - t.references :chat_session, null: false - t.text :content, limit: 20.megabytes + 1, null: false - t.integer :created_by_id, null: true + t.references :chat_session, null: false + t.text :content, limit: 20.megabytes + 1, null: false + t.integer :created_by_id, null: true t.timestamps limit: 3, null: false end add_index :chat_messages, [:chat_session_id] @@ -549,7 +549,7 @@ class CreateTicket < ActiveRecord::Migration[4.2] add_foreign_key :chat_agents, :users, column: :updated_by_id create_table :report_profiles do |t| - t.column :name, :string, limit: 150, null: true + t.column :name, :string, limit: 150, null: true t.column :condition, :text, limit: 500.kilobytes + 1, null: true t.column :active, :boolean, null: false, default: true t.column :updated_by_id, :integer, null: false @@ -563,7 +563,7 @@ class CreateTicket < ActiveRecord::Migration[4.2] create_table :karma_users do |t| t.references :user, null: false t.integer :score, null: false - t.string :level, limit: 200, null: false + t.string :level, limit: 200, null: false t.timestamps limit: 3, null: false end add_index :karma_users, [:user_id], unique: true diff --git a/db/migrate/20161101131409_create_doorkeeper_tables.rb b/db/migrate/20161101131409_create_doorkeeper_tables.rb index 2eee8558d..bfdcc37d7 100644 --- a/db/migrate/20161101131409_create_doorkeeper_tables.rb +++ b/db/migrate/20161101131409_create_doorkeeper_tables.rb @@ -39,12 +39,12 @@ class CreateDoorkeeperTables < ActiveRecord::Migration[4.2] # https://github.com/doorkeeper-gem/doorkeeper/tree/v3.0.0.rc1#custom-access-token-generator # # t.text :token, null: false - t.string :token, null: false + t.string :token, null: false t.string :refresh_token t.integer :expires_in t.datetime :revoked_at - t.datetime :created_at, null: false + t.datetime :created_at, null: false t.string :scopes # If there is a previous_refresh_token column, diff --git a/db/migrate/20170608151442_enhanced_permissions.rb b/db/migrate/20170608151442_enhanced_permissions.rb index 4547c607b..b47a1daeb 100644 --- a/db/migrate/20170608151442_enhanced_permissions.rb +++ b/db/migrate/20170608151442_enhanced_permissions.rb @@ -14,7 +14,7 @@ class EnhancedPermissions < ActiveRecord::Migration[4.2] create_table :roles_groups, id: false do |t| t.references :role, null: false t.references :group, null: false - t.string :access, limit: 50, null: false, default: 'full' + t.string :access, limit: 50, null: false, default: 'full' end add_index :roles_groups, [:role_id] add_index :roles_groups, [:group_id] diff --git a/db/migrate/20190418000000_normalize_setting_ticket_number_ignore_system_id.rb b/db/migrate/20190418000000_normalize_setting_ticket_number_ignore_system_id.rb index a739c0c37..85c805422 100644 --- a/db/migrate/20190418000000_normalize_setting_ticket_number_ignore_system_id.rb +++ b/db/migrate/20190418000000_normalize_setting_ticket_number_ignore_system_id.rb @@ -3,7 +3,7 @@ class NormalizeSettingTicketNumberIgnoreSystemId < ActiveRecord::Migration[5.1] return if !Setting.find_by(name: 'system_init_done') return if !Setting.exists?(name: 'ticket_number_ignore_system_id') - Setting.find_by(name: 'ticket_number_ignore_system_id') + Setting.find_by(name: 'ticket_number_ignore_system_id') .update(state_initial: { value: false }) return if Setting.get('ticket_number_ignore_system_id') != { 'ticket_number_ignore_system_id' => false } diff --git a/db/migrate/20190531180304_initialize_knowledge_base.rb b/db/migrate/20190531180304_initialize_knowledge_base.rb index 70ad68a54..d0b6bd26d 100644 --- a/db/migrate/20190531180304_initialize_knowledge_base.rb +++ b/db/migrate/20190531180304_initialize_knowledge_base.rb @@ -48,7 +48,7 @@ class InitializeKnowledgeBase < ActiveRecord::Migration[5.0] end create_table :knowledge_base_category_translations do |t| - t.string :title, limit: 250, null: false + t.string :title, limit: 250, null: false t.references :kb_locale, null: false, foreign_key: { to_table: :knowledge_base_locales } t.references :category, null: false, foreign_key: { to_table: :knowledge_base_categories, on_delete: :cascade } @@ -78,7 +78,7 @@ class InitializeKnowledgeBase < ActiveRecord::Migration[5.0] end create_table :knowledge_base_answer_translations do |t| - t.string :title, limit: 250, null: false + t.string :title, limit: 250, null: false t.references :kb_locale, null: false, foreign_key: { to_table: :knowledge_base_locales } t.references :answer, null: false, foreign_key: { to_table: :knowledge_base_answers, on_delete: :cascade } diff --git a/db/migrate/20200121000001_smime_support.rb b/db/migrate/20200121000001_smime_support.rb index 1c68fee4c..a2a427b57 100644 --- a/db/migrate/20200121000001_smime_support.rb +++ b/db/migrate/20200121000001_smime_support.rb @@ -63,7 +63,7 @@ class SMIMESupport < ActiveRecord::Migration[5.2] t.datetime :not_after_at, null: true t.binary :raw, limit: 10.megabytes, null: false t.binary :private_key, limit: 10.megabytes, null: true - t.string :private_key_secret, limit: 500, null: true + t.string :private_key_secret, limit: 500, null: true t.timestamps limit: 3, null: false end add_index :smime_certificates, [:fingerprint], unique: true diff --git a/lib/can_be_published/state_machine.rb b/lib/can_be_published/state_machine.rb index 1f6a101fa..cb6811003 100644 --- a/lib/can_be_published/state_machine.rb +++ b/lib/can_be_published/state_machine.rb @@ -53,7 +53,7 @@ module CanBePublished end aasm do - state :draft, initial: true + state :draft, initial: true state :internal state :published state :archived diff --git a/lib/signature_detection.rb b/lib/signature_detection.rb index 1ce20ab24..1421af25c 100644 --- a/lib/signature_detection.rb +++ b/lib/signature_detection.rb @@ -20,7 +20,7 @@ returns =end def self.find_signature(messages) - signature_candidates = Hash.new(0) # : + signature_candidates = Hash.new(0) # : messages = messages.map { |m| m[:content_type].match?(%r{text/html}i) ? m[:content].html2text(true) : m[:content] } message_pairs = messages.each_cons(2).to_a diffs = message_pairs.map { |msg_pair| Diffy::Diff.new(*msg_pair).to_s } diff --git a/lib/static_assets.rb b/lib/static_assets.rb index 1f694ef58..fce2405b0 100644 --- a/lib/static_assets.rb +++ b/lib/static_assets.rb @@ -126,7 +126,7 @@ returns end # store hash in config - return if !list || !list[0] + return if !list || !list[0] file = Store.find(list[0].id) filelocation = filename(file) diff --git a/lib/telegram.rb b/lib/telegram.rb index 4ca7cd2cd..4221ab045 100644 --- a/lib/telegram.rb +++ b/lib/telegram.rb @@ -324,7 +324,7 @@ returns # find ticket or create one state_ids = Ticket::State.where(name: %w[closed merged removed]).pluck(:id) possible_tickets = Ticket.where(customer_id: user.id).where.not(state_id: state_ids).order(:updated_at) - ticket = possible_tickets.find_each.find { |possible_ticket| possible_ticket.preferences[:channel_id] == channel.id } + ticket = possible_tickets.find_each.find { |possible_ticket| possible_ticket.preferences[:channel_id] == channel.id } if ticket # check if title need to be updated @@ -732,7 +732,7 @@ returns # get the last ticket of customer which is not closed yet, and close it state_ids = Ticket::State.where(name: %w[closed merged removed]).pluck(:id) possible_tickets = Ticket.where(customer_id: user.id).where.not(state_id: state_ids).order(:updated_at) - ticket = possible_tickets.find_each.find { |possible_ticket| possible_ticket.preferences[:channel_id] == channel.id } + ticket = possible_tickets.find_each.find { |possible_ticket| possible_ticket.preferences[:channel_id] == channel.id } return if !ticket diff --git a/lib/zammad/application/initializer/db_preflight_check/postgresql.rb b/lib/zammad/application/initializer/db_preflight_check/postgresql.rb index dd8d02d75..da21ec4ce 100644 --- a/lib/zammad/application/initializer/db_preflight_check/postgresql.rb +++ b/lib/zammad/application/initializer/db_preflight_check/postgresql.rb @@ -22,7 +22,7 @@ module Zammad end def self.check_version_compatibility - return if connection.nil? # Edge case: if Postgres can't find a DB to connect to + return if connection.nil? # Edge case: if Postgres can't find a DB to connect to super end diff --git a/lib/zammad/application/initializer/session_store.rb b/lib/zammad/application/initializer/session_store.rb index eb7b1f877..e7f3d5dad 100644 --- a/lib/zammad/application/initializer/session_store.rb +++ b/lib/zammad/application/initializer/session_store.rb @@ -6,8 +6,8 @@ module Zammad class Application class Initializer module SessionStore - STORE_TYPE = :active_record_store # default: :cookie_store - SESSION_KEY = ('_zammad_session_' + Digest::MD5.hexdigest(Rails.root.to_s)[5..15]).freeze # default: '_zammad_session' + STORE_TYPE = :active_record_store # default: :cookie_store + SESSION_KEY = ('_zammad_session_' + Digest::MD5.hexdigest(Rails.root.to_s)[5..15]).freeze # default: '_zammad_session' def self.perform Rails.application.config.session_store STORE_TYPE, diff --git a/script/rails b/script/rails index f653fc8de..3c234a25d 100755 --- a/script/rails +++ b/script/rails @@ -1,6 +1,6 @@ #!/usr/bin/env ruby # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. -APP_PATH = File.expand_path('../config/application', __dir__) -require File.expand_path('../config/boot', __dir__) +APP_PATH = File.expand_path('../config/application', __dir__) +require File.expand_path('../config/boot', __dir__) require 'rails/commands' diff --git a/spec/factories/job.rb b/spec/factories/job.rb index a9ece77c2..f05675d35 100644 --- a/spec/factories/job.rb +++ b/spec/factories/job.rb @@ -1,6 +1,6 @@ FactoryBot.define do factory :job do - sequence(:name) { |n| "Test job #{n}" } + sequence(:name) { |n| "Test job #{n}" } condition { { 'ticket.state_id' => { 'operator' => 'is not', 'value' => 4 } } } perform { { 'ticket.state_id' => { 'value' => 4 } } } active { true } diff --git a/spec/factories/postmaster_filter.rb b/spec/factories/postmaster_filter.rb index 6bb15f77f..fcff6f548 100644 --- a/spec/factories/postmaster_filter.rb +++ b/spec/factories/postmaster_filter.rb @@ -1,6 +1,6 @@ FactoryBot.define do factory :postmaster_filter do - sequence(:name) { |n| "Test PostmasterFilter #{n}" } + sequence(:name) { |n| "Test PostmasterFilter #{n}" } channel { 'email' } match { { 'from' => { 'operator' => 'contains', 'value' => 'a' } } } perform { { 'x-zammad-ticket-tags' => { 'operator' => 'remove', 'value' => 'test2, test7' } } } diff --git a/spec/factories/text_module.rb b/spec/factories/text_module.rb index 88d47afec..75dfcb29b 100644 --- a/spec/factories/text_module.rb +++ b/spec/factories/text_module.rb @@ -1,7 +1,7 @@ FactoryBot.define do factory :text_module do name { 'text module ' + Faker::Number.unique.number(3) } - keywords { Faker::Superhero.prefix } + keywords { Faker::Superhero.prefix } content { Faker::Lorem.sentence } updated_by_id { 1 } created_by_id { 1 } diff --git a/spec/factories/ticket.rb b/spec/factories/ticket.rb index 7a1dc754f..b28e6d32f 100644 --- a/spec/factories/ticket.rb +++ b/spec/factories/ticket.rb @@ -5,7 +5,7 @@ FactoryBot.define do priority_name { '2 normal' } end - association :group, strategy: :create # or else build(:ticket).save fails + association :group, strategy: :create # or else build(:ticket).save fails customer title { 'Test Ticket' } diff --git a/spec/factories/ticket/article.rb b/spec/factories/ticket/article.rb index 7e732803b..796dc3fcc 100644 --- a/spec/factories/ticket/article.rb +++ b/spec/factories/ticket/article.rb @@ -5,7 +5,7 @@ FactoryBot.define do sender_name { 'Customer' } end - association :ticket, strategy: :create # or else build(:ticket_article).save fails + association :ticket, strategy: :create # or else build(:ticket_article).save fails from { 'factory-customer-1@example.com' } to { 'factory-customer-1@example.com' } subject { 'factory article' } @@ -28,7 +28,7 @@ FactoryBot.define do sender_name { 'Agent' } trait :reply do - in_reply_to { Faker::Number.number(19) } + in_reply_to { Faker::Number.number(19) } end end diff --git a/spec/lib/notification_factory/mailer_spec.rb b/spec/lib/notification_factory/mailer_spec.rb index 93efbe1ee..c4b060463 100644 --- a/spec/lib/notification_factory/mailer_spec.rb +++ b/spec/lib/notification_factory/mailer_spec.rb @@ -6,7 +6,7 @@ RSpec.describe NotificationFactory::Mailer do context 'for postmaster oversized mail' do let(:raw_incoming_mail) { File.read(Rails.root.join('test/data/mail/mail010.box')) } - let(:parsed_incoming_mail) { Channel::EmailParser.new.parse raw_incoming_mail } + let(:parsed_incoming_mail) { Channel::EmailParser.new.parse raw_incoming_mail } let(:incoming_mail) do mail = OpenStruct.new diff --git a/spec/lib/sessions/backend/base_spec.rb b/spec/lib/sessions/backend/base_spec.rb index 337e5ad88..fcc4b8ab5 100644 --- a/spec/lib/sessions/backend/base_spec.rb +++ b/spec/lib/sessions/backend/base_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Sessions::Backend::Base do let(:agent) { create(:agent) } let(:client_id) { '123-1' } - let(:ttl) { 3 } # seconds + let(:ttl) { 3 } # seconds let!(:ticket) { Ticket.first || create(:ticket) } describe '#asset_needed?' do diff --git a/spec/lib/sessions/backend/ticket_overview_list_spec.rb b/spec/lib/sessions/backend/ticket_overview_list_spec.rb index 1ce186d02..c66e2da80 100644 --- a/spec/lib/sessions/backend/ticket_overview_list_spec.rb +++ b/spec/lib/sessions/backend/ticket_overview_list_spec.rb @@ -15,7 +15,7 @@ RSpec.describe Sessions::Backend::TicketOverviewList do let(:admin) { create(:admin, groups: [group]) } let(:group) { create(:group) } let(:client_id) { '12345' } - let(:ttl) { 3 } # seconds + let(:ttl) { 3 } # seconds context 'when 3rd argument ("client") is false' do subject(:collection) { described_class.new(admin, {}, false, client_id, ttl) } diff --git a/spec/models/application_model/can_lookup_examples.rb b/spec/models/application_model/can_lookup_examples.rb index 912341956..6b6a433f5 100644 --- a/spec/models/application_model/can_lookup_examples.rb +++ b/spec/models/application_model/can_lookup_examples.rb @@ -38,7 +38,7 @@ RSpec.shared_examples 'ApplicationModel::CanLookup' do end describe "cache storage by #{attribute}" do - context 'inside a DB transaction' do # provided by default RSpec config + context 'inside a DB transaction' do # provided by default RSpec config it 'leaves the cache untouched' do expect { described_class.lookup(attribute => instance.send(attribute)) } .not_to change { described_class.cache_get(instance.send(attribute)) } diff --git a/spec/models/calendar_spec.rb b/spec/models/calendar_spec.rb index 74e80056a..0563d31b0 100644 --- a/spec/models/calendar_spec.rb +++ b/spec/models/calendar_spec.rb @@ -108,7 +108,7 @@ RSpec.describe Calendar, type: :model do end it 'does not create a background job for escalation rebuild' do - calendar # create and sync (1 inital background job is created) + calendar # create and sync (1 inital background job is created) expect { calendar.sync } # a second sync right after calendar create .to not_change { Delayed::Job.count } end diff --git a/spec/models/channel/driver/twitter_spec.rb b/spec/models/channel/driver/twitter_spec.rb index 407f98438..b7e4e0054 100644 --- a/spec/models/channel/driver/twitter_spec.rb +++ b/spec/models/channel/driver/twitter_spec.rb @@ -921,7 +921,7 @@ RSpec.describe Channel::Driver::Twitter do tweet_ids.each { |tweet_id| create(:ticket_article, message_id: tweet_id) } end - let(:tweet_ids) { [1222126386334388225, 1222109934923460608] } # rubocop:disable Style/NumericLiterals + let(:tweet_ids) { [1222126386334388225, 1222109934923460608] } # rubocop:disable Style/NumericLiterals it 'does not import duplicates' do expect { channel.fetch }.not_to change(Ticket::Article, :count) @@ -970,7 +970,7 @@ RSpec.describe Channel::Driver::Twitter do # Run BG job (Why not use Scheduler.worker? # It led to hangs & failures elsewhere in test suite.) Thread.new do - sleep 5 # simulate other bg jobs holding up the queue + sleep 5 # simulate other bg jobs holding up the queue twitter_job.invoke_job end.tap { example.run }.join end diff --git a/spec/models/channel/email_parser_spec.rb b/spec/models/channel/email_parser_spec.rb index 25faec8df..2fb0efb4c 100644 --- a/spec/models/channel/email_parser_spec.rb +++ b/spec/models/channel/email_parser_spec.rb @@ -42,9 +42,9 @@ RSpec.describe Channel::EmailParser, type: :model do end describe '#process' do - let(:raw_mail) { File.read(mail_file) } + let(:raw_mail) { File.read(mail_file) } - before { Trigger.destroy_all } # triggers may cause additional articles to be created + before { Trigger.destroy_all } # triggers may cause additional articles to be created describe 'auto-creating new users' do context 'with one unrecognized email address' do diff --git a/spec/models/concerns/has_history_examples.rb b/spec/models/concerns/has_history_examples.rb index a0eaf2382..e0bafe75f 100644 --- a/spec/models/concerns/has_history_examples.rb +++ b/spec/models/concerns/has_history_examples.rb @@ -91,7 +91,7 @@ RSpec.shared_examples 'HasHistory' do |history_relation_object: nil| describe 'of #owner' do let(:attribute) { 'owner' } - let(:new_value) { create(:customer) } # Ticket#owner is restricted to active agents of the same group + let(:new_value) { create(:customer) } # Ticket#owner is restricted to active agents of the same group include_examples 'failed attribute update' if described_class.attribute_names.include?('owner_id') end diff --git a/spec/models/cti/caller_id_spec.rb b/spec/models/cti/caller_id_spec.rb index cbb69eb66..2c4845290 100644 --- a/spec/models/cti/caller_id_spec.rb +++ b/spec/models/cti/caller_id_spec.rb @@ -150,7 +150,7 @@ RSpec.describe Cti::CallerId do context 'and no corresponding CallerId exists' do it 'generates a CallerId record (with #level "known")' do - described_class.destroy_all # CallerId already generated in User callback + described_class.destroy_all # CallerId already generated in User callback expect { described_class.rebuild } .to change { described_class.exists?(user_id: user.id, caller_id: '49123456', level: 'known') } @@ -176,7 +176,7 @@ RSpec.describe Cti::CallerId do let!(:users) { create_list(:agent, 2, phone: '+49 123 456') } it 'generates two corresponding CallerId records (with #level "known")' do - described_class.destroy_all # CallerId already generated in User callback + described_class.destroy_all # CallerId already generated in User callback expect { described_class.rebuild } .to change { described_class.exists?(user_id: users.first.id, caller_id: '49123456', level: 'known') } @@ -196,7 +196,7 @@ RSpec.describe Cti::CallerId do let(:sender_name) { 'Customer' } it 'generates a CallerId record (with #level "maybe")' do - described_class.destroy_all # CallerId already generated in Article observer job + described_class.destroy_all # CallerId already generated in Article observer job expect { described_class.rebuild } .to change { described_class.exists?(user_id: article.created_by_id, caller_id: '49123456', level: 'maybe') } diff --git a/spec/models/history_spec.rb b/spec/models/history_spec.rb index 0f60f3189..03a892434 100644 --- a/spec/models/history_spec.rb +++ b/spec/models/history_spec.rb @@ -29,7 +29,7 @@ RSpec.describe History, type: :model do expect(list).to match_array( [ hash_including( - 'o_id' => object.id, + 'o_id' => object.id, ), hash_including( 'o_id' => object.id, @@ -95,7 +95,7 @@ RSpec.describe History, type: :model do context 'with "related_history_object" argument' do let!(:object) { related_object.ticket } - let!(:related_object) { create(:ticket_article, internal: true) } # MUST be internal, or else callbacks will create additional histories + let!(:related_object) { create(:ticket_article, internal: true) } # MUST be internal, or else callbacks will create additional histories before { object.update(title: 'Lorem ipsum dolor') } diff --git a/spec/models/job_spec.rb b/spec/models/job_spec.rb index 8d3384cc7..36437e284 100644 --- a/spec/models/job_spec.rb +++ b/spec/models/job_spec.rb @@ -177,7 +177,7 @@ RSpec.describe Job, type: :model do end it 'updates #next_run_at' do - travel_to(Time.current.last_week) # force new value for #next_run_at + travel_to(Time.current.last_week) # force new value for #next_run_at expect { job.run }.to change { job.reload.next_run_at } end @@ -194,7 +194,7 @@ RSpec.describe Job, type: :model do end it 'updates #next_run_at' do - travel_to(Time.current.last_week) # force new value for #next_run_at + travel_to(Time.current.last_week) # force new value for #next_run_at expect { job.run }.to change { job.reload.next_run_at } end diff --git a/spec/models/recent_view_spec.rb b/spec/models/recent_view_spec.rb index 107fa13d0..b1cff3e4d 100644 --- a/spec/models/recent_view_spec.rb +++ b/spec/models/recent_view_spec.rb @@ -145,7 +145,7 @@ RSpec.describe RecentView, type: :model do let(:owner) { agent } it 'does not create RecentView for records the given user cannot read' do - ticket.update(owner: User.first, # read access may come from ticket ownership, + ticket.update(owner: User.first, # read access may come from ticket ownership, customer: User.first, # customer status, organization: nil) # organization's 'shared' status, agent.update(groups: []) # and membership in the Ticket's group diff --git a/spec/models/role_spec.rb b/spec/models/role_spec.rb index 3a5a92dcc..fe87e8b88 100644 --- a/spec/models/role_spec.rb +++ b/spec/models/role_spec.rb @@ -125,7 +125,7 @@ RSpec.describe Role do context 'when reactivating a role adds new agents' do subject(:role) { create(:agent_role, active: false) } - before { create(:user, roles: [role]) } + before { create(:user, roles: [role]) } context 'exceeding the system limit' do before { Setting.set('system_agent_limit', agents.count) } diff --git a/spec/models/ticket/number_spec.rb b/spec/models/ticket/number_spec.rb index 7c28108f1..9800fe4ad 100644 --- a/spec/models/ticket/number_spec.rb +++ b/spec/models/ticket/number_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' RSpec.describe Ticket::Number do let(:stubbed_subclass) { double('Foo') } - before { stub_const('Ticket::Number::Foo', stubbed_subclass) } + before { stub_const('Ticket::Number::Foo', stubbed_subclass) } describe '.generate' do before { Setting.set('ticket_number', 'Ticket::Number::Foo') } diff --git a/spec/models/ticket_spec.rb b/spec/models/ticket_spec.rb index 44b205cb2..cdda2a371 100644 --- a/spec/models/ticket_spec.rb +++ b/spec/models/ticket_spec.rb @@ -520,7 +520,7 @@ RSpec.describe Ticket, type: :model do end describe '#escalation_at' do - before { travel_to(Time.current) } # freeze time + before { travel_to(Time.current) } # freeze time let(:sla) { create(:sla, calendar: calendar, first_response_time: 60, update_time: 180, solution_time: 240) } let(:calendar) { create(:calendar, :'24/7') } @@ -532,7 +532,7 @@ RSpec.describe Ticket, type: :model do end context 'with an SLA in the system' do - before { sla } # create sla + before { sla } # create sla it 'is set based on SLA’s #first_response_time' do expect(ticket.reload.escalation_at.to_i) @@ -540,12 +540,12 @@ RSpec.describe Ticket, type: :model do end context 'after first agent’s response' do - before { ticket } # create ticket + before { ticket } # create ticket let(:article) { create(:ticket_article, ticket: ticket, sender_name: 'Agent') } it 'is updated based on the SLA’s #update_time' do - travel(1.minute) # time is frozen: if we don't travel forward, pre- and post-update values will be the same + travel(1.minute) # time is frozen: if we don't travel forward, pre- and post-update values will be the same expect { article } .to change { ticket.reload.escalation_at.to_i } @@ -554,7 +554,7 @@ RSpec.describe Ticket, type: :model do context 'when new #update_time is later than original #solution_time' do it 'is updated based on the original #solution_time' do - travel(2.hours) # time is frozen: if we don't travel forward, pre- and post-update values will be the same + travel(2.hours) # time is frozen: if we don't travel forward, pre- and post-update values will be the same expect { article } .to change { ticket.reload.escalation_at.to_i } @@ -591,7 +591,7 @@ RSpec.describe Ticket, type: :model do end describe '#first_response_escalation_at' do - before { travel_to(Time.current) } # freeze time + before { travel_to(Time.current) } # freeze time let(:sla) { create(:sla, calendar: calendar, first_response_time: 60, update_time: 180, solution_time: 240) } let(:calendar) { create(:calendar, :'24/7') } @@ -603,7 +603,7 @@ RSpec.describe Ticket, type: :model do end context 'with an SLA in the system' do - before { sla } # create sla + before { sla } # create sla it 'is set based on SLA’s #first_response_time' do expect(ticket.reload.first_response_escalation_at.to_i) @@ -611,7 +611,7 @@ RSpec.describe Ticket, type: :model do end context 'after first agent’s response' do - before { ticket } # create ticket + before { ticket } # create ticket let(:article) { create(:ticket_article, ticket: ticket, sender_name: 'Agent') } @@ -623,7 +623,7 @@ RSpec.describe Ticket, type: :model do end describe '#update_escalation_at' do - before { travel_to(Time.current) } # freeze time + before { travel_to(Time.current) } # freeze time let(:sla) { create(:sla, calendar: calendar, first_response_time: 60, update_time: 180, solution_time: 240) } let(:calendar) { create(:calendar, :'24/7') } @@ -635,7 +635,7 @@ RSpec.describe Ticket, type: :model do end context 'with an SLA in the system' do - before { sla } # create sla + before { sla } # create sla it 'is set based on SLA’s #update_time' do expect(ticket.reload.update_escalation_at.to_i) @@ -643,12 +643,12 @@ RSpec.describe Ticket, type: :model do end context 'after first agent’s response' do - before { ticket } # create ticket + before { ticket } # create ticket let(:article) { create(:ticket_article, ticket: ticket, sender_name: 'Agent') } it 'is updated based on the SLA’s #update_time' do - travel(1.minute) # time is frozen: if we don't travel forward, pre- and post-update values will be the same + travel(1.minute) # time is frozen: if we don't travel forward, pre- and post-update values will be the same expect { article } .to change { ticket.reload.update_escalation_at.to_i } @@ -659,7 +659,7 @@ RSpec.describe Ticket, type: :model do end describe '#close_escalation_at' do - before { travel_to(Time.current) } # freeze time + before { travel_to(Time.current) } # freeze time let(:sla) { create(:sla, calendar: calendar, first_response_time: 60, update_time: 180, solution_time: 240) } let(:calendar) { create(:calendar, :'24/7') } @@ -671,7 +671,7 @@ RSpec.describe Ticket, type: :model do end context 'with an SLA in the system' do - before { sla } # create sla + before { sla } # create sla it 'is set based on SLA’s #solution_time' do expect(ticket.reload.close_escalation_at.to_i) @@ -679,7 +679,7 @@ RSpec.describe Ticket, type: :model do end context 'after first agent’s response' do - before { ticket } # create ticket + before { ticket } # create ticket let(:article) { create(:ticket_article, ticket: ticket, sender_name: 'Agent') } @@ -878,7 +878,7 @@ RSpec.describe Ticket, type: :model do context 'and subsequently destroyed' do it 'deletes all related attachments' do - ticket # create ticket + ticket # create ticket expect { ticket.destroy } .to change(Store, :count).by(-2) @@ -888,7 +888,7 @@ RSpec.describe Ticket, type: :model do end context 'and a duplicate ticket is generated from the same email' do - before { ticket } # create ticket + before { ticket } # create ticket let(:duplicate) { Channel::EmailParser.new.process({}, raw_email).first } @@ -901,7 +901,7 @@ RSpec.describe Ticket, type: :model do context 'when only the duplicate ticket is destroyed' do it 'deletes only the duplicate attachments' do - duplicate # create ticket + duplicate # create ticket expect { duplicate.destroy } .to change(Store, :count).by(-2) diff --git a/spec/models/trigger_spec.rb b/spec/models/trigger_spec.rb index bfb57a834..9a4d822c5 100644 --- a/spec/models/trigger_spec.rb +++ b/spec/models/trigger_spec.rb @@ -37,8 +37,8 @@ RSpec.describe Trigger, type: :model do describe 'Send-email triggers' do before do - described_class.destroy_all # Default DB state includes three sample triggers - trigger # create subject trigger + described_class.destroy_all # Default DB state includes three sample triggers + trigger # create subject trigger end let(:perform) do @@ -396,7 +396,7 @@ RSpec.describe Trigger, type: :model do context 'when new article is created directly' do context 'with empty #preferences hash' do - let!(:article) { create(:ticket_article, ticket: ticket) } + let!(:article) { create(:ticket_article, ticket: ticket) } it 'fires (without altering ticket state)' do expect { Observer::Transaction.commit } diff --git a/spec/policies/controllers/knowledge_base/categories_controller_policy_spec.rb b/spec/policies/controllers/knowledge_base/categories_controller_policy_spec.rb index 4fefda951..61aa9ee9f 100644 --- a/spec/policies/controllers/knowledge_base/categories_controller_policy_spec.rb +++ b/spec/policies/controllers/knowledge_base/categories_controller_policy_spec.rb @@ -17,7 +17,7 @@ describe Controllers::KnowledgeBase::CategoriesControllerPolicy do describe '#show?' do let(:action_name) { :show } - let(:params) { { id: internal_answer.category.id } } + let(:params) { { id: internal_answer.category.id } } context 'with knowledge_base.reader permissions' do let(:user) { create(:agent) } diff --git a/spec/requests/integration/smime_spec.rb b/spec/requests/integration/smime_spec.rb index a61e70b31..42d077281 100644 --- a/spec/requests/integration/smime_spec.rb +++ b/spec/requests/integration/smime_spec.rb @@ -35,7 +35,7 @@ RSpec.describe 'Integration SMIME', type: :request do it 'adds certificate by file' do expect do - post endpoint, params: { file: Rack::Test::UploadedFile.new(certificate_path, 'text/plain', true) } + post endpoint, params: { file: Rack::Test::UploadedFile.new(certificate_path, 'text/plain', true) } end.to change(SMIMECertificate, :count).by(1) expect(response).to have_http_status(:ok) diff --git a/spec/requests/ticket/article_spec.rb b/spec/requests/ticket/article_spec.rb index f88fd2e96..65730f2ce 100644 --- a/spec/requests/ticket/article_spec.rb +++ b/spec/requests/ticket/article_spec.rb @@ -488,19 +488,19 @@ 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) do create(:ticket_article, sender_name: 'Agent', internal: true, type_name: 'note', 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_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) do @@ -508,7 +508,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO create(:ticket_article, sender_name: 'Agent', internal: true, type_name: 'note_communication', ticket: ticket, - updated_by_id: agent.id, created_by_id: agent.id ) + updated_by_id: agent.id, created_by_id: agent.id ) end def delete_article_via_rest(article) diff --git a/spec/requests/ticket_spec.rb b/spec/requests/ticket_spec.rb index c5fce702c..18fc8931d 100644 --- a/spec/requests/ticket_spec.rb +++ b/spec/requests/ticket_spec.rb @@ -2048,7 +2048,7 @@ RSpec.describe 'Ticket', type: :request do expect(json_response['tickets']).to eq([ticket1.id, ticket2.id]) authenticated_as(admin) - get "/api/v1/tickets/search?query=#{CGI.escape(title)}&limit=40", params: { sort_by: %w[created_at updated_at], order_by: %w[desc asc] }, as: :json + get "/api/v1/tickets/search?query=#{CGI.escape(title)}&limit=40", params: { sort_by: %w[created_at updated_at], order_by: %w[desc asc] }, as: :json expect(response).to have_http_status(:ok) expect(json_response).to be_a_kind_of(Hash) expect(json_response['tickets']).to eq([ticket2.id, ticket1.id]) diff --git a/spec/system/login/message_spec.rb b/spec/system/login/message_spec.rb index 2821a9cb9..7b8661cb7 100644 --- a/spec/system/login/message_spec.rb +++ b/spec/system/login/message_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' RSpec.describe 'Login Message', type: :system, authenticated_as: false do context 'with maintenance_login_message' do let(:message) { "badum tssss #{rand(99_999)}" } - let(:alt_message) { 'lorem ipsum' } + let(:alt_message) { 'lorem ipsum' } before { Setting.set 'maintenance_login_message', message } diff --git a/test/browser/admin_object_manager_test.rb b/test/browser/admin_object_manager_test.rb index 72da05532..d5e998773 100644 --- a/test/browser/admin_object_manager_test.rb +++ b/test/browser/admin_object_manager_test.rb @@ -739,7 +739,7 @@ class AdminObjectManagerTest < TestCase # open the previously created ticket and verify its attribute selection click( - xpath: '//a/div[contains(text(),"select_attributes_delete_test")]', + xpath: '//a/div[contains(text(),"select_attributes_delete_test")]', ) # confirm that all options and their display values are there and are in the correct order select_element = @browser.find_elements(css: '.content.active select[name="select_attributes_delete_test"]')[0] diff --git a/test/browser/admin_role_test.rb b/test/browser/admin_role_test.rb index b0b3c1c30..e42a8b11c 100644 --- a/test/browser/admin_role_test.rb +++ b/test/browser/admin_role_test.rb @@ -246,7 +246,7 @@ class AdminRoleTest < TestCase ) click( - css: '.content.active a[href="#manage/users"]', + css: '.content.active a[href="#manage/users"]', ) # an inactive role should not appear in the role filter tabs diff --git a/test/browser/agent_navigation_and_title_test.rb b/test/browser/agent_navigation_and_title_test.rb index 7e09b9eb1..12b3a9473 100644 --- a/test/browser/agent_navigation_and_title_test.rb +++ b/test/browser/agent_navigation_and_title_test.rb @@ -129,7 +129,7 @@ class AgentNavigationAndTitleTest < TestCase exists_not(css: '#navigation .tasks .js-item.is-active') # click on admin - click(css: 'a[href = "#manage"]') + click(css: 'a[href = "#manage"]') verify_title(value: 'Users') exists_not(css: '#navigation .js-menu .is-active') exists_not(css: '#navigation .tasks .js-item.is-active') diff --git a/test/browser/agent_ticket_email_reply_keep_body_test.rb b/test/browser/agent_ticket_email_reply_keep_body_test.rb index 81db7ec3b..92bb429e0 100644 --- a/test/browser/agent_ticket_email_reply_keep_body_test.rb +++ b/test/browser/agent_ticket_email_reply_keep_body_test.rb @@ -110,7 +110,7 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase title: 'Welcome to Zammad', ) watch_for( - css: '.content.active .js-settingContainer .js-setting .dropdown-icon', + css: '.content.active .js-settingContainer .js-setting .dropdown-icon', ) # enable email full quote in the ticket zoom config page @@ -186,7 +186,7 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase title: 'Welcome to Zammad', ) watch_for( - css: '.content.active .js-settingContainer .js-setting .dropdown-icon', + css: '.content.active .js-settingContainer .js-setting .dropdown-icon', ) # enable email full quote in the ticket zoom config page diff --git a/test/browser/agent_ticket_overview_pending_til_test.rb b/test/browser/agent_ticket_overview_pending_til_test.rb index 0b5e7efd8..c4f9ab016 100644 --- a/test/browser/agent_ticket_overview_pending_til_test.rb +++ b/test/browser/agent_ticket_overview_pending_til_test.rb @@ -45,12 +45,12 @@ class AgentTicketOverviewPendingTil < TestCase } ) overview_open( - name: name, + name: name, ) # sort by Pending Til click( - css: '.content.active table.table th.js-tableHead[data-column-key="pending_time"]', + css: '.content.active table.table th.js-tableHead[data-column-key="pending_time"]', ) # check if the first and second rows both correctly contain 'pending close' diff --git a/test/browser/reporting_test.rb b/test/browser/reporting_test.rb index 3c9adf121..59ef6fe2f 100644 --- a/test/browser/reporting_test.rb +++ b/test/browser/reporting_test.rb @@ -25,7 +25,7 @@ class ReportingTest < TestCase ) click( - css: 'a[href="#manage"]', + css: 'a[href="#manage"]', ) click( css: '.content.active a[href="#manage/report_profiles"]', diff --git a/test/unit/db_auto_increment_test.rb b/test/unit/db_auto_increment_test.rb index b37740d66..1afd9ce11 100644 --- a/test/unit/db_auto_increment_test.rb +++ b/test/unit/db_auto_increment_test.rb @@ -8,17 +8,17 @@ class DbAutoIncrementTest < ActiveSupport::TestCase Setting.set('system_init_done', false) - Ticket::StateType.create_if_not_exists( id: 200, name: 'unit test 1', updated_by_id: 1, created_by_id: 1 ) + Ticket::StateType.create_if_not_exists( id: 200, name: 'unit test 1', updated_by_id: 1, created_by_id: 1 ) state_type = Ticket::StateType.where( name: 'unit test 1' ).first assert_equal( Ticket::StateType.to_s, state_type.class.to_s ) assert_equal( 'unit test 1', state_type.name ) - Ticket::StateType.create_if_not_exists( id: 200, name: 'unit test 1 _ should not be created', updated_by_id: 1, created_by_id: 1 ) + Ticket::StateType.create_if_not_exists( id: 200, name: 'unit test 1 _ should not be created', updated_by_id: 1, created_by_id: 1 ) state_type = Ticket::StateType.where( id: 200 ).first assert_equal( Ticket::StateType.to_s, state_type.class.to_s ) assert_equal( 'unit test 1', state_type.name ) - Ticket::StateType.create_or_update( id: 200, name: 'unit test 1 _ should be updated', updated_by_id: 1, created_by_id: 1 ) + Ticket::StateType.create_or_update( id: 200, name: 'unit test 1 _ should be updated', updated_by_id: 1, created_by_id: 1 ) state_type = Ticket::StateType.where( name: 'unit test 1 _ should be updated' ).first assert_equal( Ticket::StateType.to_s, state_type.class.to_s ) assert_equal( 'unit test 1 _ should be updated', state_type.name ) @@ -27,17 +27,17 @@ class DbAutoIncrementTest < ActiveSupport::TestCase assert_equal( Ticket::StateType.to_s, state_type.class.to_s ) assert_equal( 'unit test 1 _ should be updated', state_type.name ) - Ticket::State.create_if_not_exists( id: 210, name: 'unit test 1', state_type_id: Ticket::StateType.where(name: 'unit test 1 _ should be updated').first.id, updated_by_id: 1, created_by_id: 1 ) + Ticket::State.create_if_not_exists( id: 210, name: 'unit test 1', state_type_id: Ticket::StateType.where(name: 'unit test 1 _ should be updated').first.id, updated_by_id: 1, created_by_id: 1 ) state = Ticket::State.where( name: 'unit test 1' ).first assert_equal( Ticket::State.to_s, state.class.to_s ) assert_equal( 'unit test 1', state.name ) - Ticket::State.create_if_not_exists( id: 210, name: 'unit test 1 _ should not be created', state_type_id: Ticket::StateType.where(name: 'unit test 1 _ should be updated').first.id, updated_by_id: 1, created_by_id: 1 ) + Ticket::State.create_if_not_exists( id: 210, name: 'unit test 1 _ should not be created', state_type_id: Ticket::StateType.where(name: 'unit test 1 _ should be updated').first.id, updated_by_id: 1, created_by_id: 1 ) state = Ticket::State.where( id: 210 ).first assert_equal( Ticket::State.to_s, state.class.to_s ) assert_equal( 'unit test 1', state.name ) - Ticket::State.create_or_update( id: 210, name: 'unit test 1 _ should be updated', state_type_id: Ticket::StateType.where(name: 'unit test 1 _ should be updated').first.id, updated_by_id: 1, created_by_id: 1 ) + Ticket::State.create_or_update( id: 210, name: 'unit test 1 _ should be updated', state_type_id: Ticket::StateType.where(name: 'unit test 1 _ should be updated').first.id, updated_by_id: 1, created_by_id: 1 ) state = Ticket::State.where( name: 'unit test 1 _ should be updated' ).first assert_equal( Ticket::State.to_s, state.class.to_s ) assert_equal( 'unit test 1 _ should be updated', state.name ) diff --git a/test/unit/store_test.rb b/test/unit/store_test.rb index e21a57a87..8861abd5f 100644 --- a/test/unit/store_test.rb +++ b/test/unit/store_test.rb @@ -75,7 +75,7 @@ class StoreTest < ActiveSupport::TestCase # sha check sha_new = Digest::SHA256.hexdigest(attachments[0].content) - assert_equal(sha, sha_new, "check file #{file[:filename]}") + assert_equal(sha, sha_new, "check file #{file[:filename]}") # filename check assert_equal(file[:filename], attachments[0].filename) @@ -101,7 +101,7 @@ class StoreTest < ActiveSupport::TestCase # sha check sha_new = Digest::SHA256.hexdigest(attachments[0].content) - assert_equal(sha, sha_new, "check file #{file[:filename]}") + assert_equal(sha, sha_new, "check file #{file[:filename]}") # filename check assert_equal(file[:filename], attachments[0].filename) @@ -128,7 +128,7 @@ class StoreTest < ActiveSupport::TestCase # sha check sha_new = Digest::SHA256.hexdigest(attachments[0].content) - assert_equal(sha, sha_new, "check file #{file[:filename]}") + assert_equal(sha, sha_new, "check file #{file[:filename]}") # filename check assert_equal(file[:filename], attachments[0].filename)