Replace unless with if ! (project-wide)
This commit is contained in:
parent
b79a76d6f8
commit
04055f7095
31 changed files with 42 additions and 58 deletions
|
@ -36,7 +36,7 @@ module CreatesTicketArticles
|
||||||
clean_params.delete(:sender)
|
clean_params.delete(:sender)
|
||||||
clean_params.delete(:origin_by_id)
|
clean_params.delete(:origin_by_id)
|
||||||
type = Ticket::Article::Type.lookup(id: clean_params[:type_id])
|
type = Ticket::Article::Type.lookup(id: clean_params[:type_id])
|
||||||
unless type.name.match?(/^(note|web)$/)
|
if !type.name.match?(/^(note|web)$/)
|
||||||
clean_params[:type_id] = Ticket::Article::Type.lookup(name: 'note').id
|
clean_params[:type_id] = Ticket::Article::Type.lookup(name: 'note').id
|
||||||
end
|
end
|
||||||
clean_params.delete(:type)
|
clean_params.delete(:type)
|
||||||
|
@ -89,7 +89,7 @@ module CreatesTicketArticles
|
||||||
preferences[store_key] = attachment[key]
|
preferences[store_key] = attachment[key]
|
||||||
end
|
end
|
||||||
|
|
||||||
unless attachment[:data].match?(%r{^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$})
|
if !attachment[:data].match?(%r{^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$})
|
||||||
raise Exceptions::UnprocessableEntity, "Invalid base64 for attachment with index '#{index}'"
|
raise Exceptions::UnprocessableEntity, "Invalid base64 for attachment with index '#{index}'"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -67,9 +67,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
|
||||||
unless message.match?(/450/)
|
errors['email'] = message if !message.match?(/450/)
|
||||||
errors['email'] = message
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ class ImportZendeskController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
# since 2016-10-15 a redirect to a marketing page has been implemented
|
# since 2016-10-15 a redirect to a marketing page has been implemented
|
||||||
unless response.body.match?(/#{params[:url]}/)
|
if !response.body.match?(/#{params[:url]}/)
|
||||||
render json: {
|
render json: {
|
||||||
result: 'invalid',
|
result: 'invalid',
|
||||||
message_human: 'Hostname not found!',
|
message_human: 'Hostname not found!',
|
||||||
|
|
|
@ -13,7 +13,7 @@ class Integration::SipgateController < ApplicationController
|
||||||
|
|
||||||
# check if call need to be blocked
|
# check if call need to be blocked
|
||||||
block_caller_ids.each do |item|
|
block_caller_ids.each do |item|
|
||||||
next unless item[:caller_id] == params['from']
|
next if item[:caller_id] != params['from']
|
||||||
xml = Builder::XmlMarkup.new(indent: 2)
|
xml = Builder::XmlMarkup.new(indent: 2)
|
||||||
xml.instruct!
|
xml.instruct!
|
||||||
content = xml.Response(onHangup: url, onAnswer: url) do
|
content = xml.Response(onHangup: url, onAnswer: url) do
|
||||||
|
|
|
@ -45,7 +45,7 @@ class SettingsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
# validate image
|
# validate image
|
||||||
unless clean_params[:logo].match?(/^data:image/i)
|
if !clean_params[:logo].match?(/^data:image/i)
|
||||||
render json: {
|
render json: {
|
||||||
result: 'invalid',
|
result: 'invalid',
|
||||||
message: 'Invalid payload, need data:image in logo param',
|
message: 'Invalid payload, need data:image in logo param',
|
||||||
|
|
|
@ -376,7 +376,7 @@ returns
|
||||||
next if !assoc_name.to_s.end_with?('s')
|
next if !assoc_name.to_s.end_with?('s')
|
||||||
ref_names = "#{assoc_name.to_s.chomp('s')}_ids"
|
ref_names = "#{assoc_name.to_s.chomp('s')}_ids"
|
||||||
generic_object_tmp = new
|
generic_object_tmp = new
|
||||||
next unless generic_object_tmp.respond_to?(ref_names) # if we do have an _ids attribute
|
next if !generic_object_tmp.respond_to?(ref_names) # if we do have an _ids attribute
|
||||||
next if data[ref_names.to_sym] # next if we have already the _ids filled
|
next if data[ref_names.to_sym] # next if we have already the _ids filled
|
||||||
|
|
||||||
# get association class and do lookup
|
# get association class and do lookup
|
||||||
|
|
|
@ -91,7 +91,7 @@ returns
|
||||||
next if !mail
|
next if !mail
|
||||||
|
|
||||||
# check how many content messages we have, for notice used
|
# check how many content messages we have, for notice used
|
||||||
unless mail.match?(/x-zammad-ignore/i)
|
if !mail.match?(/x-zammad-ignore/i)
|
||||||
content_messages += 1
|
content_messages += 1
|
||||||
break if content_max_check < content_messages
|
break if content_max_check < content_messages
|
||||||
end
|
end
|
||||||
|
|
|
@ -863,7 +863,7 @@ module Mail
|
||||||
module Encodings
|
module Encodings
|
||||||
def self.value_decode(str)
|
def self.value_decode(str)
|
||||||
# Optimization: If there's no encoded-words in the string, just return it
|
# Optimization: If there's no encoded-words in the string, just return it
|
||||||
return str unless str.index('=?')
|
return str if !str.index('=?')
|
||||||
|
|
||||||
str = str.gsub(/\?=(\s*)=\?/, '?==?') # Remove whitespaces between 'encoded-word's
|
str = str.gsub(/\?=(\s*)=\?/, '?==?') # Remove whitespaces between 'encoded-word's
|
||||||
|
|
||||||
|
|
|
@ -144,13 +144,9 @@ module Channel::Filter::IdentifySender
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.user_create(data, role_ids = nil)
|
def self.user_create(data, role_ids = nil)
|
||||||
unless data[:email].match?(/@/)
|
data[:email] += '@local' if !data[:email].match?(/@/)
|
||||||
data[:email] += '@local'
|
user = User.find_by(email: data[:email].downcase) ||
|
||||||
end
|
User.find_by(login: data[:email].downcase)
|
||||||
user = User.find_by(email: data[:email].downcase)
|
|
||||||
if !user
|
|
||||||
user = User.find_by(login: data[:email].downcase)
|
|
||||||
end
|
|
||||||
|
|
||||||
# check if firstname or lastname need to be updated
|
# check if firstname or lastname need to be updated
|
||||||
if user
|
if user
|
||||||
|
|
|
@ -296,7 +296,7 @@ returns
|
||||||
row.push record[key]
|
row.push record[key]
|
||||||
end
|
end
|
||||||
rows.push row
|
rows.push row
|
||||||
next unless rows_to_add.count.positive?
|
next if rows_to_add.count.zero?
|
||||||
rows_to_add.each do |item|
|
rows_to_add.each do |item|
|
||||||
rows.push item
|
rows.push item
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,7 +7,6 @@ class History < ApplicationModel
|
||||||
belongs_to :history_type, class_name: 'History::Type'
|
belongs_to :history_type, class_name: 'History::Type'
|
||||||
belongs_to :history_object, class_name: 'History::Object'
|
belongs_to :history_object, class_name: 'History::Object'
|
||||||
belongs_to :history_attribute, class_name: 'History::Attribute'
|
belongs_to :history_attribute, class_name: 'History::Attribute'
|
||||||
# rubocop:enable Rails/InverseOf
|
|
||||||
|
|
||||||
# the noop is needed since Layout/EmptyLines detects
|
# the noop is needed since Layout/EmptyLines detects
|
||||||
# the block commend below wrongly as the measurement of
|
# the block commend below wrongly as the measurement of
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
class Link < ApplicationModel
|
class Link < ApplicationModel
|
||||||
belongs_to :link_type, class_name: 'Link::Type'
|
belongs_to :link_type, class_name: 'Link::Type'
|
||||||
belongs_to :link_object, class_name: 'Link::Object'
|
belongs_to :link_object, class_name: 'Link::Object'
|
||||||
# rubocop:enable Rails/InverseOf
|
|
||||||
|
|
||||||
after_destroy :touch_link_references
|
after_destroy :touch_link_references
|
||||||
|
|
||||||
|
|
|
@ -756,7 +756,7 @@ to send no browser reload event, pass false
|
||||||
if !data_type
|
if !data_type
|
||||||
raise 'Need data_type param'
|
raise 'Need data_type param'
|
||||||
end
|
end
|
||||||
unless data_type.match?(/^(input|user_autocompletion|checkbox|select|tree_select|datetime|date|tag|richtext|textarea|integer|autocompletion_ajax|boolean|user_permission|active)$/)
|
if !data_type.match?(/^(input|user_autocompletion|checkbox|select|tree_select|datetime|date|tag|richtext|textarea|integer|autocompletion_ajax|boolean|user_permission|active)$/)
|
||||||
raise "Invalid data_type param '#{data_type}'"
|
raise "Invalid data_type param '#{data_type}'"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ class Organization < ApplicationModel
|
||||||
include Organization::Search
|
include Organization::Search
|
||||||
include Organization::SearchIndex
|
include Organization::SearchIndex
|
||||||
has_many :members, class_name: 'User'
|
has_many :members, class_name: 'User'
|
||||||
# rubocop:enable Rails/InverseOf
|
|
||||||
|
|
||||||
before_create :domain_cleanup
|
before_create :domain_cleanup
|
||||||
before_update :domain_cleanup
|
before_update :domain_cleanup
|
||||||
|
|
|
@ -153,7 +153,7 @@ returns
|
||||||
permission = Permission.lookup(id: permission_id)
|
permission = Permission.lookup(id: permission_id)
|
||||||
raise "Unable to find permission for id #{permission_id}" if !permission
|
raise "Unable to find permission for id #{permission_id}" if !permission
|
||||||
raise "Permission #{permission.name} is disabled" if permission.preferences[:disabled] == true
|
raise "Permission #{permission.name} is disabled" if permission.preferences[:disabled] == true
|
||||||
next unless permission.preferences[:not]
|
next if !permission.preferences[:not]
|
||||||
permission.preferences[:not].each do |local_permission_name|
|
permission.preferences[:not].each do |local_permission_name|
|
||||||
local_permission = Permission.lookup(name: local_permission_name)
|
local_permission = Permission.lookup(name: local_permission_name)
|
||||||
next if !local_permission
|
next if !local_permission
|
||||||
|
|
|
@ -6,7 +6,6 @@ require_dependency 'store/file'
|
||||||
class Store < ApplicationModel
|
class Store < ApplicationModel
|
||||||
belongs_to :store_object, class_name: 'Store::Object'
|
belongs_to :store_object, class_name: 'Store::Object'
|
||||||
belongs_to :store_file, class_name: 'Store::File'
|
belongs_to :store_file, class_name: 'Store::File'
|
||||||
# rubocop:enable Rails/InverseOf
|
|
||||||
|
|
||||||
validates :filename, presence: true
|
validates :filename, presence: true
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
class Tag < ApplicationModel
|
class Tag < ApplicationModel
|
||||||
belongs_to :tag_object, class_name: 'Tag::Object'
|
belongs_to :tag_object, class_name: 'Tag::Object'
|
||||||
belongs_to :tag_item, class_name: 'Tag::Item'
|
belongs_to :tag_item, class_name: 'Tag::Item'
|
||||||
# rubocop:enable Rails/InverseOf
|
|
||||||
|
|
||||||
# the noop is needed since Layout/EmptyLines detects
|
# the noop is needed since Layout/EmptyLines detects
|
||||||
# the block commend below wrongly as the measurement of
|
# the block commend below wrongly as the measurement of
|
||||||
|
|
|
@ -65,7 +65,6 @@ class Ticket < ApplicationModel
|
||||||
belongs_to :updated_by, class_name: 'User'
|
belongs_to :updated_by, class_name: 'User'
|
||||||
belongs_to :create_article_type, class_name: 'Ticket::Article::Type'
|
belongs_to :create_article_type, class_name: 'Ticket::Article::Type'
|
||||||
belongs_to :create_article_sender, class_name: 'Ticket::Article::Sender'
|
belongs_to :create_article_sender, class_name: 'Ticket::Article::Sender'
|
||||||
# rubocop:enable Rails/InverseOf
|
|
||||||
|
|
||||||
self.inheritance_column = nil
|
self.inheritance_column = nil
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ class Ticket::Article < ApplicationModel
|
||||||
belongs_to :created_by, class_name: 'User'
|
belongs_to :created_by, class_name: 'User'
|
||||||
belongs_to :updated_by, class_name: 'User'
|
belongs_to :updated_by, class_name: 'User'
|
||||||
belongs_to :origin_by, class_name: 'User'
|
belongs_to :origin_by, class_name: 'User'
|
||||||
# rubocop:enable Rails/InverseOf
|
|
||||||
|
|
||||||
before_create :check_subject, :check_body, :check_message_id_md5
|
before_create :check_subject, :check_body, :check_message_id_md5
|
||||||
before_update :check_subject, :check_body, :check_message_id_md5
|
before_update :check_subject, :check_body, :check_message_id_md5
|
||||||
|
|
|
@ -4,7 +4,6 @@ class Ticket::State < ApplicationModel
|
||||||
|
|
||||||
belongs_to :state_type, class_name: 'Ticket::StateType', inverse_of: :states
|
belongs_to :state_type, class_name: 'Ticket::StateType', inverse_of: :states
|
||||||
belongs_to :next_state, class_name: 'Ticket::State'
|
belongs_to :next_state, class_name: 'Ticket::State'
|
||||||
# rubocop:enable Rails/InverseOf
|
|
||||||
|
|
||||||
after_create :ensure_defaults
|
after_create :ensure_defaults
|
||||||
after_update :ensure_defaults
|
after_update :ensure_defaults
|
||||||
|
|
|
@ -362,7 +362,7 @@ Get source file at https://i18n.zammad.com/api/v1/translations_empty_translation
|
||||||
translation_raw.each_key do |key|
|
translation_raw.each_key do |key|
|
||||||
|
|
||||||
# if translation target has changes
|
# if translation target has changes
|
||||||
next unless translation_raw[key] != translation.target
|
next if translation_raw[key] == translation.target
|
||||||
|
|
||||||
# do not update translations which are already changed by user
|
# do not update translations which are already changed by user
|
||||||
if translation.target == translation.target_initial
|
if translation.target == translation.target_initial
|
||||||
|
|
|
@ -3,8 +3,8 @@ class Issue1219ZhtwLocaleTypo < ActiveRecord::Migration[5.1]
|
||||||
APPLICABLE_VERSION = Gem::Version.new('2.5.0')
|
APPLICABLE_VERSION = Gem::Version.new('2.5.0')
|
||||||
|
|
||||||
def up
|
def up
|
||||||
return unless Setting.find_by(name: 'system_init_done')
|
return if !Setting.find_by(name: 'system_init_done')
|
||||||
return unless CURRENT_VERSION >= APPLICABLE_VERSION
|
return if CURRENT_VERSION < APPLICABLE_VERSION
|
||||||
|
|
||||||
if Locale.exists?(locale: 'zh-tw')
|
if Locale.exists?(locale: 'zh-tw')
|
||||||
Locale.find_by(locale: 'zj-tw')&.destroy
|
Locale.find_by(locale: 'zj-tw')&.destroy
|
||||||
|
@ -20,8 +20,8 @@ class Issue1219ZhtwLocaleTypo < ActiveRecord::Migration[5.1]
|
||||||
end
|
end
|
||||||
|
|
||||||
def down
|
def down
|
||||||
return unless Setting.find_by(name: 'system_init_done')
|
return if !Setting.find_by(name: 'system_init_done')
|
||||||
return unless CURRENT_VERSION < APPLICABLE_VERSION
|
return if CURRENT_VERSION >= APPLICABLE_VERSION
|
||||||
|
|
||||||
if Locale.exists?(locale: 'zj-tw')
|
if Locale.exists?(locale: 'zj-tw')
|
||||||
Locale.find_by(locale: 'zh-tw')&.destroy
|
Locale.find_by(locale: 'zh-tw')&.destroy
|
||||||
|
|
|
@ -15,7 +15,7 @@ module Net
|
||||||
check_response critical { recv_response() }
|
check_response critical { recv_response() }
|
||||||
do_helo helo_domain
|
do_helo helo_domain
|
||||||
if starttls_always? or (capable_starttls? and starttls_auto?)
|
if starttls_always? or (capable_starttls? and starttls_auto?)
|
||||||
unless capable_starttls?
|
if !capable_starttls?
|
||||||
raise SMTPUnsupportedCommand,
|
raise SMTPUnsupportedCommand,
|
||||||
"STARTTLS is not supported on this server"
|
"STARTTLS is not supported on this server"
|
||||||
end
|
end
|
||||||
|
@ -45,7 +45,7 @@ module Net
|
||||||
authenticate user, secret, (authtype || DEFAULT_AUTH_TYPE) if user
|
authenticate user, secret, (authtype || DEFAULT_AUTH_TYPE) if user
|
||||||
@started = true
|
@started = true
|
||||||
ensure
|
ensure
|
||||||
unless @started
|
if !@started
|
||||||
# authentication failed, cancel connection.
|
# authentication failed, cancel connection.
|
||||||
s.close if s and not s.closed?
|
s.close if s and not s.closed?
|
||||||
@socket = nil
|
@socket = nil
|
||||||
|
@ -53,4 +53,4 @@ module Net
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# rubocop:enable all
|
# rubocop:enable all
|
||||||
|
|
|
@ -134,9 +134,7 @@ satinize html string based on whiltelist
|
||||||
value = node[key]
|
value = node[key]
|
||||||
node.delete(key)
|
node.delete(key)
|
||||||
next if value.blank?
|
next if value.blank?
|
||||||
unless value.match?(/%|px|em/i)
|
value += 'px' if !value.match?(/%|px|em/i)
|
||||||
value += 'px'
|
|
||||||
end
|
|
||||||
node['style'] += "#{key}:#{value}"
|
node['style'] += "#{key}:#{value}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -394,7 +394,7 @@ returns
|
||||||
last_width = file['width'].to_i
|
last_width = file['width'].to_i
|
||||||
last_height = file['height'].to_i
|
last_height = file['height'].to_i
|
||||||
end
|
end
|
||||||
next unless file['width'].to_i < max_width && last_width < file['width'].to_i
|
next if file['width'].to_i >= max_width || file['width'].to_i <= last_width
|
||||||
photo = file
|
photo = file
|
||||||
last_width = file['width'].to_i
|
last_width = file['width'].to_i
|
||||||
last_height = file['height'].to_i
|
last_height = file['height'].to_i
|
||||||
|
|
|
@ -457,7 +457,7 @@ returns
|
||||||
else
|
else
|
||||||
ftp.login
|
ftp.login
|
||||||
end
|
end
|
||||||
ftp.chdir(remote_dir) unless remote_dir == '.'
|
ftp.chdir(remote_dir) if remote_dir != '.'
|
||||||
|
|
||||||
begin
|
begin
|
||||||
ftp.getbinaryfile(filename, temp_file)
|
ftp.getbinaryfile(filename, temp_file)
|
||||||
|
|
|
@ -25,7 +25,7 @@ def before_fork
|
||||||
# remember open file handles
|
# remember open file handles
|
||||||
@files_to_reopen = []
|
@files_to_reopen = []
|
||||||
ObjectSpace.each_object(File) do |file|
|
ObjectSpace.each_object(File) do |file|
|
||||||
@files_to_reopen << file unless file.closed?
|
@files_to_reopen << file if !file.closed?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ def before_fork
|
||||||
# remember open file handles
|
# remember open file handles
|
||||||
@files_to_reopen = []
|
@files_to_reopen = []
|
||||||
ObjectSpace.each_object(File) do |file|
|
ObjectSpace.each_object(File) do |file|
|
||||||
@files_to_reopen << file unless file.closed?
|
@files_to_reopen << file if !file.closed?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ class AgentTicketTagTest < TestCase
|
||||||
css: '.active .newTicket button.js-submit',
|
css: '.active .newTicket button.js-submit',
|
||||||
)
|
)
|
||||||
sleep 5
|
sleep 5
|
||||||
unless @browser.current_url.match?(/#{Regexp.quote('#ticket/zoom/')}/)
|
if !@browser.current_url.match?(/#{Regexp.quote('#ticket/zoom/')}/)
|
||||||
raise 'Unable to create ticket!'
|
raise 'Unable to create ticket!'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ class AgentTicketTagTest < TestCase
|
||||||
click(css: '#global-search')
|
click(css: '#global-search')
|
||||||
click(css: '.active .newTicket button.js-submit')
|
click(css: '.active .newTicket button.js-submit')
|
||||||
sleep 5
|
sleep 5
|
||||||
unless @browser.current_url.match?(/#{Regexp.quote('#ticket/zoom/')}/)
|
if !@browser.current_url.match?(/#{Regexp.quote('#ticket/zoom/')}/)
|
||||||
raise 'Unable to create ticket!'
|
raise 'Unable to create ticket!'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -428,7 +428,7 @@ class AgentTicketTagTest < TestCase
|
||||||
css: '.active .newTicket button.js-submit',
|
css: '.active .newTicket button.js-submit',
|
||||||
)
|
)
|
||||||
sleep 5
|
sleep 5
|
||||||
unless @browser.current_url.match?(/#{Regexp.quote('#ticket/zoom/')}/)
|
if !@browser.current_url.match?(/#{Regexp.quote('#ticket/zoom/')}/)
|
||||||
raise 'Unable to create ticket!'
|
raise 'Unable to create ticket!'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
browser_width = ENV['BROWSER_WIDTH'] || 1024
|
browser_width = ENV['BROWSER_WIDTH'] || 1024
|
||||||
browser_height = ENV['BROWSER_HEIGHT'] || 800
|
browser_height = ENV['BROWSER_HEIGHT'] || 800
|
||||||
local_browser.manage.window.resize_to(browser_width, browser_height)
|
local_browser.manage.window.resize_to(browser_width, browser_height)
|
||||||
unless ENV['REMOTE_URL']&.match?(/saucelabs|(grid|ci)\.(zammad\.org|znuny\.com)/i)
|
if !ENV['REMOTE_URL']&.match?(/saucelabs|(grid|ci)\.(zammad\.org|znuny\.com)/i)
|
||||||
if @browsers.count == 1
|
if @browsers.count == 1
|
||||||
local_browser.manage.window.move_to(0, 0)
|
local_browser.manage.window.move_to(0, 0)
|
||||||
else
|
else
|
||||||
|
@ -362,7 +362,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
instance = params[:browser] || @browser
|
instance = params[:browser] || @browser
|
||||||
sleep 0.7
|
sleep 0.7
|
||||||
current_url = instance.current_url
|
current_url = instance.current_url
|
||||||
unless current_url.match?(/#{Regexp.quote(params[:url])}/)
|
if !current_url.match?(/#{Regexp.quote(params[:url])}/)
|
||||||
screenshot(browser: instance, comment: 'location_check_failed')
|
screenshot(browser: instance, comment: 'location_check_failed')
|
||||||
raise "url #{current_url} is not matching #{params[:url]}"
|
raise "url #{current_url} is not matching #{params[:url]}"
|
||||||
end
|
end
|
||||||
|
@ -1352,7 +1352,7 @@ wait untill text in selector disabppears
|
||||||
if params[:value]
|
if params[:value]
|
||||||
begin
|
begin
|
||||||
text = instance.find_elements(css: params[:css])[0].text
|
text = instance.find_elements(css: params[:css])[0].text
|
||||||
unless text.match?(/#{params[:value]}/i)
|
if !text.match?(/#{params[:value]}/i)
|
||||||
assert(true, "not matching '#{params[:value]}' in text '#{text}'")
|
assert(true, "not matching '#{params[:value]}' in text '#{text}'")
|
||||||
sleep 1
|
sleep 1
|
||||||
return true
|
return true
|
||||||
|
@ -2427,7 +2427,7 @@ wait untill text in selector disabppears
|
||||||
element.click
|
element.click
|
||||||
sleep 1
|
sleep 1
|
||||||
number = instance.find_elements(css: '.content.active .ticketZoom-header .ticket-number')[0].text
|
number = instance.find_elements(css: '.content.active .ticketZoom-header .ticket-number')[0].text
|
||||||
unless number.match?(/#{params[:number]}/)
|
if !number.match?(/#{params[:number]}/)
|
||||||
screenshot(browser: instance, comment: 'ticket_open_by_overview_open_failed_failed')
|
screenshot(browser: instance, comment: 'ticket_open_by_overview_open_failed_failed')
|
||||||
raise "unable to open ticket #{params[:number]}!"
|
raise "unable to open ticket #{params[:number]}!"
|
||||||
end
|
end
|
||||||
|
@ -2473,7 +2473,7 @@ wait untill text in selector disabppears
|
||||||
instance.execute_script("$(\".js-global-search-result a:contains('#{params[:number]}') .nav-tab-icon\").first().click()")
|
instance.execute_script("$(\".js-global-search-result a:contains('#{params[:number]}') .nav-tab-icon\").first().click()")
|
||||||
sleep 1
|
sleep 1
|
||||||
number = instance.find_elements(css: '.content.active .ticketZoom-header .ticket-number')[0].text
|
number = instance.find_elements(css: '.content.active .ticketZoom-header .ticket-number')[0].text
|
||||||
unless number.match?(/#{params[:number]}/)
|
if !number.match?(/#{params[:number]}/)
|
||||||
screenshot(browser: instance, comment: 'ticket_open_by_search_failed')
|
screenshot(browser: instance, comment: 'ticket_open_by_search_failed')
|
||||||
raise "unable to search/find ticket #{params[:number]}!"
|
raise "unable to search/find ticket #{params[:number]}!"
|
||||||
end
|
end
|
||||||
|
@ -2509,7 +2509,7 @@ wait untill text in selector disabppears
|
||||||
instance.execute_script("$(\".js-global-search-result a:contains('#{params[:title]}') .nav-tab-icon\").click()")
|
instance.execute_script("$(\".js-global-search-result a:contains('#{params[:title]}') .nav-tab-icon\").click()")
|
||||||
sleep 1
|
sleep 1
|
||||||
title = instance.find_elements(css: '.content.active .ticketZoom-header .js-objectTitle')[0].text
|
title = instance.find_elements(css: '.content.active .ticketZoom-header .js-objectTitle')[0].text
|
||||||
unless title.match?(/#{params[:title]}/)
|
if !title.match?(/#{params[:title]}/)
|
||||||
screenshot(browser: instance, comment: 'ticket_open_by_title_failed')
|
screenshot(browser: instance, comment: 'ticket_open_by_title_failed')
|
||||||
raise "unable to search/find ticket #{params[:title]}!"
|
raise "unable to search/find ticket #{params[:title]}!"
|
||||||
end
|
end
|
||||||
|
@ -2597,7 +2597,7 @@ wait untill text in selector disabppears
|
||||||
instance.execute_script("$(\".js-global-search-result a:contains('#{params[:value]}') .nav-tab-icon\").click()")
|
instance.execute_script("$(\".js-global-search-result a:contains('#{params[:value]}') .nav-tab-icon\").click()")
|
||||||
sleep 1
|
sleep 1
|
||||||
name = instance.find_elements(css: '.content.active h1')[0].text
|
name = instance.find_elements(css: '.content.active h1')[0].text
|
||||||
unless name.match?(/#{params[:value]}/)
|
if !name.match?(/#{params[:value]}/)
|
||||||
screenshot(browser: instance, comment: 'organization_open_by_search_failed')
|
screenshot(browser: instance, comment: 'organization_open_by_search_failed')
|
||||||
raise "unable to search/find org #{params[:value]}!"
|
raise "unable to search/find org #{params[:value]}!"
|
||||||
end
|
end
|
||||||
|
@ -2632,7 +2632,7 @@ wait untill text in selector disabppears
|
||||||
instance.execute_script("$(\".js-global-search-result a:contains('#{params[:value]}') .nav-tab-icon\").click()")
|
instance.execute_script("$(\".js-global-search-result a:contains('#{params[:value]}') .nav-tab-icon\").click()")
|
||||||
sleep 1
|
sleep 1
|
||||||
name = instance.find_elements(css: '.content.active h1')[0].text
|
name = instance.find_elements(css: '.content.active h1')[0].text
|
||||||
unless name.match?(/#{params[:value]}/)
|
if !name.match?(/#{params[:value]}/)
|
||||||
screenshot(browser: instance, comment: 'user_open_by_search_failed')
|
screenshot(browser: instance, comment: 'user_open_by_search_failed')
|
||||||
raise "unable to search/find user #{params[:value]}!"
|
raise "unable to search/find user #{params[:value]}!"
|
||||||
end
|
end
|
||||||
|
|
|
@ -55,7 +55,7 @@ class AutoWizardTest < ActiveSupport::TestCase
|
||||||
assert_equal(local_user[:lastname], user.lastname)
|
assert_equal(local_user[:lastname], user.lastname)
|
||||||
assert_equal(local_user[:email], user.email)
|
assert_equal(local_user[:email], user.email)
|
||||||
assert_equal(local_user[:roles].count, user.role_ids.count)
|
assert_equal(local_user[:roles].count, user.role_ids.count)
|
||||||
next unless local_user[:roles]
|
next if !local_user[:roles]
|
||||||
local_user[:roles].each do |local_role_name|
|
local_user[:roles].each do |local_role_name|
|
||||||
local_role = Role.find_by(name: local_role_name)
|
local_role = Role.find_by(name: local_role_name)
|
||||||
assert(user.role_ids.include?(local_role.id))
|
assert(user.role_ids.include?(local_role.id))
|
||||||
|
@ -64,7 +64,7 @@ class AutoWizardTest < ActiveSupport::TestCase
|
||||||
auto_wizard_data[:Groups].each do |local_group|
|
auto_wizard_data[:Groups].each do |local_group|
|
||||||
group = Group.find_by(name: local_group[:name])
|
group = Group.find_by(name: local_group[:name])
|
||||||
assert_equal(local_group[:name], group.name)
|
assert_equal(local_group[:name], group.name)
|
||||||
next unless local_group[:users]
|
next if !local_group[:users]
|
||||||
local_group[:users].each do |local_user_login|
|
local_group[:users].each do |local_user_login|
|
||||||
local_user = User.find_by(login: local_user_login)
|
local_user = User.find_by(login: local_user_login)
|
||||||
assert(group.user_ids.include?(local_user.id))
|
assert(group.user_ids.include?(local_user.id))
|
||||||
|
@ -193,7 +193,7 @@ class AutoWizardTest < ActiveSupport::TestCase
|
||||||
assert_equal(local_user[:firstname], user.firstname)
|
assert_equal(local_user[:firstname], user.firstname)
|
||||||
assert_equal(local_user[:lastname], user.lastname)
|
assert_equal(local_user[:lastname], user.lastname)
|
||||||
assert_equal(local_user[:email], user.email)
|
assert_equal(local_user[:email], user.email)
|
||||||
next unless local_user[:roles]
|
next if !local_user[:roles]
|
||||||
assert_equal(local_user[:roles].count, user.role_ids.count)
|
assert_equal(local_user[:roles].count, user.role_ids.count)
|
||||||
local_user[:roles].each do |local_role_name|
|
local_user[:roles].each do |local_role_name|
|
||||||
local_role = Role.find_by(name: local_role_name)
|
local_role = Role.find_by(name: local_role_name)
|
||||||
|
|
Loading…
Reference in a new issue