Updated rubocop(-* gems) to latest version (0.87.0).
This commit is contained in:
parent
6931fece7a
commit
b37e80df9a
27 changed files with 132 additions and 139 deletions
14
Gemfile.lock
14
Gemfile.lock
|
@ -451,24 +451,24 @@ GEM
|
||||||
rspec-support (~> 3.8.0)
|
rspec-support (~> 3.8.0)
|
||||||
rspec-support (3.8.0)
|
rspec-support (3.8.0)
|
||||||
rszr (0.5.2)
|
rszr (0.5.2)
|
||||||
rubocop (0.86.0)
|
rubocop (0.87.0)
|
||||||
parallel (~> 1.10)
|
parallel (~> 1.10)
|
||||||
parser (>= 2.7.0.1)
|
parser (>= 2.7.1.1)
|
||||||
rainbow (>= 2.2.2, < 4.0)
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
regexp_parser (>= 1.7)
|
regexp_parser (>= 1.7)
|
||||||
rexml
|
rexml
|
||||||
rubocop-ast (>= 0.0.3, < 1.0)
|
rubocop-ast (>= 0.1.0, < 1.0)
|
||||||
ruby-progressbar (~> 1.7)
|
ruby-progressbar (~> 1.7)
|
||||||
unicode-display_width (>= 1.4.0, < 2.0)
|
unicode-display_width (>= 1.4.0, < 2.0)
|
||||||
rubocop-ast (0.0.3)
|
rubocop-ast (0.1.0)
|
||||||
parser (>= 2.7.0.1)
|
parser (>= 2.7.0.1)
|
||||||
rubocop-performance (1.6.1)
|
rubocop-performance (1.7.0)
|
||||||
rubocop (>= 0.71.0)
|
rubocop (>= 0.82.0)
|
||||||
rubocop-rails (2.6.0)
|
rubocop-rails (2.6.0)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
rack (>= 1.1)
|
rack (>= 1.1)
|
||||||
rubocop (>= 0.82.0)
|
rubocop (>= 0.82.0)
|
||||||
rubocop-rspec (1.40.0)
|
rubocop-rspec (1.41.0)
|
||||||
rubocop (>= 0.68.1)
|
rubocop (>= 0.68.1)
|
||||||
ruby-progressbar (1.10.1)
|
ruby-progressbar (1.10.1)
|
||||||
ruby-saml (1.10.2)
|
ruby-saml (1.10.2)
|
||||||
|
|
|
@ -61,7 +61,7 @@ class FormController < ApplicationController
|
||||||
Rails.logger.info "Can't verify email #{params[:email]}: #{message}"
|
Rails.logger.info "Can't verify email #{params[:email]}: #{message}"
|
||||||
|
|
||||||
# ignore 450, graylistings
|
# ignore 450, graylistings
|
||||||
errors['email'] = message if !message.match?(/450/)
|
errors['email'] = message if !message.include?('450')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ class ImportOtrsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
result = {}
|
result = {}
|
||||||
if response.body.match?(/zammad migrator/)
|
if response.body.include?('zammad migrator')
|
||||||
|
|
||||||
migrator_response = JSON.parse(response.body)
|
migrator_response = JSON.parse(response.body)
|
||||||
|
|
||||||
|
|
|
@ -22,9 +22,8 @@ module KnowledgeBaseRichTextHelper
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
||||||
def prepare_rich_text_videos(input)
|
def prepare_rich_text_videos(input)
|
||||||
|
|
|
@ -112,16 +112,16 @@ return all activity entries of an user
|
||||||
permission_ids = user.permissions_with_child_ids
|
permission_ids = user.permissions_with_child_ids
|
||||||
group_ids = user.group_ids_access('read')
|
group_ids = user.group_ids_access('read')
|
||||||
|
|
||||||
stream = if group_ids.blank?
|
if group_ids.blank?
|
||||||
ActivityStream.where('(permission_id IN (?) AND group_id IS NULL)', permission_ids)
|
ActivityStream.where('(permission_id IN (?) AND group_id IS NULL)', permission_ids)
|
||||||
.order(created_at: :desc)
|
.order(created_at: :desc)
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
else
|
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)
|
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)
|
.order(created_at: :desc)
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
end
|
end
|
||||||
stream
|
|
||||||
end
|
end
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
|
@ -239,7 +239,7 @@ example
|
||||||
timeout(FETCH_METADATA_TIMEOUT) do
|
timeout(FETCH_METADATA_TIMEOUT) do
|
||||||
message_meta = @imap.fetch(message_id, ['RFC822.SIZE', 'ENVELOPE', 'FLAGS', 'INTERNALDATE', 'RFC822.HEADER'])[0]
|
message_meta = @imap.fetch(message_id, ['RFC822.SIZE', 'ENVELOPE', 'FLAGS', 'INTERNALDATE', 'RFC822.HEADER'])[0]
|
||||||
rescue Net::IMAP::ResponseParseError => e
|
rescue Net::IMAP::ResponseParseError => e
|
||||||
raise if !e.message.match?(/unknown token/)
|
raise if !e.message.include?('unknown token')
|
||||||
|
|
||||||
result = 'error'
|
result = 'error'
|
||||||
notice += <<~NOTICE
|
notice += <<~NOTICE
|
||||||
|
|
|
@ -26,8 +26,8 @@ class Channel::Driver::Telegram
|
||||||
options = check_external_credential(options)
|
options = check_external_credential(options)
|
||||||
|
|
||||||
@client = Telegram.new(options[:auth][:api_key])
|
@client = Telegram.new(options[:auth][:api_key])
|
||||||
message = @client.from_article(article)
|
@client.from_article(article)
|
||||||
message
|
|
||||||
end
|
end
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
|
@ -78,10 +78,10 @@ returns
|
||||||
# fallback do sql query
|
# fallback do sql query
|
||||||
# - stip out * we already search for *query* -
|
# - stip out * we already search for *query* -
|
||||||
query.delete! '*'
|
query.delete! '*'
|
||||||
chat_sessions = Chat::Session.where(
|
Chat::Session.where(
|
||||||
'name LIKE ?', "%#{query}%"
|
'name LIKE ?', "%#{query}%"
|
||||||
).order('name').offset(offset).limit(limit).to_a
|
).order('name').offset(offset).limit(limit).to_a
|
||||||
chat_sessions
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -150,9 +150,8 @@ Checks if file is used inline
|
||||||
node['src'] = Rails.application.routes.url_helpers.attachment_path(attachment.id)
|
node['src'] = Rails.application.routes.url_helpers.attachment_path(attachment.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
parsed = Loofah.scrub_fragment(raw, scrubber).to_s
|
Loofah.scrub_fragment(raw, scrubber).to_s
|
||||||
|
|
||||||
parsed
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def has_rich_text_inline_cids(object, attr) # rubocop:disable Naming/PredicateName
|
def has_rich_text_inline_cids(object, attr) # rubocop:disable Naming/PredicateName
|
||||||
|
|
|
@ -118,13 +118,13 @@ return all online notifications of an object
|
||||||
|
|
||||||
def self.list_by_object(object_name, o_id)
|
def self.list_by_object(object_name, o_id)
|
||||||
object_id = ObjectLookup.by_name(object_name)
|
object_id = ObjectLookup.by_name(object_name)
|
||||||
notifications = OnlineNotification.where(
|
OnlineNotification.where(
|
||||||
object_lookup_id: object_id,
|
object_lookup_id: object_id,
|
||||||
o_id: o_id,
|
o_id: o_id,
|
||||||
)
|
)
|
||||||
.order(created_at: :desc)
|
.order(created_at: :desc)
|
||||||
.limit(10_000)
|
.limit(10_000)
|
||||||
notifications
|
|
||||||
end
|
end
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
|
@ -91,7 +91,7 @@ class Overview < ApplicationModel
|
||||||
local_link = name.downcase
|
local_link = name.downcase
|
||||||
local_link = local_link.parameterize(separator: '_')
|
local_link = local_link.parameterize(separator: '_')
|
||||||
local_link.gsub!(/\s/, '_')
|
local_link.gsub!(/\s/, '_')
|
||||||
local_link.gsub!(/_+/, '_')
|
local_link.squeeze!('_')
|
||||||
local_link = CGI.escape(local_link)
|
local_link = CGI.escape(local_link)
|
||||||
if local_link.blank?
|
if local_link.blank?
|
||||||
local_link = id || rand(999)
|
local_link = id || rand(999)
|
||||||
|
|
|
@ -64,7 +64,7 @@ install all packages located under auto_install/*.zpm
|
||||||
|
|
||||||
data = []
|
data = []
|
||||||
Dir.foreach(path) do |entry|
|
Dir.foreach(path) do |entry|
|
||||||
if entry =~ /\.zpm/ && entry !~ /^\./
|
if entry.include?('.zpm') && entry !~ /^\./
|
||||||
data.push entry
|
data.push entry
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -86,9 +86,9 @@ returns
|
||||||
def self.list(data)
|
def self.list(data)
|
||||||
# search
|
# search
|
||||||
store_object_id = Store::Object.lookup(name: data[:object])
|
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)
|
.order(created_at: :asc)
|
||||||
stores
|
|
||||||
end
|
end
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
|
@ -134,22 +134,22 @@ returns
|
||||||
# fallback do sql query
|
# fallback do sql query
|
||||||
# - stip out * we already search for *query* -
|
# - stip out * we already search for *query* -
|
||||||
query.delete! '*'
|
query.delete! '*'
|
||||||
users = if params[:role_ids]
|
if params[:role_ids]
|
||||||
User.joins(:roles).where('roles.id' => params[:role_ids]).where(
|
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}%"
|
'(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))
|
.order(Arel.sql(order_sql))
|
||||||
.offset(offset)
|
.offset(offset)
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
else
|
else
|
||||||
User.where(
|
User.where(
|
||||||
'(firstname LIKE ? OR lastname LIKE ? OR email LIKE ? OR login LIKE ?) AND id != 1', "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%"
|
'(firstname LIKE ? OR lastname LIKE ? OR email LIKE ? OR login LIKE ?) AND id != 1', "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%"
|
||||||
)
|
)
|
||||||
.order(Arel.sql(order_sql))
|
.order(Arel.sql(order_sql))
|
||||||
.offset(offset)
|
.offset(offset)
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
end
|
end
|
||||||
users
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# This file is used by Rack-based servers to start the application.
|
# 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
|
run Zammad::Application
|
||||||
|
|
||||||
# set config to do no self notification
|
# set config to do no self notification
|
||||||
|
|
|
@ -155,9 +155,9 @@ returns
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.file_location
|
def self.file_location
|
||||||
auto_wizard_file_name = 'auto_wizard.json'
|
auto_wizard_file_name = 'auto_wizard.json'
|
||||||
auto_wizard_file_location = Rails.root.join(auto_wizard_file_name)
|
Rails.root.join(auto_wizard_file_name)
|
||||||
auto_wizard_file_location
|
|
||||||
end
|
end
|
||||||
private_class_method :file_location
|
private_class_method :file_location
|
||||||
end
|
end
|
||||||
|
|
|
@ -106,7 +106,7 @@ returns
|
||||||
|
|
||||||
def self.provider(email, password)
|
def self.provider(email, password)
|
||||||
# check domain based attributes
|
# check domain based attributes
|
||||||
provider_map = {
|
{
|
||||||
google_imap: {
|
google_imap: {
|
||||||
domain: 'gmail|googlemail|google',
|
domain: 'gmail|googlemail|google',
|
||||||
inbound: {
|
inbound: {
|
||||||
|
@ -177,7 +177,7 @@ returns
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
provider_map
|
|
||||||
end
|
end
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
@ -274,7 +274,7 @@ returns
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def self.provider_inbound_guess(user, email, password, domain)
|
def self.provider_inbound_guess(user, email, password, domain)
|
||||||
inbound = [
|
[
|
||||||
{
|
{
|
||||||
adapter: 'imap',
|
adapter: 'imap',
|
||||||
options: {
|
options: {
|
||||||
|
@ -376,7 +376,7 @@ returns
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
inbound
|
|
||||||
end
|
end
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
@ -511,7 +511,7 @@ returns
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def self.provider_outbound_guess(user, email, password, domain)
|
def self.provider_outbound_guess(user, email, password, domain)
|
||||||
outbound = [
|
[
|
||||||
{
|
{
|
||||||
adapter: 'smtp',
|
adapter: 'smtp',
|
||||||
options: {
|
options: {
|
||||||
|
@ -593,7 +593,7 @@ returns
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
outbound
|
|
||||||
end
|
end
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
|
@ -66,27 +66,27 @@ class ExcelSheet::Ticket < ExcelSheet
|
||||||
header.push object
|
header.push object
|
||||||
end
|
end
|
||||||
|
|
||||||
header = header.concat([
|
header.concat([
|
||||||
{ display: 'Created At', name: 'created_at', width: 18, data_type: 'datetime' },
|
{ display: 'Created At', name: 'created_at', width: 18, data_type: 'datetime' },
|
||||||
{ display: 'Updated At', name: 'updated_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: '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 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 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: '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 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 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 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: '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 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 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: '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 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 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: '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: 'Article Count', name: 'article_count', width: 10, data_type: 'integer' },
|
||||||
{ display: 'Escalation At', name: 'escalation_at', width: 18, data_type: 'datetime' },
|
{ display: 'Escalation At', name: 'escalation_at', width: 18, data_type: 'datetime' },
|
||||||
])
|
])
|
||||||
header
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def gen_rows
|
def gen_rows
|
||||||
|
|
|
@ -779,7 +779,7 @@ generate url for index or document access (only for internal use)
|
||||||
# add * on simple query like "somephrase23"
|
# add * on simple query like "somephrase23"
|
||||||
def self.append_wildcard_to_simple_query(query)
|
def self.append_wildcard_to_simple_query(query)
|
||||||
query.strip!
|
query.strip!
|
||||||
query += '*' if !query.match?(/:/)
|
query += '*' if !query.include?(':')
|
||||||
query
|
query
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ class Sequencer
|
||||||
break if extractor.enough
|
break if extractor.enough
|
||||||
end
|
end
|
||||||
rescue NoMethodError => e
|
rescue NoMethodError => e
|
||||||
raise if !e.message.match?(/Viewpoint::EWS::/)
|
raise if !e.message.include?('Viewpoint::EWS::')
|
||||||
|
|
||||||
logger.error e
|
logger.error e
|
||||||
logger.error "Skipping folder_id '#{folder_id}' due to unsupported entries."
|
logger.error "Skipping folder_id '#{folder_id}' due to unsupported entries."
|
||||||
|
|
|
@ -42,7 +42,7 @@ class Service::GeoLocation::Gmaps
|
||||||
|
|
||||||
result = JSON.parse(response.body)
|
result = JSON.parse(response.body)
|
||||||
|
|
||||||
address = result['results'].first['address_components'].first['long_name']
|
result['results'].first['address_components'].first['long_name']
|
||||||
address
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
class Sessions::Backend::Base
|
class Sessions::Backend::Base
|
||||||
|
|
||||||
attr_writer :user
|
attr_writer :user, :time_now
|
||||||
attr_writer :time_now
|
|
||||||
|
|
||||||
def initialize(user, asset_lookup, client, client_id, ttl = 10)
|
def initialize(user, asset_lookup, client, client_id, ttl = 10)
|
||||||
@user = user
|
@user = user
|
||||||
|
|
|
@ -511,11 +511,7 @@ returns
|
||||||
|
|
||||||
class Result
|
class Result
|
||||||
|
|
||||||
attr_reader :error
|
attr_reader :error, :body, :data, :code, :content_type
|
||||||
attr_reader :body
|
|
||||||
attr_reader :data
|
|
||||||
attr_reader :code
|
|
||||||
attr_reader :content_type
|
|
||||||
|
|
||||||
def initialize(options)
|
def initialize(options)
|
||||||
@success = options[:success]
|
@success = options[:success]
|
||||||
|
|
|
@ -811,7 +811,7 @@ class TestCase < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
# it's not working stable with ff via selenium, use js
|
# 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)
|
log('set_ff_trigger_workaround', params)
|
||||||
instance.execute_script("$('#{params[:css]}').trigger('focusout')")
|
instance.execute_script("$('#{params[:css]}').trigger('focusout')")
|
||||||
end
|
end
|
||||||
|
@ -1024,7 +1024,7 @@ class TestCase < ActiveSupport::TestCase
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
element = instance.find_elements(css: params[:css])[0]
|
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)
|
dropdown = Selenium::WebDriver::Support::Select.new(element)
|
||||||
success = false
|
success = false
|
||||||
dropdown.selected_options&.each do |option|
|
dropdown.selected_options&.each do |option|
|
||||||
|
|
|
@ -23,9 +23,9 @@ class UserAgentTest < ActiveSupport::TestCase
|
||||||
assert_equal(true, result.success?)
|
assert_equal(true, result.success?)
|
||||||
assert_equal('200', result.code)
|
assert_equal('200', result.code)
|
||||||
assert_equal(String, result.body.class)
|
assert_equal(String, result.body.class)
|
||||||
assert(result.body =~ /"get"/)
|
assert(result.body.include?('"get"'))
|
||||||
assert(result.body =~ /"123"/)
|
assert(result.body.include?('"123"'))
|
||||||
assert(result.body =~ /"content_type_requested":null/)
|
assert(result.body.include?('"content_type_requested":null'))
|
||||||
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
|
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
|
||||||
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
|
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
|
||||||
end
|
end
|
||||||
|
@ -50,9 +50,9 @@ class UserAgentTest < ActiveSupport::TestCase
|
||||||
assert_equal(true, result.success?)
|
assert_equal(true, result.success?)
|
||||||
assert_equal('201', result.code)
|
assert_equal('201', result.code)
|
||||||
assert_equal(String, result.body.class)
|
assert_equal(String, result.body.class)
|
||||||
assert(result.body =~ /"post"/)
|
assert(result.body.include?('"post"'))
|
||||||
assert(result.body =~ /"some value"/)
|
assert(result.body.include?('"some value"'))
|
||||||
assert(result.body =~ %r{"application/x-www-form-urlencoded"})
|
assert(result.body.include?('"application/x-www-form-urlencoded"'))
|
||||||
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
|
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
|
||||||
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
|
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
|
||||||
end
|
end
|
||||||
|
@ -80,9 +80,9 @@ class UserAgentTest < ActiveSupport::TestCase
|
||||||
assert_equal(true, result.success?)
|
assert_equal(true, result.success?)
|
||||||
assert_equal('200', result.code)
|
assert_equal('200', result.code)
|
||||||
assert_equal(String, result.body.class)
|
assert_equal(String, result.body.class)
|
||||||
assert(result.body =~ /"put"/)
|
assert(result.body.include?('"put"'))
|
||||||
assert(result.body =~ /"some value"/)
|
assert(result.body.include?('"some value"'))
|
||||||
assert(result.body =~ %r{"application/x-www-form-urlencoded"})
|
assert(result.body.include?('"application/x-www-form-urlencoded"'))
|
||||||
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
|
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
|
||||||
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
|
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
|
||||||
end
|
end
|
||||||
|
@ -107,8 +107,8 @@ class UserAgentTest < ActiveSupport::TestCase
|
||||||
assert_equal(true, result.success?)
|
assert_equal(true, result.success?)
|
||||||
assert_equal('200', result.code)
|
assert_equal('200', result.code)
|
||||||
assert_equal(String, result.body.class)
|
assert_equal(String, result.body.class)
|
||||||
assert(result.body =~ /"delete"/)
|
assert(result.body.include?('"delete"'))
|
||||||
assert(result.body =~ /"content_type_requested":null/)
|
assert(result.body.include?('"content_type_requested":null'))
|
||||||
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
|
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
|
||||||
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
|
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
|
||||||
end
|
end
|
||||||
|
@ -137,9 +137,9 @@ class UserAgentTest < ActiveSupport::TestCase
|
||||||
assert_equal(true, result.success?)
|
assert_equal(true, result.success?)
|
||||||
assert_equal('200', result.code)
|
assert_equal('200', result.code)
|
||||||
assert_equal(String, result.body.class)
|
assert_equal(String, result.body.class)
|
||||||
assert(result.body =~ /"get"/)
|
assert(result.body.include?('"get"'))
|
||||||
assert(result.body =~ /"123"/)
|
assert(result.body.include?('"123"'))
|
||||||
assert(result.body =~ /"content_type_requested":null/)
|
assert(result.body.include?('"content_type_requested":null'))
|
||||||
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
|
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
|
||||||
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
|
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
|
||||||
end
|
end
|
||||||
|
@ -173,9 +173,9 @@ class UserAgentTest < ActiveSupport::TestCase
|
||||||
assert_equal(true, result.success?)
|
assert_equal(true, result.success?)
|
||||||
assert_equal('201', result.code)
|
assert_equal('201', result.code)
|
||||||
assert_equal(String, result.body.class)
|
assert_equal(String, result.body.class)
|
||||||
assert(result.body =~ /"post"/)
|
assert(result.body.include?('"post"'))
|
||||||
assert(result.body =~ /"some value"/)
|
assert(result.body.include?('"some value"'))
|
||||||
assert(result.body =~ %r{"application/x-www-form-urlencoded"})
|
assert(result.body.include?('"application/x-www-form-urlencoded"'))
|
||||||
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
|
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
|
||||||
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
|
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
|
||||||
end
|
end
|
||||||
|
@ -211,9 +211,9 @@ class UserAgentTest < ActiveSupport::TestCase
|
||||||
assert_equal(true, result.success?)
|
assert_equal(true, result.success?)
|
||||||
assert_equal('200', result.code)
|
assert_equal('200', result.code)
|
||||||
assert_equal(String, result.body.class)
|
assert_equal(String, result.body.class)
|
||||||
assert(result.body =~ /"put"/)
|
assert(result.body.include?('"put"'))
|
||||||
assert(result.body =~ /"some value"/)
|
assert(result.body.include?('"some value"'))
|
||||||
assert(result.body =~ %r{"application/x-www-form-urlencoded"})
|
assert(result.body.include?('"application/x-www-form-urlencoded"'))
|
||||||
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
|
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
|
||||||
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
|
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
|
||||||
end
|
end
|
||||||
|
@ -247,8 +247,8 @@ class UserAgentTest < ActiveSupport::TestCase
|
||||||
assert_equal(true, result.success?)
|
assert_equal(true, result.success?)
|
||||||
assert_equal('200', result.code)
|
assert_equal('200', result.code)
|
||||||
assert_equal(String, result.body.class)
|
assert_equal(String, result.body.class)
|
||||||
assert(result.body =~ /"delete"/)
|
assert(result.body.include?('"delete"'))
|
||||||
assert(result.body =~ /"content_type_requested":null/)
|
assert(result.body.include?('"content_type_requested":null'))
|
||||||
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
|
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
|
||||||
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
|
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
|
||||||
end
|
end
|
||||||
|
@ -279,9 +279,9 @@ class UserAgentTest < ActiveSupport::TestCase
|
||||||
assert_equal(true, result.success?)
|
assert_equal(true, result.success?)
|
||||||
assert_equal('200', result.code)
|
assert_equal('200', result.code)
|
||||||
assert_equal(String, result.body.class)
|
assert_equal(String, result.body.class)
|
||||||
assert(result.body =~ /"get"/)
|
assert(result.body.include?('"get"'))
|
||||||
assert(result.body =~ /"abc"/)
|
assert(result.body.include?('"abc"'))
|
||||||
assert(result.body =~ /"content_type_requested":null/)
|
assert(result.body.include?('"content_type_requested":null'))
|
||||||
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
|
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
|
||||||
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
|
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
|
||||||
end
|
end
|
||||||
|
@ -298,9 +298,9 @@ class UserAgentTest < ActiveSupport::TestCase
|
||||||
assert_equal(true, result.success?)
|
assert_equal(true, result.success?)
|
||||||
assert_equal('200', result.code)
|
assert_equal('200', result.code)
|
||||||
assert_equal(String, result.body.class)
|
assert_equal(String, result.body.class)
|
||||||
assert(result.body =~ /"get"/)
|
assert(result.body.include?('"get"'))
|
||||||
assert(result.body =~ /"abc"/)
|
assert(result.body.include?('"abc"'))
|
||||||
assert(result.body =~ /"content_type_requested":null/)
|
assert(result.body.include?('"content_type_requested":null'))
|
||||||
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
|
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
|
||||||
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
|
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
|
||||||
end
|
end
|
||||||
|
@ -330,9 +330,9 @@ class UserAgentTest < ActiveSupport::TestCase
|
||||||
assert_equal(true, result.success?)
|
assert_equal(true, result.success?)
|
||||||
assert_equal('200', result.code)
|
assert_equal('200', result.code)
|
||||||
assert_equal(String, result.body.class)
|
assert_equal(String, result.body.class)
|
||||||
assert(result.body =~ /"get"/)
|
assert(result.body.include?('"get"'))
|
||||||
assert(result.body =~ /"123"/)
|
assert(result.body.include?('"123"'))
|
||||||
assert(result.body =~ /"content_type_requested":null/)
|
assert(result.body.include?('"content_type_requested":null'))
|
||||||
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
|
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
|
||||||
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
|
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
|
||||||
end
|
end
|
||||||
|
@ -366,7 +366,7 @@ class UserAgentTest < ActiveSupport::TestCase
|
||||||
assert_equal(true, result.success?)
|
assert_equal(true, result.success?)
|
||||||
assert_equal('200', result.code)
|
assert_equal('200', result.code)
|
||||||
assert_equal(String, result.body.class)
|
assert_equal(String, result.body.class)
|
||||||
assert(result.body =~ /"GET"/)
|
assert(result.body.include?('"GET"'))
|
||||||
|
|
||||||
# get / 200 / gzip
|
# get / 200 / gzip
|
||||||
result = UserAgent.request(
|
result = UserAgent.request(
|
||||||
|
@ -376,7 +376,7 @@ class UserAgentTest < ActiveSupport::TestCase
|
||||||
assert_equal(true, result.success?)
|
assert_equal(true, result.success?)
|
||||||
assert_equal('200', result.code)
|
assert_equal('200', result.code)
|
||||||
assert_equal(String, result.body.class)
|
assert_equal(String, result.body.class)
|
||||||
assert(result.body =~ /"GET"/)
|
assert(result.body.include?('"GET"'))
|
||||||
|
|
||||||
# get / 200 / gzip
|
# get / 200 / gzip
|
||||||
result = UserAgent.request(
|
result = UserAgent.request(
|
||||||
|
@ -386,7 +386,7 @@ class UserAgentTest < ActiveSupport::TestCase
|
||||||
assert_equal(true, result.success?)
|
assert_equal(true, result.success?)
|
||||||
assert_equal('200', result.code)
|
assert_equal('200', result.code)
|
||||||
assert_equal(String, result.body.class)
|
assert_equal(String, result.body.class)
|
||||||
assert(result.body =~ /"GET"/)
|
assert(result.body.include?('"GET"'))
|
||||||
|
|
||||||
# get / 200 / gzip
|
# get / 200 / gzip
|
||||||
result = UserAgent.request(
|
result = UserAgent.request(
|
||||||
|
@ -396,7 +396,7 @@ class UserAgentTest < ActiveSupport::TestCase
|
||||||
assert_equal(true, result.success?)
|
assert_equal(true, result.success?)
|
||||||
assert_equal('200', result.code)
|
assert_equal('200', result.code)
|
||||||
assert_equal(String, result.body.class)
|
assert_equal(String, result.body.class)
|
||||||
assert(result.body =~ /"GET"/)
|
assert(result.body.include?('"GET"'))
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -473,8 +473,8 @@ class UserAgentTest < ActiveSupport::TestCase
|
||||||
assert_equal(true, result.success?)
|
assert_equal(true, result.success?)
|
||||||
assert_equal('200', result.code)
|
assert_equal('200', result.code)
|
||||||
assert_equal(String, result.body.class)
|
assert_equal(String, result.body.class)
|
||||||
assert(result.body =~ /"content_type_requested"/)
|
assert(result.body.include?('"content_type_requested"'))
|
||||||
assert(result.body =~ %r{"application/json"})
|
assert(result.body.include?('"application/json"'))
|
||||||
assert_equal('some value ', result.data['submitted']['key'])
|
assert_equal('some value ', result.data['submitted']['key'])
|
||||||
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
|
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
|
||||||
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
|
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(true, result.success?)
|
||||||
assert_equal('201', result.code)
|
assert_equal('201', result.code)
|
||||||
assert_equal(String, result.body.class)
|
assert_equal(String, result.body.class)
|
||||||
assert(result.body =~ /"content_type_requested"/)
|
assert(result.body.include?('"content_type_requested"'))
|
||||||
assert(result.body =~ %r{"application/json"})
|
assert(result.body.include?('"application/json"'))
|
||||||
assert_equal('some value ', result.data['submitted']['key'])
|
assert_equal('some value ', result.data['submitted']['key'])
|
||||||
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
|
if ENV['ZAMMAD_PROXY_TEST'] == 'true' && ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']
|
||||||
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
|
assert_match(/"remote_ip":"#{ENV['ZAMMAD_PROXY_REMOTE_IP_CHECK']}"/, result.body)
|
||||||
|
|
|
@ -65,7 +65,7 @@ class ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
count = 0
|
count = 0
|
||||||
lines.reverse_each do |line|
|
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?(/Send notification \(#{type}\)/)
|
||||||
next if !line.match?(/to:\s#{recipient}/)
|
next if !line.match?(/to:\s#{recipient}/)
|
||||||
|
|
||||||
|
|
|
@ -8,18 +8,18 @@ class EmailBuildTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
assert(result.start_with?('<!DOCTYPE'), 'test 1')
|
assert(result.start_with?('<!DOCTYPE'), 'test 1')
|
||||||
assert(result !~ /^.+?<!DOCTYPE/, 'test 1')
|
assert(result !~ /^.+?<!DOCTYPE/, 'test 1')
|
||||||
assert(result =~ /<html>/, 'test 1')
|
assert(result.include?('<html>'), 'test 1')
|
||||||
assert(result =~ /font-family/, 'test 1')
|
assert(result.include?('font-family'), 'test 1')
|
||||||
assert(result =~ %r{<b>test</b>}, 'test 1')
|
assert(result.include?('<b>test</b>'), 'test 1')
|
||||||
|
|
||||||
html = 'invalid <!DOCTYPE html><html><b>test</b></html>'
|
html = 'invalid <!DOCTYPE html><html><b>test</b></html>'
|
||||||
result = Channel::EmailBuild.html_complete_check(html)
|
result = Channel::EmailBuild.html_complete_check(html)
|
||||||
|
|
||||||
assert(result !~ /^<!DOCTYPE/, 'test 2')
|
assert(result !~ /^<!DOCTYPE/, 'test 2')
|
||||||
assert(result =~ /^.+?<!DOCTYPE/, 'test 2')
|
assert(result =~ /^.+?<!DOCTYPE/, 'test 2')
|
||||||
assert(result =~ /<html>/, 'test 2')
|
assert(result.include?('<html>'), 'test 2')
|
||||||
assert(result !~ /font-family/, 'test 2')
|
assert(result !~ /font-family/, 'test 2')
|
||||||
assert(result =~ %r{<b>test</b>}, 'test 2')
|
assert(result.include?('<b>test</b>'), 'test 2')
|
||||||
|
|
||||||
# Issue #1230, missing backslashes
|
# Issue #1230, missing backslashes
|
||||||
# 'Test URL: \\storage\project\100242-Inc'
|
# 'Test URL: \\storage\project\100242-Inc'
|
||||||
|
|
Loading…
Reference in a new issue