From 04055f70959bbef52d48583db99843bcc991332a Mon Sep 17 00:00:00 2001 From: Ryan Lue Date: Fri, 4 May 2018 22:05:10 +0800 Subject: [PATCH] Replace unless with if ! (project-wide) --- .../concerns/creates_ticket_articles.rb | 4 ++-- app/controllers/form_controller.rb | 4 +--- app/controllers/import_zendesk_controller.rb | 2 +- .../integration/sipgate_controller.rb | 2 +- app/controllers/settings_controller.rb | 2 +- app/models/application_model/can_associations.rb | 2 +- app/models/channel/driver/pop3.rb | 2 +- app/models/channel/email_parser.rb | 2 +- app/models/channel/filter/identify_sender.rb | 10 +++------- app/models/concerns/can_csv_import.rb | 2 +- app/models/history.rb | 1 - app/models/link.rb | 1 - app/models/object_manager/attribute.rb | 2 +- app/models/organization.rb | 1 - app/models/role.rb | 2 +- app/models/store.rb | 1 - app/models/tag.rb | 1 - app/models/ticket.rb | 1 - app/models/ticket/article.rb | 1 - app/models/ticket/state.rb | 1 - app/models/translation.rb | 2 +- ...20180502015927_issue_1219_zhtw_locale_typo.rb | 8 ++++---- lib/core_ext/net/smtp.rb | 6 +++--- lib/html_sanitizer.rb | 4 +--- lib/telegram.rb | 2 +- lib/user_agent.rb | 2 +- script/scheduler.rb | 2 +- script/websocket-server.rb | 2 +- test/browser/agent_ticket_tag_test.rb | 6 +++--- test/browser_test_helper.rb | 16 ++++++++-------- test/unit/auto_wizard_test.rb | 6 +++--- 31 files changed, 42 insertions(+), 58 deletions(-) diff --git a/app/controllers/concerns/creates_ticket_articles.rb b/app/controllers/concerns/creates_ticket_articles.rb index 82a2001dc..ca1e2eb6a 100644 --- a/app/controllers/concerns/creates_ticket_articles.rb +++ b/app/controllers/concerns/creates_ticket_articles.rb @@ -36,7 +36,7 @@ module CreatesTicketArticles clean_params.delete(:sender) clean_params.delete(:origin_by_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 end clean_params.delete(:type) @@ -89,7 +89,7 @@ module CreatesTicketArticles preferences[store_key] = attachment[key] 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}'" end diff --git a/app/controllers/form_controller.rb b/app/controllers/form_controller.rb index 832419d2e..e30eec739 100644 --- a/app/controllers/form_controller.rb +++ b/app/controllers/form_controller.rb @@ -67,9 +67,7 @@ class FormController < ApplicationController Rails.logger.info "Can't verify email #{params[:email]}: #{message}" # ignore 450, graylistings - unless message.match?(/450/) - errors['email'] = message - end + errors['email'] = message if !message.match?(/450/) end end diff --git a/app/controllers/import_zendesk_controller.rb b/app/controllers/import_zendesk_controller.rb index c9ed0758d..b3418b322 100644 --- a/app/controllers/import_zendesk_controller.rb +++ b/app/controllers/import_zendesk_controller.rb @@ -39,7 +39,7 @@ class ImportZendeskController < ApplicationController end # 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: { result: 'invalid', message_human: 'Hostname not found!', diff --git a/app/controllers/integration/sipgate_controller.rb b/app/controllers/integration/sipgate_controller.rb index 5aef8f4d8..9c27ae1ed 100644 --- a/app/controllers/integration/sipgate_controller.rb +++ b/app/controllers/integration/sipgate_controller.rb @@ -13,7 +13,7 @@ class Integration::SipgateController < ApplicationController # check if call need to be blocked 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.instruct! content = xml.Response(onHangup: url, onAnswer: url) do diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb index bb14774ce..f41ecedff 100644 --- a/app/controllers/settings_controller.rb +++ b/app/controllers/settings_controller.rb @@ -45,7 +45,7 @@ class SettingsController < ApplicationController end # validate image - unless clean_params[:logo].match?(/^data:image/i) + if !clean_params[:logo].match?(/^data:image/i) render json: { result: 'invalid', message: 'Invalid payload, need data:image in logo param', diff --git a/app/models/application_model/can_associations.rb b/app/models/application_model/can_associations.rb index 19d40040a..3e737422b 100644 --- a/app/models/application_model/can_associations.rb +++ b/app/models/application_model/can_associations.rb @@ -376,7 +376,7 @@ returns next if !assoc_name.to_s.end_with?('s') ref_names = "#{assoc_name.to_s.chomp('s')}_ids" 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 # get association class and do lookup diff --git a/app/models/channel/driver/pop3.rb b/app/models/channel/driver/pop3.rb index 64cba4d1d..050a7e400 100644 --- a/app/models/channel/driver/pop3.rb +++ b/app/models/channel/driver/pop3.rb @@ -91,7 +91,7 @@ returns next if !mail # 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 break if content_max_check < content_messages end diff --git a/app/models/channel/email_parser.rb b/app/models/channel/email_parser.rb index f66f51138..49a45451c 100644 --- a/app/models/channel/email_parser.rb +++ b/app/models/channel/email_parser.rb @@ -863,7 +863,7 @@ module Mail module Encodings def self.value_decode(str) # 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 diff --git a/app/models/channel/filter/identify_sender.rb b/app/models/channel/filter/identify_sender.rb index d5e722b16..5b8984046 100644 --- a/app/models/channel/filter/identify_sender.rb +++ b/app/models/channel/filter/identify_sender.rb @@ -144,13 +144,9 @@ module Channel::Filter::IdentifySender end def self.user_create(data, role_ids = nil) - unless data[:email].match?(/@/) - data[:email] += '@local' - end - user = User.find_by(email: data[:email].downcase) - if !user - user = User.find_by(login: data[:email].downcase) - end + data[:email] += '@local' if !data[:email].match?(/@/) + user = User.find_by(email: data[:email].downcase) || + User.find_by(login: data[:email].downcase) # check if firstname or lastname need to be updated if user diff --git a/app/models/concerns/can_csv_import.rb b/app/models/concerns/can_csv_import.rb index debf03bf2..81c3cfe58 100644 --- a/app/models/concerns/can_csv_import.rb +++ b/app/models/concerns/can_csv_import.rb @@ -296,7 +296,7 @@ returns row.push record[key] end rows.push row - next unless rows_to_add.count.positive? + next if rows_to_add.count.zero? rows_to_add.each do |item| rows.push item end diff --git a/app/models/history.rb b/app/models/history.rb index 149668af2..0ab4d4e64 100644 --- a/app/models/history.rb +++ b/app/models/history.rb @@ -7,7 +7,6 @@ class History < ApplicationModel belongs_to :history_type, class_name: 'History::Type' belongs_to :history_object, class_name: 'History::Object' belongs_to :history_attribute, class_name: 'History::Attribute' - # rubocop:enable Rails/InverseOf # the noop is needed since Layout/EmptyLines detects # the block commend below wrongly as the measurement of diff --git a/app/models/link.rb b/app/models/link.rb index 5ac666184..b5d129a2f 100644 --- a/app/models/link.rb +++ b/app/models/link.rb @@ -3,7 +3,6 @@ class Link < ApplicationModel belongs_to :link_type, class_name: 'Link::Type' belongs_to :link_object, class_name: 'Link::Object' - # rubocop:enable Rails/InverseOf after_destroy :touch_link_references diff --git a/app/models/object_manager/attribute.rb b/app/models/object_manager/attribute.rb index 1d7129e44..745554f45 100644 --- a/app/models/object_manager/attribute.rb +++ b/app/models/object_manager/attribute.rb @@ -756,7 +756,7 @@ to send no browser reload event, pass false if !data_type raise 'Need data_type param' 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}'" end diff --git a/app/models/organization.rb b/app/models/organization.rb index d168cb156..861b53902 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -13,7 +13,6 @@ class Organization < ApplicationModel include Organization::Search include Organization::SearchIndex has_many :members, class_name: 'User' - # rubocop:enable Rails/InverseOf before_create :domain_cleanup before_update :domain_cleanup diff --git a/app/models/role.rb b/app/models/role.rb index 97027b0ce..fc62f1c45 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -153,7 +153,7 @@ returns permission = Permission.lookup(id: permission_id) raise "Unable to find permission for id #{permission_id}" if !permission 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| local_permission = Permission.lookup(name: local_permission_name) next if !local_permission diff --git a/app/models/store.rb b/app/models/store.rb index b8c09758e..b05be3d89 100644 --- a/app/models/store.rb +++ b/app/models/store.rb @@ -6,7 +6,6 @@ require_dependency 'store/file' class Store < ApplicationModel belongs_to :store_object, class_name: 'Store::Object' belongs_to :store_file, class_name: 'Store::File' - # rubocop:enable Rails/InverseOf validates :filename, presence: true diff --git a/app/models/tag.rb b/app/models/tag.rb index 9de2e3b66..749ec992b 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -3,7 +3,6 @@ class Tag < ApplicationModel belongs_to :tag_object, class_name: 'Tag::Object' belongs_to :tag_item, class_name: 'Tag::Item' - # rubocop:enable Rails/InverseOf # the noop is needed since Layout/EmptyLines detects # the block commend below wrongly as the measurement of diff --git a/app/models/ticket.rb b/app/models/ticket.rb index decdd40ca..d9efdc0b3 100644 --- a/app/models/ticket.rb +++ b/app/models/ticket.rb @@ -65,7 +65,6 @@ class Ticket < ApplicationModel belongs_to :updated_by, class_name: 'User' belongs_to :create_article_type, class_name: 'Ticket::Article::Type' belongs_to :create_article_sender, class_name: 'Ticket::Article::Sender' - # rubocop:enable Rails/InverseOf self.inheritance_column = nil diff --git a/app/models/ticket/article.rb b/app/models/ticket/article.rb index acaed55f0..a1eab06dd 100644 --- a/app/models/ticket/article.rb +++ b/app/models/ticket/article.rb @@ -16,7 +16,6 @@ class Ticket::Article < ApplicationModel belongs_to :created_by, class_name: 'User' belongs_to :updated_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_update :check_subject, :check_body, :check_message_id_md5 diff --git a/app/models/ticket/state.rb b/app/models/ticket/state.rb index 680710e2d..7f6f7dc6a 100644 --- a/app/models/ticket/state.rb +++ b/app/models/ticket/state.rb @@ -4,7 +4,6 @@ class Ticket::State < ApplicationModel belongs_to :state_type, class_name: 'Ticket::StateType', inverse_of: :states belongs_to :next_state, class_name: 'Ticket::State' - # rubocop:enable Rails/InverseOf after_create :ensure_defaults after_update :ensure_defaults diff --git a/app/models/translation.rb b/app/models/translation.rb index 4d1a4253a..f9ffc1a3f 100644 --- a/app/models/translation.rb +++ b/app/models/translation.rb @@ -362,7 +362,7 @@ Get source file at https://i18n.zammad.com/api/v1/translations_empty_translation translation_raw.each_key do |key| # 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 if translation.target == translation.target_initial diff --git a/db/migrate/20180502015927_issue_1219_zhtw_locale_typo.rb b/db/migrate/20180502015927_issue_1219_zhtw_locale_typo.rb index 661a11e77..08d19beca 100644 --- a/db/migrate/20180502015927_issue_1219_zhtw_locale_typo.rb +++ b/db/migrate/20180502015927_issue_1219_zhtw_locale_typo.rb @@ -3,8 +3,8 @@ class Issue1219ZhtwLocaleTypo < ActiveRecord::Migration[5.1] APPLICABLE_VERSION = Gem::Version.new('2.5.0') def up - return unless Setting.find_by(name: 'system_init_done') - return unless CURRENT_VERSION >= APPLICABLE_VERSION + return if !Setting.find_by(name: 'system_init_done') + return if CURRENT_VERSION < APPLICABLE_VERSION if Locale.exists?(locale: 'zh-tw') Locale.find_by(locale: 'zj-tw')&.destroy @@ -20,8 +20,8 @@ class Issue1219ZhtwLocaleTypo < ActiveRecord::Migration[5.1] end def down - return unless Setting.find_by(name: 'system_init_done') - return unless CURRENT_VERSION < APPLICABLE_VERSION + return if !Setting.find_by(name: 'system_init_done') + return if CURRENT_VERSION >= APPLICABLE_VERSION if Locale.exists?(locale: 'zj-tw') Locale.find_by(locale: 'zh-tw')&.destroy diff --git a/lib/core_ext/net/smtp.rb b/lib/core_ext/net/smtp.rb index 2af11ba8d..5c6e83b66 100644 --- a/lib/core_ext/net/smtp.rb +++ b/lib/core_ext/net/smtp.rb @@ -15,7 +15,7 @@ module Net check_response critical { recv_response() } do_helo helo_domain if starttls_always? or (capable_starttls? and starttls_auto?) - unless capable_starttls? + if !capable_starttls? raise SMTPUnsupportedCommand, "STARTTLS is not supported on this server" end @@ -45,7 +45,7 @@ module Net authenticate user, secret, (authtype || DEFAULT_AUTH_TYPE) if user @started = true ensure - unless @started + if !@started # authentication failed, cancel connection. s.close if s and not s.closed? @socket = nil @@ -53,4 +53,4 @@ module Net end end end -# rubocop:enable all \ No newline at end of file +# rubocop:enable all diff --git a/lib/html_sanitizer.rb b/lib/html_sanitizer.rb index 9cc444a3d..8c6308a2b 100644 --- a/lib/html_sanitizer.rb +++ b/lib/html_sanitizer.rb @@ -134,9 +134,7 @@ satinize html string based on whiltelist value = node[key] node.delete(key) next if value.blank? - unless value.match?(/%|px|em/i) - value += 'px' - end + value += 'px' if !value.match?(/%|px|em/i) node['style'] += "#{key}:#{value}" end diff --git a/lib/telegram.rb b/lib/telegram.rb index 53d0bd291..de822a067 100644 --- a/lib/telegram.rb +++ b/lib/telegram.rb @@ -394,7 +394,7 @@ returns last_width = file['width'].to_i last_height = file['height'].to_i 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 last_width = file['width'].to_i last_height = file['height'].to_i diff --git a/lib/user_agent.rb b/lib/user_agent.rb index 73a4885bf..0ee250f67 100644 --- a/lib/user_agent.rb +++ b/lib/user_agent.rb @@ -457,7 +457,7 @@ returns else ftp.login end - ftp.chdir(remote_dir) unless remote_dir == '.' + ftp.chdir(remote_dir) if remote_dir != '.' begin ftp.getbinaryfile(filename, temp_file) diff --git a/script/scheduler.rb b/script/scheduler.rb index fdd2e8523..42d528334 100755 --- a/script/scheduler.rb +++ b/script/scheduler.rb @@ -25,7 +25,7 @@ def before_fork # remember open file handles @files_to_reopen = [] ObjectSpace.each_object(File) do |file| - @files_to_reopen << file unless file.closed? + @files_to_reopen << file if !file.closed? end end diff --git a/script/websocket-server.rb b/script/websocket-server.rb index 6199a089b..e701ec528 100755 --- a/script/websocket-server.rb +++ b/script/websocket-server.rb @@ -25,7 +25,7 @@ def before_fork # remember open file handles @files_to_reopen = [] ObjectSpace.each_object(File) do |file| - @files_to_reopen << file unless file.closed? + @files_to_reopen << file if !file.closed? end end diff --git a/test/browser/agent_ticket_tag_test.rb b/test/browser/agent_ticket_tag_test.rb index 7abcd0c64..bf7adf729 100644 --- a/test/browser/agent_ticket_tag_test.rb +++ b/test/browser/agent_ticket_tag_test.rb @@ -37,7 +37,7 @@ class AgentTicketTagTest < TestCase css: '.active .newTicket button.js-submit', ) 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!' end @@ -69,7 +69,7 @@ class AgentTicketTagTest < TestCase click(css: '#global-search') click(css: '.active .newTicket button.js-submit') 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!' end @@ -428,7 +428,7 @@ class AgentTicketTagTest < TestCase css: '.active .newTicket button.js-submit', ) 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!' end diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index 93a01c6f3..8ba75c7ea 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -104,7 +104,7 @@ class TestCase < Test::Unit::TestCase browser_width = ENV['BROWSER_WIDTH'] || 1024 browser_height = ENV['BROWSER_HEIGHT'] || 800 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 local_browser.manage.window.move_to(0, 0) else @@ -362,7 +362,7 @@ class TestCase < Test::Unit::TestCase instance = params[:browser] || @browser sleep 0.7 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') raise "url #{current_url} is not matching #{params[:url]}" end @@ -1352,7 +1352,7 @@ wait untill text in selector disabppears if params[:value] begin 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}'") sleep 1 return true @@ -2427,7 +2427,7 @@ wait untill text in selector disabppears element.click sleep 1 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') raise "unable to open ticket #{params[:number]}!" 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()") sleep 1 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') raise "unable to search/find ticket #{params[:number]}!" 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()") sleep 1 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') raise "unable to search/find ticket #{params[:title]}!" 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()") sleep 1 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') raise "unable to search/find org #{params[:value]}!" 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()") sleep 1 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') raise "unable to search/find user #{params[:value]}!" end diff --git a/test/unit/auto_wizard_test.rb b/test/unit/auto_wizard_test.rb index 026466bc6..12b5744aa 100644 --- a/test/unit/auto_wizard_test.rb +++ b/test/unit/auto_wizard_test.rb @@ -55,7 +55,7 @@ class AutoWizardTest < ActiveSupport::TestCase assert_equal(local_user[:lastname], user.lastname) assert_equal(local_user[:email], user.email) 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_role = Role.find_by(name: local_role_name) assert(user.role_ids.include?(local_role.id)) @@ -64,7 +64,7 @@ class AutoWizardTest < ActiveSupport::TestCase auto_wizard_data[:Groups].each do |local_group| group = Group.find_by(name: local_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_user = User.find_by(login: local_user_login) 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[:lastname], user.lastname) 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) local_user[:roles].each do |local_role_name| local_role = Role.find_by(name: local_role_name)