diff --git a/Gemfile.lock b/Gemfile.lock
index 4766da21f..7f82aa27c 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -451,24 +451,24 @@ GEM
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
rszr (0.5.2)
- rubocop (0.86.0)
+ rubocop (0.87.0)
parallel (~> 1.10)
- parser (>= 2.7.0.1)
+ parser (>= 2.7.1.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.7)
rexml
- rubocop-ast (>= 0.0.3, < 1.0)
+ rubocop-ast (>= 0.1.0, < 1.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
- rubocop-ast (0.0.3)
+ rubocop-ast (0.1.0)
parser (>= 2.7.0.1)
- rubocop-performance (1.6.1)
- rubocop (>= 0.71.0)
+ rubocop-performance (1.7.0)
+ rubocop (>= 0.82.0)
rubocop-rails (2.6.0)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 0.82.0)
- rubocop-rspec (1.40.0)
+ rubocop-rspec (1.41.0)
rubocop (>= 0.68.1)
ruby-progressbar (1.10.1)
ruby-saml (1.10.2)
diff --git a/app/controllers/form_controller.rb b/app/controllers/form_controller.rb
index e6d7c5304..ee2d73f19 100644
--- a/app/controllers/form_controller.rb
+++ b/app/controllers/form_controller.rb
@@ -61,7 +61,7 @@ class FormController < ApplicationController
Rails.logger.info "Can't verify email #{params[:email]}: #{message}"
# ignore 450, graylistings
- errors['email'] = message if !message.match?(/450/)
+ errors['email'] = message if !message.include?('450')
end
end
diff --git a/app/controllers/import_otrs_controller.rb b/app/controllers/import_otrs_controller.rb
index 44dcc9f2d..34cd62a75 100644
--- a/app/controllers/import_otrs_controller.rb
+++ b/app/controllers/import_otrs_controller.rb
@@ -39,7 +39,7 @@ class ImportOtrsController < ApplicationController
end
result = {}
- if response.body.match?(/zammad migrator/)
+ if response.body.include?('zammad migrator')
migrator_response = JSON.parse(response.body)
diff --git a/app/helpers/knowledge_base_rich_text_helper.rb b/app/helpers/knowledge_base_rich_text_helper.rb
index 881a87e90..46bcb15aa 100644
--- a/app/helpers/knowledge_base_rich_text_helper.rb
+++ b/app/helpers/knowledge_base_rich_text_helper.rb
@@ -22,9 +22,8 @@ module KnowledgeBaseRichTextHelper
end
end
- parsed = Loofah.scrub_fragment(input, scrubber).to_s.html_safe # rubocop:disable Rails/OutputSafety
+ Loofah.scrub_fragment(input, scrubber).to_s.html_safe # rubocop:disable Rails/OutputSafety
- parsed
end
def prepare_rich_text_videos(input)
diff --git a/app/models/activity_stream.rb b/app/models/activity_stream.rb
index 2d824e84f..748d5cda6 100644
--- a/app/models/activity_stream.rb
+++ b/app/models/activity_stream.rb
@@ -112,16 +112,16 @@ return all activity entries of an user
permission_ids = user.permissions_with_child_ids
group_ids = user.group_ids_access('read')
- stream = if group_ids.blank?
- ActivityStream.where('(permission_id IN (?) AND group_id IS NULL)', permission_ids)
- .order(created_at: :desc)
- .limit(limit)
- else
- ActivityStream.where('(permission_id IN (?) AND (group_id IS NULL OR group_id IN (?))) OR (permission_id IS NULL AND group_id IN (?))', permission_ids, group_ids, group_ids)
- .order(created_at: :desc)
- .limit(limit)
- end
- stream
+ if group_ids.blank?
+ ActivityStream.where('(permission_id IN (?) AND group_id IS NULL)', permission_ids)
+ .order(created_at: :desc)
+ .limit(limit)
+ else
+ ActivityStream.where('(permission_id IN (?) AND (group_id IS NULL OR group_id IN (?))) OR (permission_id IS NULL AND group_id IN (?))', permission_ids, group_ids, group_ids)
+ .order(created_at: :desc)
+ .limit(limit)
+ end
+
end
=begin
diff --git a/app/models/channel/driver/imap.rb b/app/models/channel/driver/imap.rb
index 72af80a64..474afb1a1 100644
--- a/app/models/channel/driver/imap.rb
+++ b/app/models/channel/driver/imap.rb
@@ -239,7 +239,7 @@ example
timeout(FETCH_METADATA_TIMEOUT) do
message_meta = @imap.fetch(message_id, ['RFC822.SIZE', 'ENVELOPE', 'FLAGS', 'INTERNALDATE', 'RFC822.HEADER'])[0]
rescue Net::IMAP::ResponseParseError => e
- raise if !e.message.match?(/unknown token/)
+ raise if !e.message.include?('unknown token')
result = 'error'
notice += <<~NOTICE
diff --git a/app/models/channel/driver/telegram.rb b/app/models/channel/driver/telegram.rb
index d9c5eec80..149851da3 100644
--- a/app/models/channel/driver/telegram.rb
+++ b/app/models/channel/driver/telegram.rb
@@ -26,8 +26,8 @@ class Channel::Driver::Telegram
options = check_external_credential(options)
@client = Telegram.new(options[:auth][:api_key])
- message = @client.from_article(article)
- message
+ @client.from_article(article)
+
end
=begin
diff --git a/app/models/chat/session/search.rb b/app/models/chat/session/search.rb
index 545a0c69e..46e01926f 100644
--- a/app/models/chat/session/search.rb
+++ b/app/models/chat/session/search.rb
@@ -78,10 +78,10 @@ returns
# fallback do sql query
# - stip out * we already search for *query* -
query.delete! '*'
- chat_sessions = Chat::Session.where(
+ Chat::Session.where(
'name LIKE ?', "%#{query}%"
).order('name').offset(offset).limit(limit).to_a
- chat_sessions
+
end
end
end
diff --git a/app/models/concerns/has_rich_text.rb b/app/models/concerns/has_rich_text.rb
index b9d6b0afb..39a9e2154 100644
--- a/app/models/concerns/has_rich_text.rb
+++ b/app/models/concerns/has_rich_text.rb
@@ -150,9 +150,8 @@ Checks if file is used inline
node['src'] = Rails.application.routes.url_helpers.attachment_path(attachment.id)
end
- parsed = Loofah.scrub_fragment(raw, scrubber).to_s
+ Loofah.scrub_fragment(raw, scrubber).to_s
- parsed
end
def has_rich_text_inline_cids(object, attr) # rubocop:disable Naming/PredicateName
diff --git a/app/models/online_notification.rb b/app/models/online_notification.rb
index 15d876256..36dd60f7d 100644
--- a/app/models/online_notification.rb
+++ b/app/models/online_notification.rb
@@ -118,13 +118,13 @@ return all online notifications of an object
def self.list_by_object(object_name, o_id)
object_id = ObjectLookup.by_name(object_name)
- notifications = OnlineNotification.where(
+ OnlineNotification.where(
object_lookup_id: object_id,
o_id: o_id,
)
.order(created_at: :desc)
.limit(10_000)
- notifications
+
end
=begin
diff --git a/app/models/overview.rb b/app/models/overview.rb
index bbea99ec6..df89a21fd 100644
--- a/app/models/overview.rb
+++ b/app/models/overview.rb
@@ -91,7 +91,7 @@ class Overview < ApplicationModel
local_link = name.downcase
local_link = local_link.parameterize(separator: '_')
local_link.gsub!(/\s/, '_')
- local_link.gsub!(/_+/, '_')
+ local_link.squeeze!('_')
local_link = CGI.escape(local_link)
if local_link.blank?
local_link = id || rand(999)
diff --git a/app/models/package.rb b/app/models/package.rb
index 4c001d50c..ea173477d 100644
--- a/app/models/package.rb
+++ b/app/models/package.rb
@@ -64,7 +64,7 @@ install all packages located under auto_install/*.zpm
data = []
Dir.foreach(path) do |entry|
- if entry =~ /\.zpm/ && entry !~ /^\./
+ if entry.include?('.zpm') && entry !~ /^\./
data.push entry
end
end
diff --git a/app/models/store.rb b/app/models/store.rb
index 0ab8192a1..fc2d0a4e7 100644
--- a/app/models/store.rb
+++ b/app/models/store.rb
@@ -86,9 +86,9 @@ returns
def self.list(data)
# search
store_object_id = Store::Object.lookup(name: data[:object])
- stores = Store.where(store_object_id: store_object_id, o_id: data[:o_id].to_i)
+ Store.where(store_object_id: store_object_id, o_id: data[:o_id].to_i)
.order(created_at: :asc)
- stores
+
end
=begin
diff --git a/app/models/user/search.rb b/app/models/user/search.rb
index 216e2784e..76a752716 100644
--- a/app/models/user/search.rb
+++ b/app/models/user/search.rb
@@ -134,22 +134,22 @@ returns
# fallback do sql query
# - stip out * we already search for *query* -
query.delete! '*'
- users = if params[:role_ids]
- User.joins(:roles).where('roles.id' => params[:role_ids]).where(
- '(users.firstname LIKE ? OR users.lastname LIKE ? OR users.email LIKE ? OR users.login LIKE ?) AND users.id != 1', "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%"
- )
- .order(Arel.sql(order_sql))
- .offset(offset)
- .limit(limit)
- else
- User.where(
- '(firstname LIKE ? OR lastname LIKE ? OR email LIKE ? OR login LIKE ?) AND id != 1', "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%"
- )
- .order(Arel.sql(order_sql))
- .offset(offset)
- .limit(limit)
- end
- users
+ if params[:role_ids]
+ User.joins(:roles).where('roles.id' => params[:role_ids]).where(
+ '(users.firstname LIKE ? OR users.lastname LIKE ? OR users.email LIKE ? OR users.login LIKE ?) AND users.id != 1', "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%"
+ )
+ .order(Arel.sql(order_sql))
+ .offset(offset)
+ .limit(limit)
+ else
+ User.where(
+ '(firstname LIKE ? OR lastname LIKE ? OR email LIKE ? OR login LIKE ?) AND id != 1', "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%"
+ )
+ .order(Arel.sql(order_sql))
+ .offset(offset)
+ .limit(limit)
+ end
+
end
end
end
diff --git a/config.ru b/config.ru
index 0523eadaf..ae09097f3 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', __dir__)
run Zammad::Application
# set config to do no self notification
diff --git a/lib/auto_wizard.rb b/lib/auto_wizard.rb
index b652fb372..347e8ba2d 100644
--- a/lib/auto_wizard.rb
+++ b/lib/auto_wizard.rb
@@ -155,9 +155,9 @@ returns
end
def self.file_location
- auto_wizard_file_name = 'auto_wizard.json'
- auto_wizard_file_location = Rails.root.join(auto_wizard_file_name)
- auto_wizard_file_location
+ auto_wizard_file_name = 'auto_wizard.json'
+ Rails.root.join(auto_wizard_file_name)
+
end
private_class_method :file_location
end
diff --git a/lib/email_helper.rb b/lib/email_helper.rb
index dc05a2906..4427079dc 100644
--- a/lib/email_helper.rb
+++ b/lib/email_helper.rb
@@ -106,7 +106,7 @@ returns
def self.provider(email, password)
# check domain based attributes
- provider_map = {
+ {
google_imap: {
domain: 'gmail|googlemail|google',
inbound: {
@@ -177,7 +177,7 @@ returns
},
},
}
- provider_map
+
end
=begin
@@ -274,7 +274,7 @@ returns
=end
def self.provider_inbound_guess(user, email, password, domain)
- inbound = [
+ [
{
adapter: 'imap',
options: {
@@ -376,7 +376,7 @@ returns
},
},
]
- inbound
+
end
=begin
@@ -511,7 +511,7 @@ returns
=end
def self.provider_outbound_guess(user, email, password, domain)
- outbound = [
+ [
{
adapter: 'smtp',
options: {
@@ -593,7 +593,7 @@ returns
},
},
]
- outbound
+
end
=begin
diff --git a/lib/excel_sheet/ticket.rb b/lib/excel_sheet/ticket.rb
index 5f9c6a111..3404431ca 100644
--- a/lib/excel_sheet/ticket.rb
+++ b/lib/excel_sheet/ticket.rb
@@ -66,27 +66,27 @@ class ExcelSheet::Ticket < ExcelSheet
header.push object
end
- header = header.concat([
- { display: 'Created At', name: 'created_at', width: 18, data_type: 'datetime' },
- { display: 'Updated At', name: 'updated_at', width: 18, data_type: 'datetime' },
- { display: 'Closed At', name: 'close_at', width: 18, data_type: 'datetime' },
- { display: 'Close Escalation At', name: 'close_escalation_at', width: 18, data_type: 'datetime' },
- { display: 'Close In Min', name: 'close_in_min', width: 10, data_type: 'integer' },
- { display: 'Close Diff In Min', name: 'close_diff_in_min', width: 10, data_type: 'integer' },
- { display: 'First Response At', name: 'first_response_at', width: 18, data_type: 'datetime' },
- { display: 'First Response Escalation At', name: 'first_response_escalation_at', width: 18, data_type: 'datetime' },
- { display: 'First Response In Min', name: 'first_response_in_min', width: 10, data_type: 'integer' },
- { display: 'First Response Diff In Min', name: 'first_response_diff_in_min', width: 10, data_type: 'integer' },
- { display: 'Update Escalation At', name: 'update_escalation_at', width: 18, data_type: 'datetime' },
- { display: 'Update In Min', name: 'update_in_min', width: 10, data_type: 'integer' },
- { display: 'Update Diff In Min', name: 'update_diff_in_min', width: 10, data_type: 'integer' },
- { display: 'Last Contact At', name: 'last_contact_at', width: 18, data_type: 'datetime' },
- { display: 'Last Contact Agent At', name: 'last_contact_agent_at', width: 18, data_type: 'datetime' },
- { display: 'Last Contact Customer At', name: 'last_contact_customer_at', width: 18, data_type: 'datetime' },
- { display: 'Article Count', name: 'article_count', width: 10, data_type: 'integer' },
- { display: 'Escalation At', name: 'escalation_at', width: 18, data_type: 'datetime' },
- ])
- header
+ header.concat([
+ { display: 'Created At', name: 'created_at', width: 18, data_type: 'datetime' },
+ { display: 'Updated At', name: 'updated_at', width: 18, data_type: 'datetime' },
+ { display: 'Closed At', name: 'close_at', width: 18, data_type: 'datetime' },
+ { display: 'Close Escalation At', name: 'close_escalation_at', width: 18, data_type: 'datetime' },
+ { display: 'Close In Min', name: 'close_in_min', width: 10, data_type: 'integer' },
+ { display: 'Close Diff In Min', name: 'close_diff_in_min', width: 10, data_type: 'integer' },
+ { display: 'First Response At', name: 'first_response_at', width: 18, data_type: 'datetime' },
+ { display: 'First Response Escalation At', name: 'first_response_escalation_at', width: 18, data_type: 'datetime' },
+ { display: 'First Response In Min', name: 'first_response_in_min', width: 10, data_type: 'integer' },
+ { display: 'First Response Diff In Min', name: 'first_response_diff_in_min', width: 10, data_type: 'integer' },
+ { display: 'Update Escalation At', name: 'update_escalation_at', width: 18, data_type: 'datetime' },
+ { display: 'Update In Min', name: 'update_in_min', width: 10, data_type: 'integer' },
+ { display: 'Update Diff In Min', name: 'update_diff_in_min', width: 10, data_type: 'integer' },
+ { display: 'Last Contact At', name: 'last_contact_at', width: 18, data_type: 'datetime' },
+ { display: 'Last Contact Agent At', name: 'last_contact_agent_at', width: 18, data_type: 'datetime' },
+ { display: 'Last Contact Customer At', name: 'last_contact_customer_at', width: 18, data_type: 'datetime' },
+ { display: 'Article Count', name: 'article_count', width: 10, data_type: 'integer' },
+ { display: 'Escalation At', name: 'escalation_at', width: 18, data_type: 'datetime' },
+ ])
+
end
def gen_rows
diff --git a/lib/search_index_backend.rb b/lib/search_index_backend.rb
index 508bb539b..098f73902 100644
--- a/lib/search_index_backend.rb
+++ b/lib/search_index_backend.rb
@@ -779,7 +779,7 @@ generate url for index or document access (only for internal use)
# add * on simple query like "somephrase23"
def self.append_wildcard_to_simple_query(query)
query.strip!
- query += '*' if !query.match?(/:/)
+ query += '*' if !query.include?(':')
query
end
diff --git a/lib/sequencer/unit/import/exchange/attribute_examples.rb b/lib/sequencer/unit/import/exchange/attribute_examples.rb
index 009ca0f81..7af6e8438 100644
--- a/lib/sequencer/unit/import/exchange/attribute_examples.rb
+++ b/lib/sequencer/unit/import/exchange/attribute_examples.rb
@@ -20,7 +20,7 @@ class Sequencer
break if extractor.enough
end
rescue NoMethodError => e
- raise if !e.message.match?(/Viewpoint::EWS::/)
+ raise if !e.message.include?('Viewpoint::EWS::')
logger.error e
logger.error "Skipping folder_id '#{folder_id}' due to unsupported entries."
diff --git a/lib/service/geo_location/gmaps.rb b/lib/service/geo_location/gmaps.rb
index 11e54f9db..88d5f9437 100644
--- a/lib/service/geo_location/gmaps.rb
+++ b/lib/service/geo_location/gmaps.rb
@@ -42,7 +42,7 @@ class Service::GeoLocation::Gmaps
result = JSON.parse(response.body)
- address = result['results'].first['address_components'].first['long_name']
- address
+ result['results'].first['address_components'].first['long_name']
+
end
end
diff --git a/lib/sessions/backend/base.rb b/lib/sessions/backend/base.rb
index 14da840c8..bc31b4964 100644
--- a/lib/sessions/backend/base.rb
+++ b/lib/sessions/backend/base.rb
@@ -1,7 +1,6 @@
class Sessions::Backend::Base
- attr_writer :user
- attr_writer :time_now
+ attr_writer :user, :time_now
def initialize(user, asset_lookup, client, client_id, ttl = 10)
@user = user
diff --git a/lib/user_agent.rb b/lib/user_agent.rb
index dfa8f18a4..9b4ffc713 100644
--- a/lib/user_agent.rb
+++ b/lib/user_agent.rb
@@ -511,11 +511,7 @@ returns
class Result
- attr_reader :error
- attr_reader :body
- attr_reader :data
- attr_reader :code
- attr_reader :content_type
+ attr_reader :error, :body, :data, :code, :content_type
def initialize(options)
@success = options[:success]
diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb
index 22a731d9b..2602a352d 100644
--- a/test/browser_test_helper.rb
+++ b/test/browser_test_helper.rb
@@ -811,7 +811,7 @@ class TestCase < ActiveSupport::TestCase
end
# it's not working stable with ff via selenium, use js
- if browser =~ /firefox/i && params[:css] =~ /\[data-name=/
+ if browser =~ /firefox/i && params[:css].include?('[data-name=')
log('set_ff_trigger_workaround', params)
instance.execute_script("$('#{params[:css]}').trigger('focusout')")
end
@@ -1024,7 +1024,7 @@ class TestCase < ActiveSupport::TestCase
instance = params[:browser] || @browser
element = instance.find_elements(css: params[:css])[0]
- if params[:css].match?(/select/)
+ if params[:css].include?('select')
dropdown = Selenium::WebDriver::Support::Select.new(element)
success = false
dropdown.selected_options&.each do |option|
diff --git a/test/integration/user_agent_test.rb b/test/integration/user_agent_test.rb
index 6778f2e3b..7f36c1a06 100644
--- a/test/integration/user_agent_test.rb
+++ b/test/integration/user_agent_test.rb
@@ -23,9 +23,9 @@ class UserAgentTest < ActiveSupport::TestCase
assert_equal(true, result.success?)
assert_equal('200', result.code)
assert_equal(String, result.body.class)
- assert(result.body =~ /"get"/)
- assert(result.body =~ /"123"/)
- assert(result.body =~ /"content_type_requested":null/)
+ assert(result.body.include?('"get"'))
+ assert(result.body.include?('"123"'))
+ assert(result.body.include?('"content_type_requested":null'))
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
end
@@ -50,9 +50,9 @@ class UserAgentTest < ActiveSupport::TestCase
assert_equal(true, result.success?)
assert_equal('201', result.code)
assert_equal(String, result.body.class)
- assert(result.body =~ /"post"/)
- assert(result.body =~ /"some value"/)
- assert(result.body =~ %r{"application/x-www-form-urlencoded"})
+ assert(result.body.include?('"post"'))
+ assert(result.body.include?('"some value"'))
+ assert(result.body.include?('"application/x-www-form-urlencoded"'))
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
end
@@ -80,9 +80,9 @@ class UserAgentTest < ActiveSupport::TestCase
assert_equal(true, result.success?)
assert_equal('200', result.code)
assert_equal(String, result.body.class)
- assert(result.body =~ /"put"/)
- assert(result.body =~ /"some value"/)
- assert(result.body =~ %r{"application/x-www-form-urlencoded"})
+ assert(result.body.include?('"put"'))
+ assert(result.body.include?('"some value"'))
+ assert(result.body.include?('"application/x-www-form-urlencoded"'))
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
end
@@ -107,8 +107,8 @@ class UserAgentTest < ActiveSupport::TestCase
assert_equal(true, result.success?)
assert_equal('200', result.code)
assert_equal(String, result.body.class)
- assert(result.body =~ /"delete"/)
- assert(result.body =~ /"content_type_requested":null/)
+ assert(result.body.include?('"delete"'))
+ assert(result.body.include?('"content_type_requested":null'))
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
end
@@ -137,9 +137,9 @@ class UserAgentTest < ActiveSupport::TestCase
assert_equal(true, result.success?)
assert_equal('200', result.code)
assert_equal(String, result.body.class)
- assert(result.body =~ /"get"/)
- assert(result.body =~ /"123"/)
- assert(result.body =~ /"content_type_requested":null/)
+ assert(result.body.include?('"get"'))
+ assert(result.body.include?('"123"'))
+ assert(result.body.include?('"content_type_requested":null'))
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
end
@@ -173,9 +173,9 @@ class UserAgentTest < ActiveSupport::TestCase
assert_equal(true, result.success?)
assert_equal('201', result.code)
assert_equal(String, result.body.class)
- assert(result.body =~ /"post"/)
- assert(result.body =~ /"some value"/)
- assert(result.body =~ %r{"application/x-www-form-urlencoded"})
+ assert(result.body.include?('"post"'))
+ assert(result.body.include?('"some value"'))
+ assert(result.body.include?('"application/x-www-form-urlencoded"'))
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
end
@@ -211,9 +211,9 @@ class UserAgentTest < ActiveSupport::TestCase
assert_equal(true, result.success?)
assert_equal('200', result.code)
assert_equal(String, result.body.class)
- assert(result.body =~ /"put"/)
- assert(result.body =~ /"some value"/)
- assert(result.body =~ %r{"application/x-www-form-urlencoded"})
+ assert(result.body.include?('"put"'))
+ assert(result.body.include?('"some value"'))
+ assert(result.body.include?('"application/x-www-form-urlencoded"'))
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
end
@@ -247,8 +247,8 @@ class UserAgentTest < ActiveSupport::TestCase
assert_equal(true, result.success?)
assert_equal('200', result.code)
assert_equal(String, result.body.class)
- assert(result.body =~ /"delete"/)
- assert(result.body =~ /"content_type_requested":null/)
+ assert(result.body.include?('"delete"'))
+ assert(result.body.include?('"content_type_requested":null'))
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
end
@@ -279,9 +279,9 @@ class UserAgentTest < ActiveSupport::TestCase
assert_equal(true, result.success?)
assert_equal('200', result.code)
assert_equal(String, result.body.class)
- assert(result.body =~ /"get"/)
- assert(result.body =~ /"abc"/)
- assert(result.body =~ /"content_type_requested":null/)
+ assert(result.body.include?('"get"'))
+ assert(result.body.include?('"abc"'))
+ assert(result.body.include?('"content_type_requested":null'))
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
end
@@ -298,9 +298,9 @@ class UserAgentTest < ActiveSupport::TestCase
assert_equal(true, result.success?)
assert_equal('200', result.code)
assert_equal(String, result.body.class)
- assert(result.body =~ /"get"/)
- assert(result.body =~ /"abc"/)
- assert(result.body =~ /"content_type_requested":null/)
+ assert(result.body.include?('"get"'))
+ assert(result.body.include?('"abc"'))
+ assert(result.body.include?('"content_type_requested":null'))
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
end
@@ -330,9 +330,9 @@ class UserAgentTest < ActiveSupport::TestCase
assert_equal(true, result.success?)
assert_equal('200', result.code)
assert_equal(String, result.body.class)
- assert(result.body =~ /"get"/)
- assert(result.body =~ /"123"/)
- assert(result.body =~ /"content_type_requested":null/)
+ assert(result.body.include?('"get"'))
+ assert(result.body.include?('"123"'))
+ assert(result.body.include?('"content_type_requested":null'))
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
end
@@ -366,7 +366,7 @@ class UserAgentTest < ActiveSupport::TestCase
assert_equal(true, result.success?)
assert_equal('200', result.code)
assert_equal(String, result.body.class)
- assert(result.body =~ /"GET"/)
+ assert(result.body.include?('"GET"'))
# get / 200 / gzip
result = UserAgent.request(
@@ -376,7 +376,7 @@ class UserAgentTest < ActiveSupport::TestCase
assert_equal(true, result.success?)
assert_equal('200', result.code)
assert_equal(String, result.body.class)
- assert(result.body =~ /"GET"/)
+ assert(result.body.include?('"GET"'))
# get / 200 / gzip
result = UserAgent.request(
@@ -386,7 +386,7 @@ class UserAgentTest < ActiveSupport::TestCase
assert_equal(true, result.success?)
assert_equal('200', result.code)
assert_equal(String, result.body.class)
- assert(result.body =~ /"GET"/)
+ assert(result.body.include?('"GET"'))
# get / 200 / gzip
result = UserAgent.request(
@@ -396,7 +396,7 @@ class UserAgentTest < ActiveSupport::TestCase
assert_equal(true, result.success?)
assert_equal('200', result.code)
assert_equal(String, result.body.class)
- assert(result.body =~ /"GET"/)
+ assert(result.body.include?('"GET"'))
end
@@ -473,8 +473,8 @@ class UserAgentTest < ActiveSupport::TestCase
assert_equal(true, result.success?)
assert_equal('200', result.code)
assert_equal(String, result.body.class)
- assert(result.body =~ /"content_type_requested"/)
- assert(result.body =~ %r{"application/json"})
+ assert(result.body.include?('"content_type_requested"'))
+ assert(result.body.include?('"application/json"'))
assert_equal('some value ', result.data['submitted']['key'])
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
@@ -510,8 +510,8 @@ class UserAgentTest < ActiveSupport::TestCase
assert_equal(true, result.success?)
assert_equal('201', result.code)
assert_equal(String, result.body.class)
- assert(result.body =~ /"content_type_requested"/)
- assert(result.body =~ %r{"application/json"})
+ assert(result.body.include?('"content_type_requested"'))
+ assert(result.body.include?('"application/json"'))
assert_equal('some value ', result.data['submitted']['key'])
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 652aa2ba4..286c92d48 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -65,7 +65,7 @@ class ActiveSupport::TestCase
end
count = 0
lines.reverse_each do |line|
- break if line.match?(/\+\+\+\+NEW\+\+\+\+TEST\+\+\+\+/)
+ break if line.include?('++++NEW++++TEST++++')
next if !line.match?(/Send notification \(#{type}\)/)
next if !line.match?(/to:\s#{recipient}/)
diff --git a/test/unit/email_build_test.rb b/test/unit/email_build_test.rb
index c6894af8a..97391c9bf 100644
--- a/test/unit/email_build_test.rb
+++ b/test/unit/email_build_test.rb
@@ -8,18 +8,18 @@ class EmailBuildTest < ActiveSupport::TestCase
assert(result.start_with?('/, 'test 1')
- assert(result =~ /font-family/, 'test 1')
- assert(result =~ %r{test}, 'test 1')
+ assert(result.include?(''), 'test 1')
+ assert(result.include?('font-family'), 'test 1')
+ assert(result.include?('test'), 'test 1')
html = 'invalid test'
result = Channel::EmailBuild.html_complete_check(html)
assert(result !~ /^/, 'test 2')
+ assert(result.include?(''), 'test 2')
assert(result !~ /font-family/, 'test 2')
- assert(result =~ %r{test}, 'test 2')
+ assert(result.include?('test'), 'test 2')
# Issue #1230, missing backslashes
# 'Test URL: \\storage\project\100242-Inc'