commit 9d43fc71e47ffecbee36a9192a7720b9c443c909
Author: Michael Moll <kvedulv@kvedulv.de>
Date:   Thu Jun 14 12:25:46 2018 +0200

    Fixes #19789 - fix Layout/SpaceAroundOperators cop

diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index a16935c55..d1280a24c 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -69,12 +69,6 @@ Layout/MultilineMethodCallIndentation:
 Layout/MultilineOperationIndentation:
   Enabled: false
 
-# Offense count: 941
-# Cop supports --auto-correct.
-# Configuration parameters: AllowForAlignment.
-Layout/SpaceAroundOperators:
-  Enabled: false
-
 # Offense count: 95
 # Cop supports --auto-correct.
 # Configuration parameters: EnforcedStyle.
@@ -187,7 +181,7 @@ Metrics/CyclomaticComplexity:
 # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
 # URISchemes: http, https
 Metrics/LineLength:
-  Max: 385
+  Max: 340
 
 # Offense count: 522
 # Configuration parameters: CountComments.
diff --git a/app/controllers/api/base_controller.rb b/app/controllers/api/base_controller.rb
index 47748bc98..175680dfd 100644
--- a/app/controllers/api/base_controller.rb
+++ b/app/controllers/api/base_controller.rb
@@ -228,8 +228,8 @@ module Api
     end
 
     def add_version_header
-      response.headers["Foreman_version"]= SETTINGS[:version].full
-      response.headers["Foreman_api_version"]= api_version
+      response.headers["Foreman_version"] = SETTINGS[:version].full
+      response.headers["Foreman_api_version"] = api_version
     end
 
     # this method is used with nested resources, where obj_id is passed into the parameters hash.
diff --git a/app/controllers/api/v2/hostgroup_classes_controller.rb b/app/controllers/api/v2/hostgroup_classes_controller.rb
index a54adff4d..c9e46bdc8 100644
--- a/app/controllers/api/v2/hostgroup_classes_controller.rb
+++ b/app/controllers/api/v2/hostgroup_classes_controller.rb
@@ -8,7 +8,7 @@ module Api
       api :GET, "/hostgroups/:hostgroup_id/puppetclass_ids/", N_("List all Puppet class IDs for host group")
 
       def index
-        render :json =>  { root_node_name => HostgroupClass.where(:hostgroup_id => @hostgroup.id).pluck('puppetclass_id') }
+        render :json => { root_node_name => HostgroupClass.where(:hostgroup_id => @hostgroup.id).pluck('puppetclass_id') }
       end
 
       api :POST, "/hostgroups/:hostgroup_id/puppetclass_ids", N_("Add a Puppet class to host group")
diff --git a/app/controllers/api/v2/parameters_controller.rb b/app/controllers/api/v2/parameters_controller.rb
index 951a6cd21..f5a475d61 100644
--- a/app/controllers/api/v2/parameters_controller.rb
+++ b/app/controllers/api/v2/parameters_controller.rb
@@ -183,7 +183,7 @@ module Api
 
       def find_parameter
         # nested_obj is required, so no need to check here
-        @parameters  = nested_obj.send(parameters_method).authorized(current_permission)
+        @parameters = nested_obj.send(parameters_method).authorized(current_permission)
         @parameter = @parameters.from_param(params[:id])
         @parameter ||= @parameters.friendly.find(params[:id])
         return @parameter if @parameter.present?
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 166a59ea3..e25af935d 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -358,7 +358,7 @@ class ApplicationController < ActionController::Base
   end
 
   def errors_hash(errors)
-    errors.any? ? {:status => N_("Error"), :message => errors.full_messages.join('<br>')} : {:status => N_("OK"), :message =>""}
+    errors.any? ? {:status => N_("Error"), :message => errors.full_messages.join('<br>')} : {:status => N_("OK"), :message => ""}
   end
 
   def taxonomy_scope
diff --git a/app/controllers/compute_resources_controller.rb b/app/controllers/compute_resources_controller.rb
index f4ef45d72..9e2f22ae4 100644
--- a/app/controllers/compute_resources_controller.rb
+++ b/app/controllers/compute_resources_controller.rb
@@ -9,7 +9,7 @@ class ComputeResourcesController < ApplicationController
   # This can happen in development when removing a plugin
   rescue_from ActiveRecord::SubclassNotFound do |e|
     type = (e.to_s =~ /failed to locate the subclass: '((\w|::)+)'/) ? Regexp.last_match(1) : 'STI-Type'
-    render :plain => (e.to_s+"<br><b>run ComputeResource.where(:type=>'#{type}').delete_all to recover.</b>").html_safe, :status=> :internal_server_error
+    render :plain => (e.to_s + "<br><b>run ComputeResource.where(:type=>'#{type}').delete_all to recover.</b>").html_safe, :status => :internal_server_error
   end
 
   def index
diff --git a/app/controllers/compute_resources_vms_controller.rb b/app/controllers/compute_resources_vms_controller.rb
index d776605bf..ed37c781d 100644
--- a/app/controllers/compute_resources_vms_controller.rb
+++ b/app/controllers/compute_resources_vms_controller.rb
@@ -39,7 +39,7 @@ class ComputeResourcesVmsController < ApplicationController
   def create
     params[:vm].permit!
     if (vm = @compute_resource.create_vm params[:vm])
-      @compute_resource.start_vm(vm.identity) if params[:vm][:start]=='1'
+      @compute_resource.start_vm(vm.identity) if params[:vm][:start] == '1'
       process_success :success_redirect => compute_resource_vms_path(@compute_resource)
     else
       process_error :redirect => new_compute_resource_vm_path(@compute_resource), :object => @compute_resource
diff --git a/app/controllers/concerns/api/v2/lookup_keys_common_controller.rb b/app/controllers/concerns/api/v2/lookup_keys_common_controller.rb
index 8c2f6197e..d9ccddca4 100644
--- a/app/controllers/concerns/api/v2/lookup_keys_common_controller.rb
+++ b/app/controllers/concerns/api/v2/lookup_keys_common_controller.rb
@@ -73,7 +73,7 @@ module Api::V2::LookupKeysCommonController
     id = params.key?('smart_class_parameter_id') ? params['smart_class_parameter_id'] : params['id']
     @smart_class_parameter = PuppetclassLookupKey.authorized(:view_external_parameters).smart_class_parameters.find_by_id(id.to_i) if id.to_i > 0
     @smart_class_parameter ||= begin
-                                 puppet_cond = { 'environment_classes.puppetclass_id'=> @puppetclass.id } if @puppetclass
+                                 puppet_cond = { 'environment_classes.puppetclass_id' => @puppetclass.id } if @puppetclass
                                  env_cond = { 'environment_classes.environment_id' => @environment.id } if @environment
                                  PuppetclassLookupKey.authorized(:view_external_parameters).smart_class_parameters.where(puppet_cond).where(env_cond).where(:key => id).first
                                end
diff --git a/app/controllers/concerns/foreman/controller/auto_complete_search.rb b/app/controllers/concerns/foreman/controller/auto_complete_search.rb
index 053186a96..78b19c79f 100644
--- a/app/controllers/concerns/foreman/controller/auto_complete_search.rb
+++ b/app/controllers/concerns/foreman/controller/auto_complete_search.rb
@@ -17,7 +17,7 @@ module Foreman::Controller::AutoCompleteSearch
         {:completed => CGI.escapeHTML(completed), :part => CGI.escapeHTML(part), :label => item, :category => category}
       end
     rescue ScopedSearch::QueryNotSupported => e
-      @items = [{:error =>e.to_s}]
+      @items = [{:error => e.to_s}]
     end
     render :json => @items
   end
diff --git a/app/controllers/concerns/foreman/controller/bruteforce_protection.rb b/app/controllers/concerns/foreman/controller/bruteforce_protection.rb
index 4716af07a..44beae51d 100644
--- a/app/controllers/concerns/foreman/controller/bruteforce_protection.rb
+++ b/app/controllers/concerns/foreman/controller/bruteforce_protection.rb
@@ -2,7 +2,7 @@ module Foreman::Controller::BruteforceProtection
   extend ActiveSupport::Concern
 
   def count_login_failure
-    Rails.cache.write("failed_login_#{request.ip}", get_login_failures+1, :expires_in => 5.minutes)
+    Rails.cache.write("failed_login_#{request.ip}", get_login_failures + 1, :expires_in => 5.minutes)
   end
 
   def get_login_failures
diff --git a/app/controllers/concerns/foreman/controller/puppet/hosts_controller_extensions.rb b/app/controllers/concerns/foreman/controller/puppet/hosts_controller_extensions.rb
index 2f73b8519..c6dae8504 100644
--- a/app/controllers/concerns/foreman/controller/puppet/hosts_controller_extensions.rb
+++ b/app/controllers/concerns/foreman/controller/puppet/hosts_controller_extensions.rb
@@ -1,8 +1,8 @@
 module Foreman::Controller::Puppet::HostsControllerExtensions
   extend ActiveSupport::Concern
 
-  PUPPETMASTER_ACTIONS=[ :externalNodes, :lookup ]
-  PUPPET_AJAX_REQUESTS=%w{hostgroup_or_environment_selected puppetclass_parameters}
+  PUPPETMASTER_ACTIONS = [ :externalNodes, :lookup ]
+  PUPPET_AJAX_REQUESTS = %w{hostgroup_or_environment_selected puppetclass_parameters}
 
   MULTIPLE_EDIT_ACTIONS = %w(select_multiple_environment update_multiple_environment
                              select_multiple_puppet_proxy update_multiple_puppet_proxy
@@ -64,7 +64,7 @@ module Foreman::Controller::Puppet::HostsControllerExtensions
 
   def update_multiple_environment
     # simple validations
-    if params[:environment].nil? || (id=params["environment"]["id"]).nil?
+    if params[:environment].nil? || (id = params["environment"]["id"]).nil?
       error _('No environment selected!')
       redirect_to(select_multiple_environment_hosts_path)
       return
@@ -84,7 +84,7 @@ module Foreman::Controller::Puppet::HostsControllerExtensions
 
   def environment_from_param
     # simple validations
-    if params[:environment].nil? || (id=params["environment"]["id"]).nil?
+    if params[:environment].nil? || (id = params["environment"]["id"]).nil?
       error _('No environment selected!')
       redirect_to(select_multiple_environment_hosts_path)
       return
diff --git a/app/controllers/concerns/foreman/controller/taxonomy_multiple.rb b/app/controllers/concerns/foreman/controller/taxonomy_multiple.rb
index faf269314..1977916eb 100644
--- a/app/controllers/concerns/foreman/controller/taxonomy_multiple.rb
+++ b/app/controllers/concerns/foreman/controller/taxonomy_multiple.rb
@@ -29,7 +29,7 @@ module Foreman::Controller::TaxonomyMultiple
 
   def update_multiple_taxonomies(type)
     # simple validations
-    if params[type].nil? || (id=params[type][:id]).blank?
+    if params[type].nil? || (id = params[type][:id]).blank?
       error "No #{type.to_s.classify} selected!"
       redirect_to(hosts_path)
       return
diff --git a/app/controllers/facts_controller.rb b/app/controllers/facts_controller.rb
index 8c7ac0a1a..5b2afb7d9 100644
--- a/app/controllers/facts_controller.rb
+++ b/app/controllers/facts_controller.rb
@@ -9,7 +9,7 @@ class FactsController < ApplicationController
     @fact = FactName.find(params[:id])
     begin
       data = {:name => CGI.escapeHTML(@fact.name),
-              :values => FactValue.count_each(@fact.name).to_a.each{|v| v[:label]=CGI.escapeHTML(v[:label])}}
+              :values => FactValue.count_each(@fact.name).to_a.each{|v| v[:label] = CGI.escapeHTML(v[:label])}}
     rescue
       data = @fact
     end
diff --git a/app/controllers/filters_controller.rb b/app/controllers/filters_controller.rb
index 14ed35edb..2ad7e399b 100644
--- a/app/controllers/filters_controller.rb
+++ b/app/controllers/filters_controller.rb
@@ -7,7 +7,7 @@ class FiltersController < ApplicationController
 
   def index
     @filters = resource_base.includes(:role, :permissions).search_for(params[:search], :order => params[:order])
-    @filters = @filters.paginate(:page => params[:page], :per_page=> params[:per_page]) unless params[:paginate] == 'client'
+    @filters = @filters.paginate(:page => params[:page], :per_page => params[:per_page]) unless params[:paginate] == 'client'
     @roles_authorizer = Authorizer.new(User.current, :collection => @filters.map(&:role_id))
   end
 
diff --git a/app/controllers/hosts_controller.rb b/app/controllers/hosts_controller.rb
index d6bf1fd5b..5c14f3136 100644
--- a/app/controllers/hosts_controller.rb
+++ b/app/controllers/hosts_controller.rb
@@ -11,9 +11,9 @@ class HostsController < ApplicationController
   include Foreman::Controller::CsvResponder
   include Foreman::Controller::ConsoleCommon
 
-  SEARCHABLE_ACTIONS= %w[index active errors out_of_sync pending disabled]
-  AJAX_REQUESTS=%w{compute_resource_selected current_parameters process_hostgroup process_taxonomy review_before_build scheduler_hint_selected}
-  BOOT_DEVICES={ :disk => N_('Disk'), :cdrom => N_('CDROM'), :pxe => N_('PXE'), :bios => N_('BIOS') }
+  SEARCHABLE_ACTIONS = %w[index active errors out_of_sync pending disabled]
+  AJAX_REQUESTS = %w{compute_resource_selected current_parameters process_hostgroup process_taxonomy review_before_build scheduler_hint_selected}
+  BOOT_DEVICES = { :disk => N_('Disk'), :cdrom => N_('CDROM'), :pxe => N_('PXE'), :bios => N_('BIOS') }
   MULTIPLE_ACTIONS = %w(multiple_parameters update_multiple_parameters select_multiple_hostgroup
                         update_multiple_hostgroup
                         multiple_destroy submit_multiple_destroy multiple_build
@@ -146,7 +146,7 @@ class HostsController < ApplicationController
   end
 
   def compute_resource_selected
-    return not_found unless (params[:host] && (id=params[:host][:compute_resource_id]))
+    return not_found unless (params[:host] && (id = params[:host][:compute_resource_id]))
     Taxonomy.as_taxonomy @organization, @location do
       compute_profile_id = params[:host][:compute_profile_id] || Hostgroup.find_by_id(params[:host][:hostgroup_id]).try(:inherited_compute_profile_id)
       compute_resource = ComputeResource.authorized(:view_compute_resources).find_by_id(id)
@@ -410,7 +410,7 @@ class HostsController < ApplicationController
 
   def update_multiple_hostgroup
     # simple validations
-    unless (id=params["hostgroup"]["id"])
+    unless (id = params["hostgroup"]["id"])
       error _('No host group selected!')
       redirect_to(select_multiple_hostgroup_hosts_path)
       return
@@ -418,7 +418,7 @@ class HostsController < ApplicationController
     hg = Hostgroup.find_by_id(id)
     # update the hosts
     @hosts.each do |host|
-      host.hostgroup=hg
+      host.hostgroup = hg
       host.save(:validate => false)
     end
 
@@ -432,7 +432,7 @@ class HostsController < ApplicationController
 
   def update_multiple_owner
     # simple validations
-    if params[:owner].nil? || (id=params["owner"]["id"]).nil?
+    if params[:owner].nil? || (id = params["owner"]["id"]).nil?
       error _('No owner selected!')
       redirect_to(select_multiple_owner_hosts_path)
       return
@@ -777,7 +777,7 @@ class HostsController < ApplicationController
   end
 
   def validate_power_action
-    if params[:power].blank? || (action=params[:power][:action]).blank? ||
+    if params[:power].blank? || (action = params[:power][:action]).blank? ||
         !PowerManager::REAL_ACTIONS.include?(action)
       error _('No or invalid power state selected!')
       redirect_to(select_multiple_power_state_hosts_path)
diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb
index 498cbacc2..2d35137af 100644
--- a/app/controllers/settings_controller.rb
+++ b/app/controllers/settings_controller.rb
@@ -7,7 +7,7 @@ class SettingsController < ApplicationController
   # This can happen in development when removing a plugin
   rescue_from ActiveRecord::SubclassNotFound do |e|
     type = (e.to_s =~ /\'(Setting::.*)\'\./) ? Regexp.last_match(1) : 'STI-Type'
-    render :plain => (e.to_s+"<br><b>run Setting.where(:category=>'#{type}').delete_all to recover.</b>").html_safe, :status=> :internal_server_error
+    render :plain => (e.to_s + "<br><b>run Setting.where(:category=>'#{type}').delete_all to recover.</b>").html_safe, :status => :internal_server_error
   end
 
   def index
diff --git a/app/controllers/subnets_controller.rb b/app/controllers/subnets_controller.rb
index 874ca576b..639e11300 100644
--- a/app/controllers/subnets_controller.rb
+++ b/app/controllers/subnets_controller.rb
@@ -42,7 +42,7 @@ class SubnetsController < ApplicationController
 
   # query our subnet dhcp proxy for an unused IP
   def freeip
-    unless (s=params[:subnet_id].to_i) > 0
+    unless (s = params[:subnet_id].to_i) > 0
       invalid_request
       return
     end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 65eb30fef..bf0f355d7 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -98,7 +98,7 @@ module ApplicationHelper
   def remove_link_to_function(text, options)
     options.delete_if { |key, value| !options[key].to_s } # otherwise error during template render
     title = (_("Click to remove %s") % options[:"data-class-name"])
-    link_to_function(text, "remove_puppet_class(this)", options.merge!(:'data-original-title'=> title))
+    link_to_function(text, "remove_puppet_class(this)", options.merge!(:'data-original-title' => title))
   end
 
   def link_to_add_puppetclass(klass, type)
@@ -265,10 +265,10 @@ module ApplicationHelper
   end
 
   def flot_pie_chart(name, title, data, options = {})
-    data = data.map { |k, v| {:label=>k.to_s.humanize, :data=>v} } if data.is_a?(Hash)
+    data = data.map { |k, v| {:label => k.to_s.humanize, :data => v} } if data.is_a?(Hash)
     data.map{|element| element[:label] = truncate(element[:label], :length => 16)}
-    header = content_tag(:h4, options[:show_title] ? title : '', :class=>'ca pie-title', :'data-original-title'=>_("Expand the chart"), :rel=>'twipsy')
-    link_to_function(header, "expand_chart(this)")+
+    header = content_tag(:h4, options[:show_title] ? title : '', :class => 'ca pie-title', :'data-original-title' => _("Expand the chart"), :rel => 'twipsy')
+    link_to_function(header, "expand_chart(this)") +
         content_tag(:div, nil,
                     { :id    => name,
                       :class => 'statistics-pie',
@@ -281,7 +281,7 @@ module ApplicationHelper
   end
 
   def flot_chart(name, xaxis_label, yaxis_label, data, options = {})
-    data = data.map { |k, v| {:label=>k.to_s.humanize, :data=>v} } if data.is_a?(Hash)
+    data = data.map { |k, v| {:label => k.to_s.humanize, :data => v} } if data.is_a?(Hash)
     content_tag(:div, nil,
                 { :id    => name,
                   :class => 'statistics-chart',
@@ -289,24 +289,24 @@ module ApplicationHelper
                     :'legend-options' => options.delete(:legend),
                     :'xaxis-label'    => xaxis_label,
                     :'yaxis-label'    => yaxis_label,
-                    :series         => data
+                    :series => data
                   }
                 }.merge(options))
   end
 
   def flot_bar_chart(name, xaxis_label, yaxis_label, data, options = {})
-    i=0
+    i = 0
     ticks = nil
     if data.is_a?(Array)
       data = data.map do |kv|
-        ticks ||=[]
-        ticks << [i+=1, kv[0].to_s.humanize ]
+        ticks ||= []
+        ticks << [i += 1, kv[0].to_s.humanize ]
         [i, kv[1]]
       end
     elsif  data.is_a?(Hash)
       data = data.map do |k, v|
-        ticks ||=[]
-        ticks << [i+=1, k.to_s.humanize ]
+        ticks ||= []
+        ticks << [i += 1, k.to_s.humanize ]
         [i, v]
       end
     end
@@ -329,7 +329,7 @@ module ApplicationHelper
     button_classes = %w(btn btn-default btn-action)
     button_classes << 'btn-primary' if options[:primary]
 
-    content_tag(:div, options.merge(:class=>'btn-group')) do
+    content_tag(:div, options.merge(:class => 'btn-group')) do
       # single button
       if args.length == 1
         content_tag(:span, args[0], :class => button_classes).html_safe
@@ -340,7 +340,7 @@ module ApplicationHelper
         button = link_to(title.html_safe, '#',
                          :class => button_classes,
                          :'data-toggle' => 'dropdown')
-        dropdown_list = content_tag(:ul, :class=>"dropdown-menu pull-right") do
+        dropdown_list = content_tag(:ul, :class => "dropdown-menu pull-right") do
           args.map { |option| content_tag(:li, option) }.join(" ").html_safe
         end
         button + dropdown_list
@@ -354,15 +354,15 @@ module ApplicationHelper
     return if args.blank?
 
     # single button
-    return content_tag(:span, args[0].html_safe, :class=>'btn btn-sm btn-default') if args.length == 1
+    return content_tag(:span, args[0].html_safe, :class => 'btn btn-sm btn-default') if args.length == 1
 
     # multiple buttons
     primary = args.delete_at(0).html_safe
-    primary = content_tag(:span, primary, :class=>'btn btn-sm btn-default') if primary !~ /btn/
+    primary = content_tag(:span, primary, :class => 'btn btn-sm btn-default') if primary !~ /btn/
 
     content_tag(:div, :class => "btn-group") do
-      primary + link_to(content_tag(:span, '', :class=>'caret'), '#', :class=>"btn btn-default #{'btn-sm' if primary =~ /btn-sm/} dropdown-toggle", :'data-toggle'=>'dropdown') +
-      content_tag(:ul, :class=>"dropdown-menu pull-right") do
+      primary + link_to(content_tag(:span, '', :class => 'caret'), '#', :class => "btn btn-default #{'btn-sm' if primary =~ /btn-sm/} dropdown-toggle", :'data-toggle' => 'dropdown') +
+      content_tag(:ul, :class => "dropdown-menu pull-right") do
         args.map{|option| content_tag(:li, option)}.join(" ").html_safe
       end
     end
diff --git a/app/helpers/audits_helper.rb b/app/helpers/audits_helper.rb
index 9a01fbc92..7f20d48c4 100644
--- a/app/helpers/audits_helper.rb
+++ b/app/helpers/audits_helper.rb
@@ -73,7 +73,7 @@ module AuditsHelper
       end
     elsif !main_object? audit
       ["#{audit_action_name(audit).humanize} #{id_to_label audit.audited_changes.keys[0], audit.audited_changes.values[0]}
-       #{(audit_action_name(audit)=='removed') ? 'from' : 'to'} #{audit.associated_name || id_to_label(audit.audited_changes.keys[1], audit.audited_changes.values[1])}"]
+       #{(audit_action_name(audit) == 'removed') ? 'from' : 'to'} #{audit.associated_name || id_to_label(audit.audited_changes.keys[1], audit.audited_changes.values[1])}"]
     else
       []
     end
diff --git a/app/helpers/autosign_helper.rb b/app/helpers/autosign_helper.rb
index e129fa201..e95294e00 100644
--- a/app/helpers/autosign_helper.rb
+++ b/app/helpers/autosign_helper.rb
@@ -1,5 +1,5 @@
 module AutosignHelper
   def autosign_form
-    button_tag(_("Create Autosign Entry"), :type => 'button', :class => 'btn btn-primary fr', :data => {:toggle => 'modal', :target =>'#autosignModal'}) if authorized_for(:controller => "SmartProxies::Autosign", :action => :create, :auth_object => @proxy)
+    button_tag(_("Create Autosign Entry"), :type => 'button', :class => 'btn btn-primary fr', :data => {:toggle => 'modal', :target => '#autosignModal'}) if authorized_for(:controller => "SmartProxies::Autosign", :action => :create, :auth_object => @proxy)
   end
 end
diff --git a/app/helpers/compute_resources_helper.rb b/app/helpers/compute_resources_helper.rb
index 5a3b9c26d..8c7d56c7f 100644
--- a/app/helpers/compute_resources_helper.rb
+++ b/app/helpers/compute_resources_helper.rb
@@ -27,7 +27,7 @@ module ComputeResourcesHelper
   def power_action_html(vm)
     if vm.ready?
       {
-        :data => { :confirm =>_("Are you sure you want to power %{act} %{vm}?") % { :act => action_string(vm).downcase.strip, :vm => vm }},
+        :data => { :confirm => _("Are you sure you want to power %{act} %{vm}?") % { :act => action_string(vm).downcase.strip, :vm => vm }},
         :class => "btn btn-danger"
       }
     else
@@ -48,7 +48,7 @@ module ComputeResourcesHelper
       { :class => "btn btn-info" }
     else
       {
-        :data => { :confirm =>_("Are you sure you want to %{act} %{vm}?") % { :act => pause_action, :vm => vm } },
+        :data => { :confirm => _("Are you sure you want to %{act} %{vm}?") % { :act => pause_action, :vm => vm } },
         :class => "btn btn-danger"
       }
     end
diff --git a/app/helpers/compute_resources_vms_helper.rb b/app/helpers/compute_resources_vms_helper.rb
index 9747d30c6..8dec406c1 100644
--- a/app/helpers/compute_resources_vms_helper.rb
+++ b/app/helpers/compute_resources_vms_helper.rb
@@ -16,7 +16,7 @@ module ComputeResourcesVmsHelper
       link_to_if_authorized(_("Console"), hash_for_console_host_path().merge(:auth_object => host, :permission => 'console_hosts'),
                             { :class => "btn btn-info" })
     else
-      link_to(_("Console"), '#', {:disabled=> true, :class => "btn btn-info"})
+      link_to(_("Console"), '#', {:disabled => true, :class => "btn btn-info"})
     end
   end
 
@@ -157,7 +157,7 @@ module ComputeResourcesVmsHelper
 
   def subnet_vpc_hash(subnets)
     subnet_vpc_hash = {}
-    subnets.each{ |sub| subnet_vpc_hash[sub.subnet_id] = {:vpc_id =>sub.vpc_id, :subnet_name => sub.tag_set["Name"] || sub.subnet_id} }
+    subnets.each{ |sub| subnet_vpc_hash[sub.subnet_id] = {:vpc_id => sub.vpc_id, :subnet_name => sub.tag_set["Name"] || sub.subnet_id} }
     subnet_vpc_hash
   end
 
@@ -272,7 +272,7 @@ module ComputeResourcesVmsHelper
         :permission => 'edit_compute_resources'),
         :title => _("Associate VM to a Foreman host"),
         :method => :put,
-        :class =>"btn btn-default"
+        :class => "btn btn-default"
     )
   end
 
diff --git a/app/helpers/dashboard_helper.rb b/app/helpers/dashboard_helper.rb
index 76d917a5c..31a77f4d9 100644
--- a/app/helpers/dashboard_helper.rb
+++ b/app/helpers/dashboard_helper.rb
@@ -10,9 +10,9 @@ module DashboardHelper
         _('Manage'), {},
         link_to_function(_('Save positions'), "save_position('#{save_positions_widgets_path}')"),
         link_to(_('Reset to default'), reset_default_widgets_path, :method => :put),
-        content_tag(:li, '', :class=>'divider'),
-        content_tag(:li, _("Add widgets"), :class=>'nav-header'),
-        content_tag(:li, '', :class=>'widget-add') do
+        content_tag(:li, '', :class => 'divider'),
+        content_tag(:li, _("Add widgets"), :class => 'nav-header'),
+        content_tag(:li, '', :class => 'widget-add') do
           widgets_to_add
         end
       ),
@@ -37,7 +37,7 @@ module DashboardHelper
   end
 
   def widget_data(widget)
-    { :data => { :id    => widget.id,    :name  => _(widget.name), :row  => widget.row, :col => widget.col,
+    { :data => { :id    => widget.id,    :name  => _(widget.name), :row => widget.row, :col => widget.col,
                  :sizex => widget.sizex, :sizey =>  widget.sizey } }
   end
 
@@ -48,7 +48,7 @@ module DashboardHelper
     start = Time.zone.now - interval_setting.minutes
     (0..9).each do |i|
       t = start + (interval.minutes * i)
-      data << [interval_setting - i*interval, hosts.run_distribution(t, t + interval.minutes).count]
+      data << [interval_setting - i * interval, hosts.run_distribution(t, t + interval.minutes).count]
     end
     data
   end
@@ -73,9 +73,9 @@ module DashboardHelper
   def searchable_links(name, search, counter)
     search += " and #{@data.filter}" if @data.filter.present?
     content_tag :li do
-      content_tag(:span, raw('&nbsp;'), :class=>'label', :style => "background-color:" + report_color[counter]) +
-      raw('&nbsp;')+
-      link_to(name, hosts_path(:search => search), :class=>"dashboard-links") +
+      content_tag(:span, raw('&nbsp;'), :class => 'label', :style => "background-color:" + report_color[counter]) +
+      raw('&nbsp;') +
+      link_to(name, hosts_path(:search => search), :class => "dashboard-links") +
       content_tag(:h4, @data.report[counter])
     end
   end
diff --git a/app/helpers/form_helper.rb b/app/helpers/form_helper.rb
index 621f7e65e..9d48171c5 100644
--- a/app/helpers/form_helper.rb
+++ b/app/helpers/form_helper.rb
@@ -80,10 +80,10 @@ module FormHelper
       hidden_fields = ''
       html_options["data-useds"] ||= "[]"
       JSON.parse(html_options["data-useds"]).each do |disabled_value|
-        hidden_fields += f.hidden_field(attr_ids, :multiple => true, :value => disabled_value, :id=>'')
+        hidden_fields += f.hidden_field(attr_ids, :multiple => true, :value => disabled_value, :id => '')
       end
       unauthorized.each do |unauthorized_value|
-        hidden_fields += f.hidden_field(attr_ids, :multiple => true, :value => unauthorized_value, :id=>'')
+        hidden_fields += f.hidden_field(attr_ids, :multiple => true, :value => unauthorized_value, :id => '')
       end
       hidden_fields + f.collection_select(attr_ids, authorized.sort_by { |a| a.to_s },
                                           :id, options.delete(:object_label_method) || :to_label, options.merge(:selected => selected_ids),
@@ -99,7 +99,7 @@ module FormHelper
   def radio_button_f(f, attr, options = {})
     text = options.delete(:text)
     value = options.delete(:value)
-    label_tag('', :class=>"radio-inline") do
+    label_tag('', :class => "radio-inline") do
       f.radio_button(attr, value, options) + " #{text} "
     end
   end
@@ -190,10 +190,10 @@ module FormHelper
     if options[:file_name]
       html =  content_tag(:b) {options.delete(:file_name)}
       html += content_tag(:hr)
-      html += content_tag(:div, :style=>"margin-bottom: 10px") {_("Choose a new file:")}
+      html += content_tag(:div, :style => "margin-bottom: 10px") {_("Choose a new file:")}
     end
     field(f, attr, options) do
-      (html ? html: " ") + (f.file_field attr, options)
+      (html ? html : " ") + (f.file_field attr, options)
     end
   end
 
@@ -289,9 +289,9 @@ module FormHelper
 
   def form_for(record_or_name_or_array, *args, &proc)
     if args.last.is_a?(Hash)
-      args.last[:html] = {:class=>"form-horizontal well"}.merge(args.last[:html]||{})
+      args.last[:html] = {:class => "form-horizontal well"}.merge(args.last[:html] || {})
     else
-      args << {:html=>{:class=>"form-horizontal well"}}
+      args << {:html => {:class => "form-horizontal well"}}
     end
     super record_or_name_or_array, *args, &proc
   end
@@ -370,7 +370,7 @@ module FormHelper
     error       = options.delete(:error) || f.object.errors[attr] if f && f.object.respond_to?(:errors)
     help_inline = help_inline(options.delete(:help_inline), error)
     help_inline += options[:help_inline_permanent] unless options[:help_inline_permanent].nil?
-    size_class  = options.delete(:size) || "col-md-4"
+    size_class = options.delete(:size) || "col-md-4"
     wrapper_class = options.delete(:wrapper_class) || "form-group"
 
     label = options[:no_label] ? "" : add_label(options, f, attr)
diff --git a/app/helpers/home_helper.rb b/app/helpers/home_helper.rb
index cc85f8355..9b2b57dfb 100644
--- a/app/helpers/home_helper.rb
+++ b/app/helpers/home_helper.rb
@@ -68,8 +68,8 @@ module HomeHelper
   end
 
   def user_header
-    summary = avatar_image_tag(User.current, :class=>'avatar small') +
-              "#{User.current.to_label} " + content_tag(:span, "", :class=>'caret')
-    link_to(summary.html_safe, "#", :class => "dropdown-toggle nav-item-iconic", :'data-toggle'=>"dropdown", :id => "account_menu")
+    summary = avatar_image_tag(User.current, :class => 'avatar small') +
+              "#{User.current.to_label} " + content_tag(:span, "", :class => 'caret')
+    link_to(summary.html_safe, "#", :class => "dropdown-toggle nav-item-iconic", :'data-toggle' => "dropdown", :id => "account_menu")
   end
 end
diff --git a/app/helpers/hosts_helper.rb b/app/helpers/hosts_helper.rb
index 0481987b1..b1d854cdb 100644
--- a/app/helpers/hosts_helper.rb
+++ b/app/helpers/hosts_helper.rb
@@ -210,26 +210,26 @@ module HostsHelper
   def resources_chart(timerange = 1.day.ago)
     applied, failed, restarted, failed_restarts, skipped = [], [], [], [], []
     @host.reports.recent(timerange).each do |r|
-      applied         << [r.reported_at.to_i*1000, r.applied ]
-      failed          << [r.reported_at.to_i*1000, r.failed ]
-      restarted       << [r.reported_at.to_i*1000, r.restarted ]
-      failed_restarts << [r.reported_at.to_i*1000, r.failed_restarts ]
-      skipped         << [r.reported_at.to_i*1000, r.skipped ]
+      applied         << [r.reported_at.to_i * 1000, r.applied ]
+      failed          << [r.reported_at.to_i * 1000, r.failed ]
+      restarted       << [r.reported_at.to_i * 1000, r.restarted ]
+      failed_restarts << [r.reported_at.to_i * 1000, r.failed_restarts ]
+      skipped         << [r.reported_at.to_i * 1000, r.skipped ]
     end
-    [{:label=>_("Applied"), :data=>applied, :color =>'#89A54E'},
-     {:label=>_("Failed"), :data=>failed, :color =>'#AA4643'},
-     {:label=>_("Failed restarts"), :data=>failed_restarts, :color =>'#EC971F'},
-     {:label=>_("Skipped"), :data=>skipped, :color =>'#80699B'},
-     {:label=>_("Restarted"), :data=>restarted, :color =>'#4572A7'}]
+    [{:label => _("Applied"), :data => applied, :color => '#89A54E'},
+     {:label => _("Failed"), :data => failed, :color => '#AA4643'},
+     {:label => _("Failed restarts"), :data => failed_restarts, :color => '#EC971F'},
+     {:label => _("Skipped"), :data => skipped, :color => '#80699B'},
+     {:label => _("Restarted"), :data => restarted, :color => '#4572A7'}]
   end
 
   def runtime_chart(timerange = 1.day.ago)
     config, runtime = [], []
     @host.reports.recent(timerange).each do |r|
-      config  << [r.reported_at.to_i*1000, r.config_retrieval]
-      runtime << [r.reported_at.to_i*1000, r.runtime]
+      config  << [r.reported_at.to_i * 1000, r.config_retrieval]
+      runtime << [r.reported_at.to_i * 1000, r.runtime]
     end
-    [{:label=>_("Config Retrieval"), :data=> config, :color=>'#AA4643'}, {:label=>_("Runtime"), :data=> runtime, :color=>'#4572A7'}]
+    [{:label => _("Config Retrieval"), :data => config, :color => '#AA4643'}, {:label => _("Runtime"), :data => runtime, :color => '#4572A7'}]
   end
 
   def reports_show
@@ -239,8 +239,8 @@ module HostsHelper
 
     form_tag @host, :id => 'days_filter', :method => :get, :class => "form form-inline" do
       content_tag(:span, (_("Found %{count} reports from the last %{days} days") %
-        { :days  => select(nil, 'range', 1..number_of_days,
-                    {:selected => @range}, {:style=>"float:none; width: #{width}em;", :onchange =>"$('#days_filter').submit();$(this).disabled();"}),
+        { :days => select(nil, 'range', 1..number_of_days,
+                    {:selected => @range}, {:style => "float:none; width: #{width}em;", :onchange => "$('#days_filter').submit();$(this).disabled();"}),
           :count => @host.reports.recent(@range.days.ago).count }).html_safe)
     end
   end
@@ -342,7 +342,7 @@ module HostsHelper
           link_to_if_authorized(_("Run puppet"), hash_for_puppetrun_host_path(:id => host).merge(:auth_object => host, :permission => 'puppetrun_hosts'),
                                 :disabled => !Setting[:puppetrun],
                                 :class => 'btn btn-default',
-                                :title    => _("Trigger a puppetrun on a node; requires that puppet run is enabled"))
+                                :title => _("Trigger a puppetrun on a node; requires that puppet run is enabled"))
         end
       ),
       button_group(
@@ -434,9 +434,9 @@ module HostsHelper
     return '' if nic.new_record?
 
     if nic.link
-      status = '<i class="glyphicon glyphicon glyphicon-arrow-up interface-up" title="'+ _('Interface is up') +'"></i>'
+      status = '<i class="glyphicon glyphicon glyphicon-arrow-up interface-up" title="' + _('Interface is up') + '"></i>'
     else
-      status = '<i class="glyphicon glyphicon glyphicon-arrow-down interface-down" title="'+ _('Interface is down') +'"></i>'
+      status = '<i class="glyphicon glyphicon glyphicon-arrow-down interface-down" title="' + _('Interface is down') + '"></i>'
     end
     status.html_safe
   end
diff --git a/app/helpers/layout_helper.rb b/app/helpers/layout_helper.rb
index 66ca33e6b..2d8470a59 100644
--- a/app/helpers/layout_helper.rb
+++ b/app/helpers/layout_helper.rb
@@ -9,7 +9,7 @@ module LayoutHelper
   end
 
   def button_group(*elements)
-    content_tag(:div, :class=>"btn-group") { elements.join(" ").html_safe }
+    content_tag(:div, :class => "btn-group") { elements.join(" ").html_safe }
   end
 
   def search_bar(*elements)
@@ -67,15 +67,15 @@ module LayoutHelper
 
   def icon_text(i, text = "", opts = {})
     opts[:kind] ||= "glyphicon"
-    (content_tag(:span, "", :class=>"#{opts[:kind] + ' ' + opts[:kind]}-#{i} #{opts[:class]}", :title => opts[:title]) + " " + text).html_safe
+    (content_tag(:span, "", :class => "#{opts[:kind] + ' ' + opts[:kind]}-#{i} #{opts[:class]}", :title => opts[:title]) + " " + text).html_safe
   end
 
   def alert(opts = {})
-    opts[:close]  = true if opts[:close].nil?
+    opts[:close] = true if opts[:close].nil?
     opts[:header] ||= _("Warning!")
     opts[:text]   ||= _("Alert")
-    html_class    = "alert #{opts[:class]} "
-    html_class    += 'alert-dismissable' if opts[:close]
+    html_class = "alert #{opts[:class]} "
+    html_class += 'alert-dismissable' if opts[:close]
     content_tag :div, :class => html_class, :id => opts[:id] do
       result = "".html_safe
       result += alert_close if opts[:close]
diff --git a/app/helpers/lookup_keys_helper.rb b/app/helpers/lookup_keys_helper.rb
index 1b1a428bd..f2e1a7d52 100644
--- a/app/helpers/lookup_keys_helper.rb
+++ b/app/helpers/lookup_keys_helper.rb
@@ -1,7 +1,7 @@
 module LookupKeysHelper
   def remove_child_link(name, f, opts = {})
     opts[:class] = [opts[:class], "remove_nested_fields"].compact.join(" ")
-    f.hidden_field(opts[:method]||:_destroy) + link_to_function(name, "remove_child_node(this);", opts)
+    f.hidden_field(opts[:method] || :_destroy) + link_to_function(name, "remove_child_node(this);", opts)
   end
 
   def delete_child_link(name, f, opts = {})
@@ -31,7 +31,7 @@ module LookupKeysHelper
 
   def param_type_selector(f, options = {})
     selectable_f f, :key_type, options_for_select(LookupKey::KEY_TYPES.map { |e| [_(e), e] }, f.object.key_type), {},
-                 options.merge({ :disabled => (f.object.puppet? && !f.object.override), :size => "col-md-8", :class=> "without_select2",
+                 options.merge({ :disabled => (f.object.puppet? && !f.object.override), :size => "col-md-8", :class => "without_select2",
                  :label_help => _("<dl>" +
                    "<dt>String</dt> <dd>Everything is taken as a string.</dd>" +
                    "<dt>Boolean</dt> <dd>Common representation of boolean values are accepted.</dd>" +
@@ -47,7 +47,7 @@ module LookupKeysHelper
 
   def validator_type_selector(f)
     selectable_f f, :validator_type, options_for_select(LookupKey::VALIDATOR_TYPES.map { |e| [_(e), e] }, f.object.validator_type), {:include_blank => _("None")},
-               { :disabled => (f.object.puppet? && !f.object.override), :size => "col-md-8", :class=> "without_select2",
+               { :disabled => (f.object.puppet? && !f.object.override), :size => "col-md-8", :class => "without_select2",
                  :onchange => 'validatorTypeSelected(this)',
                  :label_help => _("<dl>" +
                    "<dt>List</dt> <dd>A list of the allowed values, specified in the Validator rule field.</dd>" +
@@ -132,24 +132,24 @@ module LookupKeysHelper
     link_to_function(icon_text('pencil-square-o', '', :kind => 'fa'), "override_class_param(this)",
                      :title => _("Override this value"),
                      :'data-tag' => 'override',
-                     :class =>"btn btn-default btn-md btn-override #{'hide' if overridden}") +
+                     :class => "btn btn-default btn-md btn-override #{'hide' if overridden}") +
       link_to_function(icon_text('times', '', :kind => 'fa'), "override_class_param(this)",
                        :title => _("Remove this override"),
                       :'data-tag' => 'remove',
-                      :class =>"btn btn-default btn-md btn-override #{'hide' unless overridden}")
+                      :class => "btn btn-default btn-md btn-override #{'hide' unless overridden}")
   end
 
   def hidden_toggle(hidden, hide_icon = 'eye-slash', unhide_icon = 'eye', strikethrough = false)
     return unless can_edit_params?
     if strikethrough && !hidden
-      link_to_function(icon_text(hide_icon, '', :kind => 'fa'), "", :class =>"btn btn-default btn-md btn-hide", :disabled => "disabled", :rel => "twipsy", :title => _("This value is not hidden"))
+      link_to_function(icon_text(hide_icon, '', :kind => 'fa'), "", :class => "btn btn-default btn-md btn-hide", :disabled => "disabled", :rel => "twipsy", :title => _("This value is not hidden"))
     else
       link_to_function(icon_text(unhide_icon, '', :kind => 'fa'), "input_group_hidden(this)",
                        :title => _("Unhide this value"),
-                       :class =>"btn btn-default btn-md btn-hide #{'hide' unless hidden}") +
+                       :class => "btn btn-default btn-md btn-hide #{'hide' unless hidden}") +
           link_to_function(icon_text(hide_icon, "", :class => ('btn-strike' if strikethrough).to_s, :kind => 'fa'), "input_group_hidden(this)",
                            :title => _("Hide this value"),
-                           :class =>"btn btn-default btn-md btn-hide #{'hide' if hidden}")
+                           :class => "btn btn-default btn-md btn-hide #{'hide' if hidden}")
     end
   end
 
diff --git a/app/helpers/operatingsystems_helper.rb b/app/helpers/operatingsystems_helper.rb
index 30b0446de..487b1d0ca 100644
--- a/app/helpers/operatingsystems_helper.rb
+++ b/app/helpers/operatingsystems_helper.rb
@@ -45,7 +45,7 @@ module OperatingsystemsHelper
                record.family
              end
 
-    image_tag(family+".png", opts) + " "
+    image_tag(family + ".png", opts) + " "
   end
 
   def os_name(record, opts = {})
diff --git a/app/helpers/provisioning_templates_helper.rb b/app/helpers/provisioning_templates_helper.rb
index a7be09b67..4cdbbb279 100644
--- a/app/helpers/provisioning_templates_helper.rb
+++ b/app/helpers/provisioning_templates_helper.rb
@@ -72,7 +72,7 @@ module ProvisioningTemplatesHelper
           :text => ('<p>' + _("When editing a template, you must assign a list \
 of operating systems which this template can be used with. Optionally, you can \
 restrict a template to a list of host groups and/or environments.") + '</p>' +
-'<p>'+ _("When a Host requests a template (e.g. during provisioning), Foreman \
+'<p>' + _("When a Host requests a template (e.g. during provisioning), Foreman \
 will select the best match from the available templates of that type, in the \
 following order:") + '</p>' + '<ul>' +
     '<li>' + _("Host group and Environment") + '</li>' +
diff --git a/app/helpers/puppetca_helper.rb b/app/helpers/puppetca_helper.rb
index 99c1c5476..d78d7a899 100644
--- a/app/helpers/puppetca_helper.rb
+++ b/app/helpers/puppetca_helper.rb
@@ -5,7 +5,7 @@ module PuppetcaHelper
                'revoked' => 'fa fa-ban' }
 
   def state_filter
-    select_tag "Filter", options_for_select([[_('valid or pending'), _('valid')+'|'+_('pending')]] +
+    select_tag "Filter", options_for_select([[_('valid or pending'), _('valid') + '|' + _('pending')]] +
                                             STATES.map{|s| _(s)} +
                                             [[_('all'), '']]),
                :class => "datatable-filter", :id => "puppetca-filter"
diff --git a/app/helpers/puppetclasses_and_environments_helper.rb b/app/helpers/puppetclasses_and_environments_helper.rb
index a5dbed8a6..e3c4e25cb 100644
--- a/app/helpers/puppetclasses_and_environments_helper.rb
+++ b/app/helpers/puppetclasses_and_environments_helper.rb
@@ -20,7 +20,7 @@ module PuppetclassesAndEnvironmentsHelper
   def import_proxy_links(hash, import_env_text = false, classes = nil)
     import_from_text = import_env_text ? _("Import environments from %s") : _("Import classes from %s")
     SmartProxy.with_features("Puppet").map do |proxy|
-      display_link_if_authorized(import_from_text % proxy.name, hash.merge(:proxy => proxy), {:class=>classes})
+      display_link_if_authorized(import_from_text % proxy.name, hash.merge(:proxy => proxy), {:class => classes})
     end.flatten
   end
 
diff --git a/app/helpers/reports_helper.rb b/app/helpers/reports_helper.rb
index bbfe3bf72..4cf0db846 100644
--- a/app/helpers/reports_helper.rb
+++ b/app/helpers/reports_helper.rb
@@ -6,7 +6,7 @@ module ReportsHelper
 
   def report_event_column(event, style = "")
     style = "label-default" if event == 0
-    content_tag(:span, event, :class=>'label ' + style)
+    content_tag(:span, event, :class => 'label ' + style)
   end
 
   def reports_since(builder)
@@ -41,7 +41,7 @@ module ReportsHelper
     form_tag config_report_path(@config_report), :id => 'level_filter', :method => :get, :class => "form form-horizontal" do
       content_tag(:span, _("Show log messages:") + ' ') +
       select(nil, 'level', [[_('All messages'), 'info'], [_('Notices, warnings and errors'), 'notice'], [_('Warnings and errors'), 'warning'], [_('Errors only'), 'error']],
-             {}, {:class=>"col-md-1 form-control", :onchange =>"filter_by_level(this);"})
+             {}, {:class => "col-md-1 form-control", :onchange => "filter_by_level(this);"})
     end
   end
 
diff --git a/app/helpers/taxonomy_helper.rb b/app/helpers/taxonomy_helper.rb
index 0c9c35f95..1fad045ae 100644
--- a/app/helpers/taxonomy_helper.rb
+++ b/app/helpers/taxonomy_helper.rb
@@ -27,11 +27,11 @@ module TaxonomyHelper
   end
 
   def wizard_header(current, *args)
-    content_tag(:ul, :class=>"wizard") do
-      step=1
+    content_tag(:ul, :class => "wizard") do
+      step = 1
       content = nil
       args.each do |arg|
-        step_content = content_tag(:li, (content_tag(:span, step, :class=>"badge" +" #{'badge-inverse' if step==current}")+arg).html_safe, :class=>('active' if step==current).to_s)
+        step_content = content_tag(:li, (content_tag(:span, step, :class => "badge" + " #{'badge-inverse' if step == current}") + arg).html_safe, :class => ('active' if step == current).to_s)
         (step == 1) ? content = step_content : content += step_content
         step += 1
       end
@@ -111,7 +111,7 @@ module TaxonomyHelper
 
   def taxonomy_selects(f, selected_ids, taxonomy, label, options = {}, options_html = {})
     options[:disabled] = Array.wrap(options[:disabled])
-    options[:label]    ||= _(label)
+    options[:label] ||= _(label)
     multiple_selects f, label.downcase.singularize + '_ids', taxonomy.authorized("assign_#{label.downcase}", taxonomy), selected_ids, options, options_html
   end
 
diff --git a/app/helpers/trends_helper.rb b/app/helpers/trends_helper.rb
index 052b5da65..87f51b2cb 100644
--- a/app/helpers/trends_helper.rb
+++ b/app/helpers/trends_helper.rb
@@ -3,16 +3,16 @@ module TrendsHelper
 
   def trendable_types
     options = {_('Environment') => 'Environment', _('Operating system') => 'Operatingsystem',
-               _('Model') => 'Model', _('Facts') =>'FactName', _('Host group') => 'Hostgroup', _('Compute resource') => 'ComputeResource'}
+               _('Model') => 'Model', _('Facts') => 'FactName', _('Host group') => 'Hostgroup', _('Compute resource') => 'ComputeResource'}
     existing = ForemanTrend.types.pluck(:trendable_type)
     options.delete_if{ |k, v| existing.include?(v) }
   end
 
   def trend_days_filter
-    form_tag @trend, :id => 'days_filter', :method => :get, :class=>"form form-inline" do
+    form_tag @trend, :id => 'days_filter', :method => :get, :class => "form form-inline" do
       content_tag(:span, (_("Trend of the last %s days.") %
                           select(nil, 'range', 1..Setting[:max_trend], {:selected => range},
-                                 {:onchange =>"$('#days_filter').submit();$(this).attr('disabled','disabled');;"})).html_safe)
+                                 {:onchange => "$('#days_filter').submit();$(this).attr('disabled','disabled');;"})).html_safe)
     end
   end
 
@@ -38,10 +38,10 @@ module TrendsHelper
         interval_start = ((counter.interval_start || from) > from) ? counter.interval_start : from
         next_timestamp = counter.try(:interval_end) || Time.now.utc
         # transform the timestamp values to flot format - from seconds in Ruby to milliseconds in flot
-        data << [interval_start.to_i*1000, counter.count]
-        data << [next_timestamp.to_i*1000 - 1, counter.count]
+        data << [interval_start.to_i * 1000, counter.count]
+        data << [next_timestamp.to_i * 1000 - 1, counter.count]
       end
-      {:label => labels[value.id][0], :href=>labels[value.id][1], :data =>data, :color => chart_colors[idx % chart_colors.size()] } unless data.empty?
+      {:label => labels[value.id][0], :href => labels[value.id][1], :data => data, :color => chart_colors[idx % chart_colors.size()] } unless data.empty?
     end.compact
   end
 
diff --git a/app/helpers/unattended_helper.rb b/app/helpers/unattended_helper.rb
index 5a43ede4a..c7e1f79fd 100644
--- a/app/helpers/unattended_helper.rb
+++ b/app/helpers/unattended_helper.rb
@@ -2,7 +2,7 @@ module UnattendedHelper
   include Foreman::Renderer
 
   def ks_console
-    (@port && @baud) ? "console=ttyS#{@port},#{@baud}": ""
+    (@port && @baud) ? "console=ttyS#{@port},#{@baud}" : ""
   end
 
   def grub_pass
diff --git a/app/mailers/audit_mailer.rb b/app/mailers/audit_mailer.rb
index 7a9c4eb9b..da8e52bc5 100644
--- a/app/mailers/audit_mailer.rb
+++ b/app/mailers/audit_mailer.rb
@@ -2,7 +2,7 @@ class AuditMailer < ApplicationMailer
   helper :audits, :layout
 
   def summary(options = {})
-    raise ::Foreman::Exception.new(N_("Must specify a user with email enabled")) unless (user=User.unscoped.find(options[:user])) && user.mail_enabled?
+    raise ::Foreman::Exception.new(N_("Must specify a user with email enabled")) unless (user = User.unscoped.find(options[:user])) && user.mail_enabled?
     time = options[:time] ? %(time >= "#{options[:time]}") : 'time > yesterday'
     @query   = options[:query].present? ? "#{options[:query]} and #{time}" : time.to_s
     @count   = Audit.authorized_as(user, :view_audit_logs, Audit).search_for(@query).count
diff --git a/app/mailers/host_mailer.rb b/app/mailers/host_mailer.rb
index dfa259c21..b7df3c6f4 100644
--- a/app/mailers/host_mailer.rb
+++ b/app/mailers/host_mailer.rb
@@ -5,7 +5,7 @@ class HostMailer < ApplicationMailer
 
   # sends out a summary email of hosts and their metrics (e.g. how many changes failures etc).
   def summary(options = {})
-    raise ::Foreman::Exception.new(N_("Must specify a valid user with email enabled")) unless (user=User.find(options[:user]))
+    raise ::Foreman::Exception.new(N_("Must specify a valid user with email enabled")) unless (user = User.find(options[:user]))
     hosts = Host::Managed.authorized_as(user, :view_hosts, Host)
     time = options[:time] || 1.day.ago
     host_data = ConfigReport.summarise(time, hosts.all).sort
@@ -59,7 +59,7 @@ class HostMailer < ApplicationMailer
   private
 
   def load_metrics(host_data)
-    total_metrics = {"failed"=>0, "restarted"=>0, "skipped"=>0, "applied"=>0, "failed_restarts"=>0}
+    total_metrics = {"failed" => 0, "restarted" => 0, "skipped" => 0, "applied" => 0, "failed_restarts" => 0}
 
     host_data.flatten.delete_if { |x| true unless x.is_a?(Hash) }.each do |data_hash|
       total_metrics["failed"]          += data_hash[:metrics]["failed"]
diff --git a/app/models/compute_attribute.rb b/app/models/compute_attribute.rb
index bfcaa541a..5f03e6661 100644
--- a/app/models/compute_attribute.rb
+++ b/app/models/compute_attribute.rb
@@ -14,7 +14,7 @@ class ComputeAttribute < ApplicationRecord
 
   def method_missing(method, *args, &block)
     method = method.to_s
-    return super if method[-1]=="="
+    return super if method[-1] == "="
     return super if method == 'vm_attrs'
 
     if vm_attrs.has_key?(method)
diff --git a/app/models/compute_resources/foreman/model/ec2.rb b/app/models/compute_resources/foreman/model/ec2.rb
index d7fd00b10..36d514493 100644
--- a/app/models/compute_resources/foreman/model/ec2.rb
+++ b/app/models/compute_resources/foreman/model/ec2.rb
@@ -80,7 +80,7 @@ module Foreman::Model
 
     def console(uuid)
       vm = find_vm_by_uuid(uuid)
-      vm.console_output.body.merge(:type=>'log', :name=>vm.name)
+      vm.console_output.body.merge(:type => 'log', :name => vm.name)
     end
 
     def destroy_vm(uuid)
diff --git a/app/models/compute_resources/foreman/model/gce.rb b/app/models/compute_resources/foreman/model/gce.rb
index 017e6e971..1fcba3697 100644
--- a/app/models/compute_resources/foreman/model/gce.rb
+++ b/app/models/compute_resources/foreman/model/gce.rb
@@ -86,7 +86,7 @@ module Foreman::Model
         end
         args[:disks] = []
         args[:volumes].each_with_index do |vol_args, i|
-          args[:disks] << new_volume(vol_args.merge(:name => "#{args[:name]}-disk#{i+1}"))
+          args[:disks] << new_volume(vol_args.merge(:name => "#{args[:name]}-disk#{i + 1}"))
         end
       end
 
diff --git a/app/models/compute_resources/foreman/model/libvirt.rb b/app/models/compute_resources/foreman/model/libvirt.rb
index dfe07f48c..4002a99c7 100644
--- a/app/models/compute_resources/foreman/model/libvirt.rb
+++ b/app/models/compute_resources/foreman/model/libvirt.rb
@@ -168,7 +168,7 @@ module Foreman::Model
       # Listen address cannot be updated while the guest is running
       # When we update the display password, we pass the existing listen address
       vm.update_display(:password => password, :listen => vm.display[:listen], :type => vm.display[:type])
-      WsProxy.start(:host => hypervisor.hostname, :host_port => vm.display[:port], :password => password).merge(:type => vm.display[:type], :name=> vm.name)
+      WsProxy.start(:host => hypervisor.hostname, :host_port => vm.display[:port], :password => password).merge(:type => vm.display[:type], :name => vm.name)
     rescue ::Libvirt::Error => e
       if e.message =~ /cannot change listen address/
         logger.warn e
@@ -192,7 +192,7 @@ module Foreman::Model
         vm_attrs[:memory] = nil
         logger.debug("Compute attributes for VM '#{uuid}' diddn't contain :memory_size")
       else
-        vm_attrs[:memory] = vm_attrs[:memory_size]*1024 # value is returned in megabytes, we need bytes
+        vm_attrs[:memory] = vm_attrs[:memory_size] * 1024 # value is returned in megabytes, we need bytes
       end
       vm_attrs
     end
@@ -268,7 +268,7 @@ module Foreman::Model
       begin
         vols = []
         (volumes = args[:volumes]).each do |vol|
-          vol.name       = "#{args[:prefix]}-disk#{volumes.index(vol)+1}"
+          vol.name = "#{args[:prefix]}-disk#{volumes.index(vol) + 1}"
           vol.capacity = "#{vol.capacity}G" unless vol.capacity.to_s.end_with?('G')
           vol.allocation = "#{vol.allocation}G" unless vol.allocation.to_s.end_with?('G')
           vol.save
diff --git a/app/models/compute_resources/foreman/model/ovirt.rb b/app/models/compute_resources/foreman/model/ovirt.rb
index 7897d894b..1eec0974d 100644
--- a/app/models/compute_resources/foreman/model/ovirt.rb
+++ b/app/models/compute_resources/foreman/model/ovirt.rb
@@ -70,7 +70,7 @@ module Foreman::Model
         rating = 0.0
         if os[:name].include?(os_name)
           rating += 100
-          rating += (1.0/os[:name].length) # prefer the shorter names a bit in case we have not found more important some specifics
+          rating += (1.0 / os[:name].length) # prefer the shorter names a bit in case we have not found more important some specifics
           rating += 10 if os[:name].include?("#{os_name}_#{host.operatingsystem.major}")
           rating += 10 if arch_name && os[:name].include?(arch_name)
         end
@@ -322,7 +322,7 @@ module Foreman::Model
       {
         :search => params['search']['value'] || '',
         :max => max,
-        :page => (params['start'].to_i / max)+1,
+        :page => (params['start'].to_i / max) + 1,
         :without_details => true
       }
     end
@@ -504,7 +504,7 @@ module Foreman::Model
     end
 
     def os_name_mapping(host)
-      (host.operatingsystem.name =~ /redhat|centos/i) ? 'rhel': host.operatingsystem.name.downcase
+      (host.operatingsystem.name =~ /redhat|centos/i) ? 'rhel' : host.operatingsystem.name.downcase
     end
 
     def arch_name_mapping(host)
diff --git a/app/models/compute_resources/foreman/model/rackspace.rb b/app/models/compute_resources/foreman/model/rackspace.rb
index 386ec716e..55525ceaa 100644
--- a/app/models/compute_resources/foreman/model/rackspace.rb
+++ b/app/models/compute_resources/foreman/model/rackspace.rb
@@ -55,7 +55,7 @@ module Foreman::Model
       super && flavors
     rescue Excon::Errors::Unauthorized => e
       errors[:base] << e.response.body
-    rescue Fog::Compute::Rackspace::Error, Excon::Errors::SocketError=> e
+    rescue Fog::Compute::Rackspace::Error, Excon::Errors::SocketError => e
       errors[:base] << e.message
     end
 
diff --git a/app/models/concerns/fog_extensions/ovirt/server.rb b/app/models/concerns/fog_extensions/ovirt/server.rb
index 27b669222..819a71327 100644
--- a/app/models/concerns/fog_extensions/ovirt/server.rb
+++ b/app/models/concerns/fog_extensions/ovirt/server.rb
@@ -20,7 +20,7 @@ module FogExtensions
       def volumes_attributes=(attrs); end
 
       def poweroff
-        service.vm_action(:id =>id, :action => :shutdown)
+        service.vm_action(:id => id, :action => :shutdown)
       end
 
       def reset
diff --git a/app/models/concerns/host_common.rb b/app/models/concerns/host_common.rb
index c9aa8a23b..0422b9923 100644
--- a/app/models/concerns/host_common.rb
+++ b/app/models/concerns/host_common.rb
@@ -112,7 +112,7 @@ module HostCommon
       # We encode the hw_model into the image file name as not all Sparc flashes can contain all possible hw_models. The user can always
       # edit it if required or use symlinks if they prefer.
       hw_model = model.try :hardware_model if defined?(model_id)
-      operatingsystem.interpolate_medium_vars(nfs_path, architecture.name, operatingsystem) +\
+      operatingsystem.interpolate_medium_vars(nfs_path, architecture.name, operatingsystem) + \
         "#{operatingsystem.file_prefix}.#{architecture}#{hw_model.empty? ? '' : '.' + hw_model.downcase}.#{operatingsystem.image_extension}"
     else
       ""
diff --git a/app/models/concerns/hostext/operating_system.rb b/app/models/concerns/hostext/operating_system.rb
index 0a99bc403..c16cee9a8 100644
--- a/app/models/concerns/hostext/operating_system.rb
+++ b/app/models/concerns/hostext/operating_system.rb
@@ -54,7 +54,7 @@ module Hostext
     end
 
     def jumpstart?
-      operatingsystem.family == "Solaris" && architecture.name =~/Sparc/i rescue false
+      operatingsystem.family == "Solaris" && architecture.name =~ /Sparc/i rescue false
     end
   end
 end
diff --git a/app/models/concerns/hostext/search.rb b/app/models/concerns/hostext/search.rb
index 872444794..b0b425d45 100644
--- a/app/models/concerns/hostext/search.rb
+++ b/app/models/concerns/hostext/search.rb
@@ -21,7 +21,7 @@ module Hostext
 
       scoped_search :relation => :last_report_object, :on => :origin
 
-      scoped_search :relation => :configuration_status_object, :on => :status, :offset => 0, :word_size => ConfigReport::BIT_NUM*4, :rename => :'status.interesting', :complete_value => {:true => true, :false => false}, :only_explicit => true
+      scoped_search :relation => :configuration_status_object, :on => :status, :offset => 0, :word_size => ConfigReport::BIT_NUM * 4, :rename => :'status.interesting', :complete_value => {:true => true, :false => false}, :only_explicit => true
       scoped_search_status "applied",         :relation => :configuration_status_object, :on => :status, :rename => :'status.applied'
       scoped_search_status "restarted",       :relation => :configuration_status_object, :on => :status, :rename => :'status.restarted'
       scoped_search_status "failed",          :relation => :configuration_status_object, :on => :status, :rename => :'status.failed'
@@ -64,8 +64,8 @@ module Hostext
       scoped_search :relation => :interfaces, :on => :mac, :complete_value => true, :rename => :has_mac, :only_explicit => true
 
       scoped_search :relation => :puppetclasses, :on => :name, :complete_value => true, :rename => :class, :only_explicit => true, :operators => ['= ', '~ '], :ext_method => :search_by_puppetclass
-      scoped_search :relation => :fact_values, :on => :value, :in_key=> :fact_names, :on_key=> :name, :rename => :facts, :complete_value => true, :only_explicit => true, :ext_method => :search_cast_facts
-      scoped_search :relation => :search_parameters, :on => :value, :on_key=> :name, :complete_value => true, :rename => :params, :ext_method => :search_by_params, :only_explicit => true
+      scoped_search :relation => :fact_values, :on => :value, :in_key => :fact_names, :on_key => :name, :rename => :facts, :complete_value => true, :only_explicit => true, :ext_method => :search_cast_facts
+      scoped_search :relation => :search_parameters, :on => :value, :on_key => :name, :complete_value => true, :rename => :params, :ext_method => :search_by_params, :only_explicit => true
 
       if SETTINGS[:locations_enabled]
         scoped_search :relation => :location, :on => :title, :rename => :location, :complete_value => true, :only_explicit => true
diff --git a/app/models/config_report.rb b/app/models/config_report.rb
index a2c0ea04d..dd06f1bb9 100644
--- a/app/models/config_report.rb
+++ b/app/models/config_report.rb
@@ -1,9 +1,9 @@
 class ConfigReport < Report
   METRIC = %w[applied restarted failed failed_restarts skipped pending]
   BIT_NUM = 6
-  MAX = (1 << BIT_NUM) -1 # maximum value per metric
+  MAX = (1 << BIT_NUM) - 1 # maximum value per metric
 
-  scoped_search :on => :status, :offset => 0, :word_size => 4*BIT_NUM, :complete_value => {:true => true, :false => false}, :rename => :eventful
+  scoped_search :on => :status, :offset => 0, :word_size => 4 * BIT_NUM, :complete_value => {:true => true, :false => false}, :rename => :eventful
 
   scoped_search_status 'applied',         :on => :status, :rename => :applied
   scoped_search_status 'restarted',       :on => :status, :rename => :restarted
diff --git a/app/models/domain.rb b/app/models/domain.rb
index fa16c967f..0779dfd1d 100644
--- a/app/models/domain.rb
+++ b/app/models/domain.rb
@@ -37,7 +37,7 @@ class Domain < ApplicationRecord
   validates :fullname, :uniqueness => true, :allow_blank => true, :allow_nil => true
 
   scoped_search :on => [:name, :fullname], :complete_value => true
-  scoped_search :relation => :domain_parameters, :on => :value, :on_key=> :name, :complete_value => true, :only_explicit => true, :rename => :params
+  scoped_search :relation => :domain_parameters, :on => :value, :on_key => :name, :complete_value => true, :only_explicit => true, :rename => :params
 
   # with proc support, default_scope can no longer be chained
   # include all default scoping here
diff --git a/app/models/fact_value.rb b/app/models/fact_value.rb
index 09e0c99a0..a3328ae29 100644
--- a/app/models/fact_value.rb
+++ b/app/models/fact_value.rb
@@ -9,7 +9,7 @@ class FactValue < ApplicationRecord
 
   has_one :parent_fact_name, :through => :fact_name, :source => :parent
 
-  scoped_search :on => :value, :in_key=> :fact_name, :on_key=> :name, :rename => :facts, :complete_value => true, :only_explicit => true, :ext_method => :search_cast_facts
+  scoped_search :on => :value, :in_key => :fact_name, :on_key => :name, :rename => :facts, :complete_value => true, :only_explicit => true, :ext_method => :search_cast_facts
   scoped_search :on => :value, :default_order => true, :ext_method => :search_value_cast_facts
   scoped_search :on => :updated_at, :rename => :reported_at, :only_explicit => true, :complete_value => true
   scoped_search :on => :host_id, :only_explicit => true, :complete_value => false
@@ -76,7 +76,7 @@ class FactValue < ApplicationRecord
                 else
                   k
               end
-      output << {:label => label, :data =>v } unless v == 0
+      output << {:label => label, :data => v } unless v == 0
     end
     output
   end
diff --git a/app/models/host/managed.rb b/app/models/host/managed.rb
index 947880764..6d20c71a5 100644
--- a/app/models/host/managed.rb
+++ b/app/models/host/managed.rb
@@ -431,7 +431,7 @@ class Host::Managed < Host::Base
   # this method accepts a puppets external node yaml output and generate a node in our setup
   # it is assumed that you already have the node (e.g. imported by one of the rack tasks)
   def importNode(nodeinfo)
-    myklasses= []
+    myklasses = []
     # puppet classes
     classes = nodeinfo["classes"]
     classes = classes.keys if classes.is_a?(Hash)
@@ -492,7 +492,7 @@ class Host::Managed < Host::Base
   def self.count_habtm(association)
     counter = Host::Managed.joins(association.tableize.to_sym).group("#{association.tableize.to_sym}.id").reorder('').count
     # Puppetclass.find(counter.keys.compact)...
-    association.camelize.constantize.find(counter.keys.compact).map {|i| {:label=>i.to_label, :data =>counter[i.id]}}
+    association.camelize.constantize.find(counter.keys.compact).map {|i| {:label => i.to_label, :data => counter[i.id]}}
   end
 
   def self.provision_methods
diff --git a/app/models/hostgroup.rb b/app/models/hostgroup.rb
index f8dea8e00..4c52d198f 100644
--- a/app/models/hostgroup.rb
+++ b/app/models/hostgroup.rb
@@ -54,7 +54,7 @@ class Hostgroup < ApplicationRecord
   }
 
   scoped_search :on => :name, :complete_value => :true
-  scoped_search :relation => :group_parameters,    :on => :value, :on_key=> :name, :complete_value => true, :only_explicit => true, :rename => :params
+  scoped_search :relation => :group_parameters,    :on => :value, :on_key => :name, :complete_value => true, :only_explicit => true, :rename => :params
   scoped_search :relation => :hosts, :on => :name, :complete_value => :true, :rename => "host", :only_explicit => true
   scoped_search :relation => :puppetclasses, :on => :name, :complete_value => true, :rename => :class, :only_explicit => true, :operators => ['= ', '~ ']
   scoped_search :relation => :environment, :on => :name, :complete_value => :true, :rename => :environment, :only_explicit => true
diff --git a/app/models/lookup_keys/lookup_key.rb b/app/models/lookup_keys/lookup_key.rb
index bea253344..85f4bec70 100644
--- a/app/models/lookup_keys/lookup_key.rb
+++ b/app/models/lookup_keys/lookup_key.rb
@@ -9,7 +9,7 @@ class LookupKey < ApplicationRecord
 
   KEY_DELM = ","
   EQ_DELM  = "="
-  VALUE_REGEX =/\A[^#{KEY_DELM}]+#{EQ_DELM}[^#{KEY_DELM}]+(#{KEY_DELM}[^#{KEY_DELM}]+#{EQ_DELM}[^#{KEY_DELM}]+)*\Z/
+  VALUE_REGEX = /\A[^#{KEY_DELM}]+#{EQ_DELM}[^#{KEY_DELM}]+(#{KEY_DELM}[^#{KEY_DELM}]+#{EQ_DELM}[^#{KEY_DELM}]+)*\Z/
 
   validates_lengths_from_database
 
diff --git a/app/models/medium.rb b/app/models/medium.rb
index 72292fa2c..045698384 100644
--- a/app/models/medium.rb
+++ b/app/models/medium.rb
@@ -16,7 +16,7 @@ class Medium < ApplicationRecord
   has_many :hostgroups, :dependent => :nullify
 
   # We need to include $ in this as $arch, $release, can be in this string
-  VALID_NFS_PATH=/\A([-\w\d\.]+):(\/[\w\d\/\$\.]+)\Z/
+  VALID_NFS_PATH = /\A([-\w\d\.]+):(\/[\w\d\/\$\.]+)\Z/
   validates :name, :uniqueness => true, :presence => true
   validates :path, :uniqueness => true, :presence => true,
     :url_schema => ['http', 'https', 'ftp', 'nfs']
diff --git a/app/models/nic/bond.rb b/app/models/nic/bond.rb
index 47a10d6ab..a1628dd6c 100644
--- a/app/models/nic/bond.rb
+++ b/app/models/nic/bond.rb
@@ -4,7 +4,7 @@ module Nic
 
     attr_exportable :mode, :bond_options
 
-    MODES     = %w(balance-rr active-backup balance-xor broadcast 802.3ad balance-tlb balance-alb)
+    MODES = %w(balance-rr active-backup balance-xor broadcast 802.3ad balance-tlb balance-alb)
     validates :mode, :presence => true, :inclusion => { :in => MODES }
 
     def add_slave(identifier)
diff --git a/app/models/operatingsystem.rb b/app/models/operatingsystem.rb
index eefff0fd0..a2e548d5e 100644
--- a/app/models/operatingsystem.rb
+++ b/app/models/operatingsystem.rb
@@ -53,7 +53,7 @@ class Operatingsystem < ApplicationRecord
   scoped_search :relation => :architectures,    :on => :name,  :complete_value => :true, :rename => "architecture", :only_explicit => true
   scoped_search :relation => :media,            :on => :name,  :complete_value => :true, :rename => "medium", :only_explicit => true
   scoped_search :relation => :provisioning_templates, :on => :name, :complete_value => :true, :rename => "template", :only_explicit => true
-  scoped_search :relation => :os_parameters, :on => :value, :on_key=> :name, :complete_value => true, :rename => :params, :only_explicit => true
+  scoped_search :relation => :os_parameters, :on => :value, :on_key => :name, :complete_value => true, :rename => :params, :only_explicit => true
 
   FAMILIES = { 'Debian'    => %r{Debian|Ubuntu}i,
                'Redhat'    => %r{RedHat|Centos|Fedora|Scientific|SLC|OracleLinux}i,
diff --git a/app/models/operatingsystems/junos.rb b/app/models/operatingsystems/junos.rb
index bcf102658..df8a7d633 100644
--- a/app/models/operatingsystems/junos.rb
+++ b/app/models/operatingsystems/junos.rb
@@ -29,7 +29,7 @@ class Junos < Operatingsystem
   end
 
   def boot_filename(host = nil)
-    "ztp.cfg/"+host.mac.delete(':').upcase
+    "ztp.cfg/" + host.mac.delete(':').upcase
   end
 
   def kernel(arch)
diff --git a/app/models/operatingsystems/nxos.rb b/app/models/operatingsystems/nxos.rb
index b9c76e724..f4656a4e7 100644
--- a/app/models/operatingsystems/nxos.rb
+++ b/app/models/operatingsystems/nxos.rb
@@ -24,7 +24,7 @@ class NXOS < Operatingsystem
   end
 
   def boot_filename(host = nil)
-    "poap.cfg/"+host.mac.delete(':').upcase
+    "poap.cfg/" + host.mac.delete(':').upcase
   end
 
   def kernel(arch)
diff --git a/app/models/puppetclass.rb b/app/models/puppetclass.rb
index fe7ca1379..9a1c8b187 100644
--- a/app/models/puppetclass.rb
+++ b/app/models/puppetclass.rb
@@ -71,12 +71,12 @@ class Puppetclass < ApplicationRecord
   # returns module name (excluding of the class name)
   # if class separator does not exists (the "::" chars), then returns the whole class name
   def module_name
-    (i = name.index("::")) ? name[0..i-1] : name
+    (i = name.index("::")) ? name[0..i - 1] : name
   end
 
   # returns class name (excluding of the module name)
   def klass
-    name.gsub(module_name+"::", "")
+    name.gsub(module_name + "::", "")
   end
 
   def all_hostgroups(with_descendants = true, unsorted = false)
diff --git a/app/models/setting.rb b/app/models/setting.rb
index 3c2f6f344..9303b7184 100644
--- a/app/models/setting.rb
+++ b/app/models/setting.rb
@@ -8,7 +8,7 @@ class Setting < ApplicationRecord
   include EncryptValue
   self.inheritance_column = 'category'
 
-  TYPES= %w{integer boolean hash array string}
+  TYPES = %w{integer boolean hash array string}
   FROZEN_ATTRS = %w{name category full_name}
   NONZERO_ATTRS = %w{puppet_interval idle_timeout entries_per_page max_trend outofsync_interval}
   BLANK_ATTRS = %w{ host_owner trusted_hosts login_delegation_logout_url authorize_login_delegation_auth_source_user_autocreate root_pass default_location default_organization websockets_ssl_key websockets_ssl_cert oauth_consumer_key oauth_consumer_secret login_text
diff --git a/app/models/subnet.rb b/app/models/subnet.rb
index 8215af987..c079d9539 100644
--- a/app/models/subnet.rb
+++ b/app/models/subnet.rb
@@ -93,7 +93,7 @@ class Subnet < ApplicationRecord
                         :vlanid, :mtu, :ipam, :boot_mode, :type], :complete_value => true
 
   scoped_search :relation => :domains, :on => :name, :rename => :domain, :complete_value => true
-  scoped_search :relation => :subnet_parameters, :on => :value, :on_key=> :name, :complete_value => true, :only_explicit => true, :rename => :params
+  scoped_search :relation => :subnet_parameters, :on => :value, :on_key => :name, :complete_value => true, :only_explicit => true, :rename => :params
 
   delegate :supports_ipam_mode?, :supported_ipam_modes, :show_mask?, to: 'self.class'
 
@@ -235,8 +235,8 @@ class Subnet < ApplicationRecord
       errors.add(:to,   _("must be specified if from is defined")) if to.blank?
     end
     return if errors.key?(:from) || errors.key?(:to)
-    errors.add(:from, _("does not belong to subnet"))     if from.present? && !self.contains?(f=IPAddr.new(from))
-    errors.add(:to, _("does not belong to subnet"))       if to.present?   && !self.contains?(t=IPAddr.new(to))
+    errors.add(:from, _("does not belong to subnet"))     if from.present? && !self.contains?(f = IPAddr.new(from))
+    errors.add(:to, _("does not belong to subnet"))       if to.present?   && !self.contains?(t = IPAddr.new(to))
     errors.add(:from, _("can't be bigger than to range")) if from.present? && t.present? && f > t
   end
 
diff --git a/app/models/taxonomy.rb b/app/models/taxonomy.rb
index bfd9e6404..b37e16bb5 100644
--- a/app/models/taxonomy.rb
+++ b/app/models/taxonomy.rb
@@ -176,7 +176,7 @@ class Taxonomy < ApplicationRecord
   end
 
   def expire_topbar_cache
-    (users+User.only_admin).each { |u| u.expire_topbar_cache }
+    (users + User.only_admin).each { |u| u.expire_topbar_cache }
   end
 
   def parent_params(include_source = false)
diff --git a/app/models/usergroup_member.rb b/app/models/usergroup_member.rb
index 47066c9b7..418e5979c 100644
--- a/app/models/usergroup_member.rb
+++ b/app/models/usergroup_member.rb
@@ -134,7 +134,7 @@ class UsergroupMember < ApplicationRecord
   end
 
   def find_all_user_roles_for(usergroup)
-    (UserRole.where(:owner => usergroup)+ usergroup.parents.map { |g| find_all_user_roles_for(g) }).flatten
+    (UserRole.where(:owner => usergroup) + usergroup.parents.map { |g| find_all_user_roles_for(g) }).flatten
   end
 
   def find_all_usergroups
diff --git a/app/registries/foreman/access_permissions.rb b/app/registries/foreman/access_permissions.rb
index 2713843e9..8aa88ffe2 100644
--- a/app/registries/foreman/access_permissions.rb
+++ b/app/registries/foreman/access_permissions.rb
@@ -363,7 +363,7 @@ Foreman::AccessControl.map do |permission_set|
   end
 
   permission_set.security_block :host_editing do |map|
-    map.permission :edit_classes, { :host_editing  => [:edit_classes],
+    map.permission :edit_classes, { :host_editing => [:edit_classes],
                                     :"api/v2/host_classes" => [:index, :create, :destroy]
                                 }
     map.permission :view_params, { :host_editing => [:view_params],
@@ -664,7 +664,7 @@ Foreman::AccessControl.map do |permission_set|
   end
 
   permission_set.security_block :facts do |map|
-    map.permission :view_facts, {:facts       => [:index, :show],
+    map.permission :view_facts, {:facts => [:index, :show],
                                 :fact_values => [:index, :show, :auto_complete_search],
                                 :"api/v2/fact_values" => [:index, :show]
                               }
@@ -678,7 +678,7 @@ Foreman::AccessControl.map do |permission_set|
   end
 
   permission_set.security_block :statistics do |map|
-    map.permission :view_statistics, {:statistics  => [:index, :show],
+    map.permission :view_statistics, {:statistics => [:index, :show],
                                        :"api/v2/statistics" => [:index]
                                       }
   end
diff --git a/app/registries/foreman/plugin.rb b/app/registries/foreman/plugin.rb
index a4971b97b..f82d8e319 100644
--- a/app/registries/foreman/plugin.rb
+++ b/app/registries/foreman/plugin.rb
@@ -170,7 +170,7 @@ module Foreman #:nodoc:
     def requires_foreman(matcher)
       current = SETTINGS[:version].notag
       unless Gem::Dependency.new('', matcher).match?('', current)
-        raise PluginRequirementError.new(N_("%{id} plugin requires Foreman %{matcher} but current is %{current}" % {:id=>id, :matcher => matcher, :current=>current}))
+        raise PluginRequirementError.new(N_("%{id} plugin requires Foreman %{matcher} but current is %{current}" % {:id => id, :matcher => matcher, :current => current}))
       end
       true
     end
@@ -180,9 +180,9 @@ module Foreman #:nodoc:
     # matcher format is gem dependency format
     def requires_foreman_plugin(plugin_name, matcher)
       plugin = Plugin.find(plugin_name)
-      raise PluginNotFound.new(N_("%{id} plugin requires the %{plugin_name} plugin, not found") % {:id =>id, :plugin_name=>plugin_name}) unless plugin
+      raise PluginNotFound.new(N_("%{id} plugin requires the %{plugin_name} plugin, not found") % {:id => id, :plugin_name => plugin_name}) unless plugin
       unless Gem::Dependency.new('', matcher).match?('', plugin.version)
-        raise PluginRequirementError.new(N_("%{id} plugin requires the %{plugin_name} plugin %{matcher} but current is %{plugin_version}" % {:id=>id, :plugin_name=>plugin_name, :matcher=> matcher, :plugin_version=>plugin.version}))
+        raise PluginRequirementError.new(N_("%{id} plugin requires the %{plugin_name} plugin %{matcher} but current is %{plugin_version}" % {:id => id, :plugin_name => plugin_name, :matcher => matcher, :plugin_version => plugin.version}))
       end
       true
     end
diff --git a/app/registries/menu/item.rb b/app/registries/menu/item.rb
index 2bdacc732..bb0d080ec 100644
--- a/app/registries/menu/item.rb
+++ b/app/registries/menu/item.rb
@@ -27,7 +27,7 @@ module Menu
     end
 
     def url
-      add_relative_path(@url || @context.routes.url_for(url_hash.merge(:only_path=>true).except(:use_route)))
+      add_relative_path(@url || @context.routes.url_for(url_hash.merge(:only_path => true).except(:use_route)))
     end
 
     def url_hash
diff --git a/app/services/classification/matches_generator.rb b/app/services/classification/matches_generator.rb
index 8685aaed7..e101137c4 100644
--- a/app/services/classification/matches_generator.rb
+++ b/app/services/classification/matches_generator.rb
@@ -18,7 +18,7 @@ module Classification
         matches << match.join(LookupKey::KEY_DELM)
 
         hostgroup_matches.each do |hostgroup_match|
-          match[match.index { |m| m =~ /hostgroup\s*=/ }]=hostgroup_match
+          match[match.index { |m| m =~ /hostgroup\s*=/ }] = hostgroup_match
           matches << match.join(LookupKey::KEY_DELM)
         end if add_hostgroup_matches?(rule)
       end
@@ -68,7 +68,7 @@ module Classification
       if host.hostgroup
         path = host.hostgroup.to_label
         while path.include?("/")
-          path = path[0..path.rindex("/")-1]
+          path = path[0..path.rindex("/") - 1]
           matches << "hostgroup#{LookupKey::EQ_DELM}#{path}"
         end
       end
diff --git a/app/services/classification/values_hash_query.rb b/app/services/classification/values_hash_query.rb
index 788f42def..301e819f9 100644
--- a/app/services/classification/values_hash_query.rb
+++ b/app/services/classification/values_hash_query.rb
@@ -95,7 +95,7 @@ module Classification
         computed_lookup_value = nil
         lookup_values.each do |lookup_value|
           element, element_name = get_element_and_element_name(lookup_value)
-          next if (options[:skip_fqdn] && element=="fqdn")
+          next if (options[:skip_fqdn] && element == "fqdn")
           computed_lookup_value = compute_lookup_value(lookup_value, element, element_name)
           computed_lookup_value[:managed] = lookup_value.omit if lookup_value.lookup_key.puppet?
           break
@@ -129,7 +129,7 @@ module Classification
       end
 
       def skip_value?(element, lookup_value, options)
-        ((options[:skip_fqdn] && element=="fqdn") || lookup_value.omit)
+        ((options[:skip_fqdn] && element == "fqdn") || lookup_value.omit)
       end
 
       def accumulate_value(values, lookup_value, should_avoid_duplicates)
diff --git a/app/services/foreman/provision/ssh.rb b/app/services/foreman/provision/ssh.rb
index 92a4d10ee..d3e3d8d19 100644
--- a/app/services/foreman/provision/ssh.rb
+++ b/app/services/foreman/provision/ssh.rb
@@ -53,7 +53,7 @@ class Foreman::Provision::SSH
   def command
     # Use the users home to store the provision script since we can't reliably
     # tell if other locations are writeable or executable by the user.
-    main_execution="(chmod 0701 ./#{remote_script} && #{command_prefix} ./#{remote_script} ; echo $? >#{remote_script}.status) 2>&1"
+    main_execution = "(chmod 0701 ./#{remote_script} && #{command_prefix} ./#{remote_script} ; echo $? >#{remote_script}.status) 2>&1"
     "#{command_prefix} sh -c '#{main_execution} | tee #{remote_script}.log; exit $(cat #{remote_script}.status)'"
   end
 
diff --git a/app/services/password_crypt.rb b/app/services/password_crypt.rb
index 024753b97..a41b95513 100644
--- a/app/services/password_crypt.rb
+++ b/app/services/password_crypt.rb
@@ -4,7 +4,7 @@ class PasswordCrypt
   ALGORITHMS = {'SHA256' => '$5$', 'SHA512' => '$6$', 'Base64' => ''}
 
   if Foreman::Fips.md5_available?
-    ALGORITHMS['MD5']= '$1$'
+    ALGORITHMS['MD5'] = '$1$'
   end
 
   def self.passw_crypt(passwd, hash_alg = 'SHA256')
diff --git a/app/services/proxy_status/base.rb b/app/services/proxy_status/base.rb
index 28d6c1fa3..192aef45c 100644
--- a/app/services/proxy_status/base.rb
+++ b/app/services/proxy_status/base.rb
@@ -7,7 +7,7 @@ module ProxyStatus
     end
 
     def revoke_cache!(subkey = '')
-      Rails.cache.delete(cache_key+subkey)
+      Rails.cache.delete(cache_key + subkey)
     end
 
     def cache_key
@@ -45,7 +45,7 @@ module ProxyStatus
 
     def fetch_proxy_data(subkey = '')
       if cache
-        Rails.cache.fetch(cache_key+subkey, :expires_in => cache_duration) do
+        Rails.cache.fetch(cache_key + subkey, :expires_in => cache_duration) do
           yield
         end
       else
diff --git a/app/services/sso/apache.rb b/app/services/sso/apache.rb
index b8b954bb4..2712fb96a 100644
--- a/app/services/sso/apache.rb
+++ b/app/services/sso/apache.rb
@@ -32,7 +32,7 @@ module SSO
       group_count = request.env['REMOTE_USER_GROUP_N'].to_i
       if group_count > 0
         attrs[:groups] = []
-        group_count.times { |i| attrs[:groups]<< request.env["REMOTE_USER_GROUP_#{i+1}"] }
+        group_count.times { |i| attrs[:groups] << request.env["REMOTE_USER_GROUP_#{i + 1}"] }
       end
 
       return false unless User.find_or_create_external_user(attrs, Setting['authorize_login_delegation_auth_source_user_autocreate'])
diff --git a/app/services/statistics.rb b/app/services/statistics.rb
index 243022385..fb94a3c7e 100644
--- a/app/services/statistics.rb
+++ b/app/services/statistics.rb
@@ -1,7 +1,7 @@
 module Statistics
   def self.charts(org_id, loc_id)
     charts = [
-      CountHosts.new(:count_by => :operatingsystem, :title => "OS Distribution", :search =>"os_title=~VAL~", :organization_id => org_id, :location_id => loc_id),
+      CountHosts.new(:count_by => :operatingsystem, :title => "OS Distribution", :search => "os_title=~VAL~", :organization_id => org_id, :location_id => loc_id),
       CountHosts.new(:count_by => :architecture, :title => _("Architecture Distribution"), :search => "facts.architecture=~VAL~", :organization_id => org_id, :location_id => loc_id),
       CountHosts.new(:count_by => :environment, :title => _("Environment Distribution"), :search => "environment=~VAL~", :organization_id => org_id, :location_id => loc_id),
       CountHosts.new(:count_by => :hostgroup, :title => _("Host Group Distribution"), :search => "hostgroup_title=~VAL~", :organization_id => org_id, :location_id => loc_id),
diff --git a/db/migrate/20120624081510_add_auditable_name_and_associated_name_to_audit.rb b/db/migrate/20120624081510_add_auditable_name_and_associated_name_to_audit.rb
index cfa0af2aa..e8bdba46a 100644
--- a/db/migrate/20120624081510_add_auditable_name_and_associated_name_to_audit.rb
+++ b/db/migrate/20120624081510_add_auditable_name_and_associated_name_to_audit.rb
@@ -10,8 +10,8 @@ class AddAuditableNameAndAssociatedNameToAudit < ActiveRecord::Migration[4.2]
         attr = {}
         auditable_name  ||= audit.auditable.try(:to_label)  rescue nil
         associated_name ||= audit.associated.try(:to_label) rescue nil
-        attr[:auditable_name] = auditable_name  if auditable_name
-        attr[:associated_name]= associated_name if associated_name
+        attr[:auditable_name] = auditable_name if auditable_name
+        attr[:associated_name] = associated_name if associated_name
         if audit.username.empty? && audit.user
           username = audit.user.to_label rescue nil
           attr[:username] = username unless username.empty?
diff --git a/db/migrate/20131104132542_update_foreman_url.rb b/db/migrate/20131104132542_update_foreman_url.rb
index c712ec8d8..187d38e41 100644
--- a/db/migrate/20131104132542_update_foreman_url.rb
+++ b/db/migrate/20131104132542_update_foreman_url.rb
@@ -4,8 +4,8 @@ class UpdateForemanUrl < ActiveRecord::Migration[4.2]
   def up
     return unless (val = Setting.find_by_name('foreman_url').try(:value))
     if URI.parse(val).host.nil?
-      protocol=SETTINGS[:require_ssl] ? 'https' : 'http'
-      Setting[:foreman_url]="#{protocol}://#{val}"
+      protocol = SETTINGS[:require_ssl] ? 'https' : 'http'
+      Setting[:foreman_url] = "#{protocol}://#{val}"
     end
   end
 
diff --git a/db/migrate/20140325093623_add_lowerlogin_to_users.rb b/db/migrate/20140325093623_add_lowerlogin_to_users.rb
index 8b9f955ee..63deab18a 100644
--- a/db/migrate/20140325093623_add_lowerlogin_to_users.rb
+++ b/db/migrate/20140325093623_add_lowerlogin_to_users.rb
@@ -8,7 +8,7 @@ class AddLowerloginToUsers < ActiveRecord::Migration[4.2]
     User.unscoped.order("last_login_on DESC").each do |user|
       if User.find_by_login(user.login.downcase)
         dupe = 1
-        dupe += 1 while User.find_by_login(new_login="#{user.login}#{dupe}")
+        dupe += 1 while User.find_by_login(new_login = "#{user.login}#{dupe}")
         say "Renaming duplicate user #{user.login} to #{new_login}"
         user.login = new_login
       else
diff --git a/db/migrate/20150519142008_remove_total_hosts_audits.rb b/db/migrate/20150519142008_remove_total_hosts_audits.rb
index 7239674f0..2f4d80e19 100644
--- a/db/migrate/20150519142008_remove_total_hosts_audits.rb
+++ b/db/migrate/20150519142008_remove_total_hosts_audits.rb
@@ -1,6 +1,6 @@
 class RemoveTotalHostsAudits < ActiveRecord::Migration[4.2]
   def up
-    Audit.where(:auditable_type=> 'Puppetclass').where(Audit.arel_table[:audited_changes].matches("%total_hosts%")).delete_all
+    Audit.where(:auditable_type => 'Puppetclass').where(Audit.arel_table[:audited_changes].matches("%total_hosts%")).delete_all
   end
 
   def down
diff --git a/db/seeds.d/150-bookmarks.rb b/db/seeds.d/150-bookmarks.rb
index 5f3a9ad6d..e1ac1ecaa 100644
--- a/db/seeds.d/150-bookmarks.rb
+++ b/db/seeds.d/150-bookmarks.rb
@@ -1,12 +1,12 @@
 # Bookmarks
 Bookmark.without_auditing do
   [
-    { :name => "eventful", :query => "eventful = true", :controller=> "config_reports" },
-    { :name => "active", :query => 'last_report > "35 minutes ago" and (status.applied > 0 or status.restarted > 0)', :controller=> "hosts" },
-    { :name => "out of sync", :query => 'last_report < "30 minutes ago" and status.enabled = true', :controller=> "hosts" },
-    { :name => "error", :query => 'last_report > "35 minutes ago" and (status.failed > 0 or status.failed_restarts > 0 or status.skipped > 0)', :controller=> "hosts" },
-    { :name => "disabled", :query => 'status.enabled = false', :controller=> "hosts" },
-    { :name => "ok hosts", :query => 'last_report > "35 minutes ago" and status.enabled = true and status.applied = 0 and status.failed = 0 and status.pending = 0', :controller=> "hosts" }
+    { :name => "eventful", :query => "eventful = true", :controller => "config_reports" },
+    { :name => "active", :query => 'last_report > "35 minutes ago" and (status.applied > 0 or status.restarted > 0)', :controller => "hosts" },
+    { :name => "out of sync", :query => 'last_report < "30 minutes ago" and status.enabled = true', :controller => "hosts" },
+    { :name => "error", :query => 'last_report > "35 minutes ago" and (status.failed > 0 or status.failed_restarts > 0 or status.skipped > 0)', :controller => "hosts" },
+    { :name => "disabled", :query => 'status.enabled = false', :controller => "hosts" },
+    { :name => "ok hosts", :query => 'last_report > "35 minutes ago" and status.enabled = true and status.applied = 0 and status.failed = 0 and status.pending = 0', :controller => "hosts" }
   ].each do |input|
     next if Bookmark.where(:controller => input[:controller], :name => input[:name]).first
     next if SeedHelper.audit_modified? Bookmark, input[:name], :controller => input[:controller]
diff --git a/extras/changelog b/extras/changelog
index 25bb58346..1a2ae5181 100755
--- a/extras/changelog
+++ b/extras/changelog
@@ -1,6 +1,6 @@
 #!/usr/bin/env ruby
 
-cmd=`git log --pretty='format:%ci::%an <%ae>::%s'`
+cmd = `git log --pretty='format:%ci::%an <%ae>::%s'`
 
 list = {}
 list_order = []
diff --git a/lib/core_extensions.rb b/lib/core_extensions.rb
index eff457bae..701e3cba2 100644
--- a/lib/core_extensions.rb
+++ b/lib/core_extensions.rb
@@ -67,7 +67,7 @@ class ActiveRecord::Base
       @base  = base.map { |record| [record.send(@source), record.send(@target)] }
       @nodes = @base.flatten.uniq
       @graph = Hash.new { |h, k| h[k] = [] }
-      @base.each { |s, t| @graph[s]<< t }
+      @base.each { |s, t| @graph[s] << t }
     end
 
     def tsort_each_node(&block)
@@ -88,7 +88,7 @@ class ActiveRecord::Base
 
     def add_new_edges
       edges = @graph[@record.send(@source) || 0]
-      edges<< @record.send(@target) unless edges.include?(@record.send(@target))
+      edges << @record.send(@target) unless edges.include?(@record.send(@target))
     end
 
     def detect_cycle
diff --git a/lib/foreman/gettext/debug.rb b/lib/foreman/gettext/debug.rb
index 4ad76d052..cba6d9b24 100644
--- a/lib/foreman/gettext/debug.rb
+++ b/lib/foreman/gettext/debug.rb
@@ -20,7 +20,7 @@ module Foreman::Gettext::Debug
       result = FastGettext::TranslationMultidomain.dn_(domain, *keys) {nil}
       return DL + result.to_s + DR unless result.nil?
     end
-    DL + keys[-3].split(keys[-2]||FastGettext::NAMESPACE_SEPARATOR).last.to_s + DR
+    DL + keys[-3].split(keys[-2] || FastGettext::NAMESPACE_SEPARATOR).last.to_s + DR
   end
 
   # slightly modified copy of fast_gettext D_* method
@@ -29,7 +29,7 @@ module Foreman::Gettext::Debug
       result = FastGettext::TranslationMultidomain.ds_(domain, key, separator) {nil}
       return DL + result.to_s + DR unless result.nil?
     end
-    DL + key.split(separator||FastGettext::NAMESPACE_SEPARATOR).last.to_s + DR
+    DL + key.split(separator || FastGettext::NAMESPACE_SEPARATOR).last.to_s + DR
   end
 
   # slightly modified copy of fast_gettext D_* method
diff --git a/lib/proxy_api/dhcp.rb b/lib/proxy_api/dhcp.rb
index cb8880198..31c1bd43e 100644
--- a/lib/proxy_api/dhcp.rb
+++ b/lib/proxy_api/dhcp.rb
@@ -1,7 +1,7 @@
 module ProxyAPI
   class DHCP < ProxyAPI::Resource
     def initialize(args)
-      @url  = args[:url] + "/dhcp"
+      @url = args[:url] + "/dhcp"
       super args
     end
 
diff --git a/lib/proxy_api/dns.rb b/lib/proxy_api/dns.rb
index 29fc87bd5..9ba82e64f 100644
--- a/lib/proxy_api/dns.rb
+++ b/lib/proxy_api/dns.rb
@@ -1,7 +1,7 @@
 module ProxyAPI
   class DNS < ProxyAPI::Resource
     def initialize(args)
-      @url  = args[:url] + "/dns"
+      @url = args[:url] + "/dns"
       super args
     end
 
diff --git a/lib/proxy_api/features.rb b/lib/proxy_api/features.rb
index a92d5372d..1a6c565d6 100644
--- a/lib/proxy_api/features.rb
+++ b/lib/proxy_api/features.rb
@@ -1,7 +1,7 @@
 module ProxyAPI
   class Features < ProxyAPI::Resource
     def initialize(args)
-      @url  = args[:url] + "/features"
+      @url = args[:url] + "/features"
       super args
     end
 
diff --git a/lib/proxy_api/puppet.rb b/lib/proxy_api/puppet.rb
index 929cf66ca..c5275c849 100644
--- a/lib/proxy_api/puppet.rb
+++ b/lib/proxy_api/puppet.rb
@@ -1,7 +1,7 @@
 module ProxyAPI
   class Puppet < ProxyAPI::Resource
     def initialize(args)
-      @url  = args[:url] + "/puppet"
+      @url = args[:url] + "/puppet"
       super args
     end
 
diff --git a/lib/proxy_api/puppetca.rb b/lib/proxy_api/puppetca.rb
index 53071cca0..b97ee8a87 100644
--- a/lib/proxy_api/puppetca.rb
+++ b/lib/proxy_api/puppetca.rb
@@ -1,7 +1,7 @@
 module ProxyAPI
   class Puppetca < ProxyAPI::Resource
     def initialize(args)
-      @url  = args[:url] + "/puppet/ca"
+      @url = args[:url] + "/puppet/ca"
       super args
     end
 
diff --git a/lib/proxy_api/realm.rb b/lib/proxy_api/realm.rb
index dadf16b8a..d7f61c318 100644
--- a/lib/proxy_api/realm.rb
+++ b/lib/proxy_api/realm.rb
@@ -1,7 +1,7 @@
 module ProxyAPI
   class Realm < Resource
     def initialize(args)
-      @url  = "#{args[:url]}/realm/#{args[:realm_name]}"
+      @url = "#{args[:url]}/realm/#{args[:realm_name]}"
       super args
     end
 
diff --git a/lib/tasks/convert.rake b/lib/tasks/convert.rake
index e5d66e965..a16135680 100644
--- a/lib/tasks/convert.rake
+++ b/lib/tasks/convert.rake
@@ -60,7 +60,7 @@
 # PAGE_SIZE is the number of rows updated in a single transaction.
 # This facilitates tables where the number of rows exceeds the systems
 # memory
-PAGE_SIZE=10000
+PAGE_SIZE = 10000
 
 namespace :db do
   namespace :convert do
@@ -84,7 +84,7 @@ namespace :db do
         time = Time.now
 
         ProductionModelClass.establish_connection(:production)
-        ProductionModelClass.table_name=table_name
+        ProductionModelClass.table_name = table_name
         ProductionModelClass.reset_column_information
 
         DevelopmentModelClass.establish_connection(:development)
@@ -97,7 +97,7 @@ namespace :db do
               end
         DevelopmentModelClass.connection.execute(sql) if sql
 
-        DevelopmentModelClass.table_name=table_name
+        DevelopmentModelClass.table_name = table_name
         DevelopmentModelClass.reset_column_information
         DevelopmentModelClass.record_timestamps = false
 
diff --git a/lib/tasks/hosts.rake b/lib/tasks/hosts.rake
index 75f323d51..3600c4b5a 100644
--- a/lib/tasks/hosts.rake
+++ b/lib/tasks/hosts.rake
@@ -28,7 +28,7 @@ namespace :hosts do
       unless list.empty?
         puts
         puts "Found #{list.size} #{description}:"
-        puts "Name".ljust(40)+"Environment".ljust(20)+"Last Report"
+        puts "Name".ljust(40) + "Environment".ljust(20) + "Last Report"
         puts '*' * 80
         list.each do |h|
           puts h.name.ljust(40) + h.environment.to_s.ljust(20) + h.last_report.to_s(:short)
diff --git a/lib/tasks/reports.rake b/lib/tasks/reports.rake
index fd3d28e3b..f18c9e5a7 100644
--- a/lib/tasks/reports.rake
+++ b/lib/tasks/reports.rake
@@ -71,7 +71,7 @@ namespace :reports do
 
     env = ENV['environment']
     unless env.empty?
-      unless (e=Environment.find_by_name(env))
+      unless (e = Environment.find_by_name(env))
         $stdout.puts "Unable to find puppet environment=#{env}"
         exit 1
       end
diff --git a/lib/tasks/telemetry.rake b/lib/tasks/telemetry.rake
index a1636b0ad..f31a3266b 100644
--- a/lib/tasks/telemetry.rake
+++ b/lib/tasks/telemetry.rake
@@ -23,7 +23,7 @@ namespace :telemetry do
         metric["name"] = m_name
         metric["match"] = m_name + (".*" * m_labels.count)
         m_labels.each_with_index do |label, i|
-          labels[label.to_s] = "$#{i+1}"
+          labels[label.to_s] = "$#{i + 1}"
         end
         metric["labels"] = labels
         metric["help"] = m_desc
diff --git a/test/benchmark/memory/puppet_fact_importer_benchmark.rb b/test/benchmark/memory/puppet_fact_importer_benchmark.rb
index 59d5be8a8..c697e7134 100644
--- a/test/benchmark/memory/puppet_fact_importer_benchmark.rb
+++ b/test/benchmark/memory/puppet_fact_importer_benchmark.rb
@@ -16,8 +16,8 @@ end
 
 def generate_facts(total, unique_names = 0, structured_names = 0)
   facts = Hash[(1..total).map{|i| ["fact_#{i}", "value_#{i}"]}]
-  (total..total+unique_names).map{|i| facts["fact_#{i}_#{Foreman.uuid}"] = "value_#{i}"}
-  (total..total+structured_names).map{|i| facts[(["f#{i}"] * (i % 10)).join('::') + i.to_s] = "value_#{i}"}
+  (total..total + unique_names).map{|i| facts["fact_#{i}_#{Foreman.uuid}"] = "value_#{i}"}
+  (total..total + structured_names).map{|i| facts[(["f#{i}"] * (i % 10)).join('::') + i.to_s] = "value_#{i}"}
   facts
 end
 
diff --git a/test/benchmark/puppet_fact_importer_benchmark.rb b/test/benchmark/puppet_fact_importer_benchmark.rb
index f3c569014..ca2e54f5a 100644
--- a/test/benchmark/puppet_fact_importer_benchmark.rb
+++ b/test/benchmark/puppet_fact_importer_benchmark.rb
@@ -14,8 +14,8 @@ end
 
 def generate_facts(total, unique_names = 0, structured_names = 0)
   facts = Hash[(1..total).map{|i| ["fact_#{i}", "value_#{i}"]}]
-  (total..total+unique_names).map{|i| facts["fact_#{i}_#{Foreman.uuid}"] = "value_#{i}"}
-  (total..total+structured_names).map{|i| facts[(["f#{i}"] * (i % 10)).join('::') + i.to_s] = "value_#{i}"}
+  (total..total + unique_names).map{|i| facts["fact_#{i}_#{Foreman.uuid}"] = "value_#{i}"}
+  (total..total + structured_names).map{|i| facts[(["f#{i}"] * (i % 10)).join('::') + i.to_s] = "value_#{i}"}
   facts
 end
 
diff --git a/test/controllers/api/v2/compute_attributes_controller_test.rb b/test/controllers/api/v2/compute_attributes_controller_test.rb
index 843eb40d8..d06d7b229 100644
--- a/test/controllers/api/v2/compute_attributes_controller_test.rb
+++ b/test/controllers/api/v2/compute_attributes_controller_test.rb
@@ -3,7 +3,7 @@ require 'test_helper'
 class Api::V2::ComputeAttributesControllerTest < ActionController::TestCase
   test "should create compute attribute" do
     assert_difference('ComputeAttribute.count') do
-      valid_attrs = {:vm_attrs => {"cpus"=>"2", "memory"=>"2147483648"}}
+      valid_attrs = {:vm_attrs => {"cpus" => "2", "memory" => "2147483648"}}
       post :create, params: { :compute_attribute => valid_attrs,
                               :compute_profile_id => compute_profiles(:three).id,
                               :compute_resource_id => compute_resources(:one).id }
@@ -12,10 +12,10 @@ class Api::V2::ComputeAttributesControllerTest < ActionController::TestCase
   end
 
   test "should update compute attribute" do
-    valid_attrs = {:vm_attrs => {"cpus"=>"4"}}
+    valid_attrs = {:vm_attrs => {"cpus" => "4"}}
     put :update, params: { :id => compute_attributes(:two).id,
                            :compute_profile_id => compute_profiles(:one).id,
-                           :compute_resource_id =>compute_resources(:one).id,
+                           :compute_resource_id => compute_resources(:one).id,
                            :compute_attribute => valid_attrs }
     assert_response :success
     assert_equal "4", compute_attributes(:two).reload.vm_attrs['cpus']
diff --git a/test/controllers/api/v2/config_reports_controller_test.rb b/test/controllers/api/v2/config_reports_controller_test.rb
index db8e02697..c21cabf36 100644
--- a/test/controllers/api/v2/config_reports_controller_test.rb
+++ b/test/controllers/api/v2/config_reports_controller_test.rb
@@ -14,19 +14,19 @@ class Api::V2::ConfigReportsControllerTest < ActionController::TestCase
     end
 
     def test_create_valid
-      User.current=nil
+      User.current = nil
       post :create, params: { :config_report => create_a_puppet_transaction_report }, session: set_session_user
       assert_response :success
     end
 
     def test_create_invalid
-      User.current=nil
+      User.current = nil
       post :create, params: { :config_report => ["not a hash", "throw an error"] }, session: set_session_user
       assert_response :unprocessable_entity
     end
 
     def test_create_duplicate
-      User.current=nil
+      User.current = nil
       post :create, params: { :config_report => create_a_puppet_transaction_report }, session: set_session_user
       assert_response :success
       post :create, params: { :config_report => create_a_puppet_transaction_report }, session: set_session_user
diff --git a/test/controllers/api/v2/hosts_controller_test.rb b/test/controllers/api/v2/hosts_controller_test.rb
index bb3ef9bde..8a9aada68 100644
--- a/test/controllers/api/v2/hosts_controller_test.rb
+++ b/test/controllers/api/v2/hosts_controller_test.rb
@@ -526,7 +526,7 @@ class Api::V2::HostsControllerTest < ActionController::TestCase
   end
 
   def test_create_valid_node_from_json_facts_object_without_certname
-    User.current=nil
+    User.current = nil
     hostname = fact_json['name']
     facts    = fact_json['facts']
     post :facts, params: { :name => hostname, :facts => facts }, session: set_session_user
@@ -534,7 +534,7 @@ class Api::V2::HostsControllerTest < ActionController::TestCase
   end
 
   def test_create_valid_node_from_json_facts_object_with_certname
-    User.current=nil
+    User.current = nil
     hostname = fact_json['name']
     certname = fact_json['certname']
     facts    = fact_json['facts']
@@ -543,7 +543,7 @@ class Api::V2::HostsControllerTest < ActionController::TestCase
   end
 
   def test_create_invalid
-    User.current=nil
+    User.current = nil
     hostname = fact_json['name']
     facts    = fact_json['facts'].except('operatingsystem')
     post :facts, params: { :name => hostname, :facts => facts }, session: set_session_user
@@ -685,7 +685,7 @@ class Api::V2::HostsControllerTest < ActionController::TestCase
   end
 
   test "when a bad :type is requested, :unprocessable_entity is returned" do
-    User.current=nil
+    User.current = nil
     hostname = fact_json['name']
     facts    = fact_json['facts']
     post :facts, params: { :name => hostname, :facts => facts, :type => "Host::Invalid" }, session: set_session_user
@@ -699,7 +699,7 @@ class Api::V2::HostsControllerTest < ActionController::TestCase
     errors = ActiveModel::Errors.new(Host::Managed.new)
     errors.add :foo, 'A stub failure'
     Host::Managed.any_instance.stubs(:errors).returns(errors)
-    User.current=nil
+    User.current = nil
     hostname = fact_json['name']
     facts    = fact_json['facts']
     post :facts, params: { :name => hostname, :facts => facts }, session: set_session_user
diff --git a/test/controllers/api/v2/operatingsystems_controller_test.rb b/test/controllers/api/v2/operatingsystems_controller_test.rb
index d20081c73..92adc75e0 100644
--- a/test/controllers/api/v2/operatingsystems_controller_test.rb
+++ b/test/controllers/api/v2/operatingsystems_controller_test.rb
@@ -204,7 +204,7 @@ class Api::V2::OperatingsystemsControllerTest < ActionController::TestCase
   end
 
   test "should create os with os parameters" do
-    os_with_params = os_params.merge(:os_parameters_attributes => {'0'=>{:name => "foo", :value => "bar"}})
+    os_with_params = os_params.merge(:os_parameters_attributes => {'0' => {:name => "foo", :value => "bar"}})
     assert_difference('OsParameter.count') do
       assert_difference('Operatingsystem.count') do
         post :create, params: { :operatingsystem => os_with_params }
diff --git a/test/controllers/api/v2/organizations_controller_test.rb b/test/controllers/api/v2/organizations_controller_test.rb
index 37c1c3be1..bda35356f 100755
--- a/test/controllers/api/v2/organizations_controller_test.rb
+++ b/test/controllers/api/v2/organizations_controller_test.rb
@@ -131,7 +131,7 @@ class Api::V2::OrganizationsControllerTest < ActionController::TestCase
 
   test "search organization" do
     organization = Organization.first
-    get :index, params: { :search =>  "name = \"#{organization.name}\"", :format => 'json' }
+    get :index, params: { :search => "name = \"#{organization.name}\"", :format => 'json' }
     assert_response :success, "search organization name: '#{organization.name}' failed with code: #{@response.code}"
     response = JSON.parse(@response.body)
     assert_equal response['results'].length, 1
diff --git a/test/controllers/api/v2/provisioning_templates_controller_test.rb b/test/controllers/api/v2/provisioning_templates_controller_test.rb
index a0f340fc1..d7259448d 100644
--- a/test/controllers/api/v2/provisioning_templates_controller_test.rb
+++ b/test/controllers/api/v2/provisioning_templates_controller_test.rb
@@ -63,13 +63,13 @@ class Api::V2::ProvisioningTemplatesControllerTest < ActionController::TestCase
 
   test "should update valid" do
     ProvisioningTemplate.any_instance.stubs(:valid?).returns(true)
-    put :update, params: { :id              => templates(:pxekickstart).to_param,
+    put :update, params: { :id => templates(:pxekickstart).to_param,
                            :provisioning_template => { :template => "blah" } }
     assert_response :ok
   end
 
   test "should not update invalid" do
-    put :update, params: { :id              => templates(:pxekickstart).to_param,
+    put :update, params: { :id => templates(:pxekickstart).to_param,
                            :provisioning_template => { :name => "" } }
     assert_response 422
   end
@@ -99,7 +99,7 @@ class Api::V2::ProvisioningTemplatesControllerTest < ActionController::TestCase
   test "should add audit comment" do
     ProvisioningTemplate.auditing_enabled = true
     ProvisioningTemplate.any_instance.stubs(:valid?).returns(true)
-    put :update, params: { :id              => templates(:pxekickstart).to_param,
+    put :update, params: { :id => templates(:pxekickstart).to_param,
                            :provisioning_template => { :audit_comment => "aha", :template => "tmp" } }
     assert_response :success
     assert_equal "aha", templates(:pxekickstart).audits.last.comment
diff --git a/test/controllers/api/v2/ptables_controller_test.rb b/test/controllers/api/v2/ptables_controller_test.rb
index ede2c053f..6cedf11ef 100644
--- a/test/controllers/api/v2/ptables_controller_test.rb
+++ b/test/controllers/api/v2/ptables_controller_test.rb
@@ -149,7 +149,7 @@ class Api::V2::PtablesControllerTest < ActionController::TestCase
 
   test_attributes :pid => '08520746-444b-47c9-a8a3-438170147453'
   test "search ptable" do
-    get :index, params: { :search =>  @ptable.name, :format => 'json' }
+    get :index, params: { :search => @ptable.name, :format => 'json' }
     assert_response :success, "search ptable name: '#{@ptable.name}' failed with code: #{@response.code}"
     response = JSON.parse(@response.body)
     assert_equal response['results'].length, 1
diff --git a/test/controllers/api/v2/reports_controller_test.rb b/test/controllers/api/v2/reports_controller_test.rb
index 2e4f4ce46..96d411643 100644
--- a/test/controllers/api/v2/reports_controller_test.rb
+++ b/test/controllers/api/v2/reports_controller_test.rb
@@ -18,19 +18,19 @@ class Api::V2::ReportsControllerTest < ActionController::TestCase
     end
 
     def test_create_valid
-      User.current=nil
+      User.current = nil
       post :create, params: { :report => create_a_puppet_transaction_report }, session: set_session_user
       assert_response :success
     end
 
     def test_create_invalid
-      User.current=nil
+      User.current = nil
       post :create, params: { :report => ["not a hash", "throw an error"] }, session: set_session_user
       assert_response :unprocessable_entity
     end
 
     def test_create_duplicate
-      User.current=nil
+      User.current = nil
       post :create, params: { :report => create_a_puppet_transaction_report }, session: set_session_user
       assert_response :success
       Foreman::Deprecation.expects(:api_deprecation_warning)
diff --git a/test/controllers/api/v2/smart_variables_controller_test.rb b/test/controllers/api/v2/smart_variables_controller_test.rb
index be5c95908..f7b7a12ef 100644
--- a/test/controllers/api/v2/smart_variables_controller_test.rb
+++ b/test/controllers/api/v2/smart_variables_controller_test.rb
@@ -49,7 +49,7 @@ class Api::V2::SmartVariablesControllerTest < ActionController::TestCase
   test_attributes :pid => '4cd20cca-d419-43f5-9734-e9ae1caae4cb'
   test "should create a smart variable" do
     variable_name = 'test_smart_variable'
-    puppetclass_id  = puppetclasses(:one).id
+    puppetclass_id = puppetclasses(:one).id
     assert_difference('LookupKey.count') do
       as_admin do
         valid_attrs = { :variable => variable_name, :puppetclass_id => puppetclass_id }
diff --git a/test/controllers/api/v2/usergroups_controller_test.rb b/test/controllers/api/v2/usergroups_controller_test.rb
index 10ca31255..6bcdf90f0 100644
--- a/test/controllers/api/v2/usergroups_controller_test.rb
+++ b/test/controllers/api/v2/usergroups_controller_test.rb
@@ -96,7 +96,7 @@ class Api::V2::UsergroupsControllerTest < ActionController::TestCase
   end
 
   test "should update usergroup with usergroup" do
-    usergroup  = FactoryBot.create(:usergroup)
+    usergroup = FactoryBot.create(:usergroup)
     put :update, params: { :id => @usergroup.to_param, :usergroup => valid_attrs.clone.update(:usergroup_ids => [usergroup.id]) }
     assert_response :success
     assert_equal JSON.parse(@response.body)["usergroups"][0]["name"], usergroup.name, "Can't update usergroup with user #{usergroup}"
diff --git a/test/controllers/api/v2/users_controller_test.rb b/test/controllers/api/v2/users_controller_test.rb
index 0cda434bc..a9a623f0a 100644
--- a/test/controllers/api/v2/users_controller_test.rb
+++ b/test/controllers/api/v2/users_controller_test.rb
@@ -90,14 +90,14 @@ class Api::V2::UsersControllerTest < ActionController::TestCase
   test "should not remove the default role" do
     user = User.create :login => "foo", :mail => "foo@bar.com", :auth_source => auth_sources(:one)
 
-    assert user.roles =[roles(:default_role)]
+    assert user.roles = [roles(:default_role)]
 
     put :update, params: { :id => user.id, :user => { :mail => "bar@foo.com" } }
     assert_response :success
 
     mod_user = User.unscoped.find_by_id(user.id)
 
-    assert mod_user.roles =[roles(:default_role)]
+    assert mod_user.roles = [roles(:default_role)]
   end
 
   test "should set password" do
diff --git a/test/controllers/compute_attributes_controller_test.rb b/test/controllers/compute_attributes_controller_test.rb
index 7d2e7aaf0..c5c9ec716 100644
--- a/test/controllers/compute_attributes_controller_test.rb
+++ b/test/controllers/compute_attributes_controller_test.rb
@@ -22,7 +22,7 @@ class ComputeAttributesControllerTest < ActionController::TestCase
     assert_difference('ComputeAttribute.count') do
       # create 3-Large that doesn't exist in fixtures
       post :create, params: { :compute_profile_id => @compute_profile.to_param,
-                              :compute_attribute => { :compute_resource_id => @compute_resource.to_param, :compute_profile_id => compute_profiles(:three), :vm_attrs => {"flavor_id"=>"t2.medium"} } }, session: set_session_user
+                              :compute_attribute => { :compute_resource_id => @compute_resource.to_param, :compute_profile_id => compute_profiles(:three), :vm_attrs => {"flavor_id" => "t2.medium"} } }, session: set_session_user
     end
     assert_redirected_to compute_profile_path(assigns(:set).compute_profile)
     assert_equal "t2.medium", assigns(:set).vm_attrs['flavor_id']
@@ -36,7 +36,7 @@ class ComputeAttributesControllerTest < ActionController::TestCase
   test "should update compute_attribute" do
     put :update, params: { :id => @set,
                            :compute_profile_id => @compute_profile.to_param,
-                           :compute_attribute => { :compute_resource_id => @set.compute_resource_id, :compute_profile_id => @set.compute_profile_id, :vm_attrs => {"flavor_id"=>"t2.medium"} } }, session: set_session_user
+                           :compute_attribute => { :compute_resource_id => @set.compute_resource_id, :compute_profile_id => @set.compute_profile_id, :vm_attrs => {"flavor_id" => "t2.medium"} } }, session: set_session_user
     assert_redirected_to compute_profile_path(@set.compute_profile)
     assert_equal "t2.medium", compute_attributes(:one).reload.vm_attrs['flavor_id']
   end
@@ -55,7 +55,7 @@ class ComputeAttributesControllerTest < ActionController::TestCase
       }
     }, session: set_session_user
     saved_attrs = compute_attributes(:one).reload.vm_attrs
-    assert_equal [{"type"=>"VirtualLsiLogicController", "key"=>1000}], saved_attrs['scsi_controllers']
+    assert_equal [{"type" => "VirtualLsiLogicController", "key" => 1000}], saved_attrs['scsi_controllers']
     volumes_attrs = {
       '0' => {
         'thin' => true,
diff --git a/test/controllers/concerns/parameters/host_test.rb b/test/controllers/concerns/parameters/host_test.rb
index 5d9e26c3a..d6996f590 100644
--- a/test/controllers/concerns/parameters/host_test.rb
+++ b/test/controllers/concerns/parameters/host_test.rb
@@ -29,13 +29,13 @@ class HostParametersTest < ActiveSupport::TestCase
   end
 
   test 'normalizes json scsi attributes' do
-    inner_params = {:name => 'test.example.com', :compute_attributes => {"scsi_controllers"=>"{\"scsiControllers\":[{\"type\":\"VirtualLsiLogicController\",\"key\":1000}],\"volumes\":[{\"thin\":true,\"name\":\"Hard disk\",\"mode\":\"persistent\",\"controllerKey\":1000,\"size\":10485760,\"sizeGb\":10,\"storagePod\":\"Example-Pod\"}]}"}}
+    inner_params = {:name => 'test.example.com', :compute_attributes => {"scsi_controllers" => "{\"scsiControllers\":[{\"type\":\"VirtualLsiLogicController\",\"key\":1000}],\"volumes\":[{\"thin\":true,\"name\":\"Hard disk\",\"mode\":\"persistent\",\"controllerKey\":1000,\"size\":10485760,\"sizeGb\":10,\"storagePod\":\"Example-Pod\"}]}"}}
     expects(:params).at_least_once.returns(ActionController::Parameters.new(:host => inner_params))
     expects(:parameter_filter_context).at_least_once.returns(ui_context)
     filtered = host_params
 
     assert_equal 'test.example.com', filtered['name']
-    assert_equal [{"type"=>"VirtualLsiLogicController", "key"=>1000}], filtered['compute_attributes']['scsi_controllers']
-    assert_equal({"0"=>{"thin"=>true, "name"=>"Hard disk", "mode"=>"persistent", "controller_key"=>1000, "size"=>10485760, "size_gb"=>10, "storage_pod"=>"Example-Pod"}}, filtered['compute_attributes']['volumes_attributes'])
+    assert_equal [{"type" => "VirtualLsiLogicController", "key" => 1000}], filtered['compute_attributes']['scsi_controllers']
+    assert_equal({"0" => {"thin" => true, "name" => "Hard disk", "mode" => "persistent", "controller_key" => 1000, "size" => 10485760, "size_gb" => 10, "storage_pod" => "Example-Pod"}}, filtered['compute_attributes']['volumes_attributes'])
   end
 end
diff --git a/test/controllers/environments_controller_test.rb b/test/controllers/environments_controller_test.rb
index 16527b18e..ea089c27c 100644
--- a/test/controllers/environments_controller_test.rb
+++ b/test/controllers/environments_controller_test.rb
@@ -64,7 +64,7 @@ class EnvironmentsControllerTest < ActionController::TestCase
     # This is the on-disk status
     # and should result in a disk_tree of {"env1" => ["a", "b", "c"],"env2" => ["a", "b", "c"]}
     envs = HashWithIndifferentAccess.new(:env1 => %w{a b c}, :env2 => %w{a b c})
-    pcs = [HashWithIndifferentAccess.new("a" => { "name" => "a", "module" => "", "params"=> {}})]
+    pcs = [HashWithIndifferentAccess.new("a" => { "name" => "a", "module" => "", "params" => {}})]
     classes = Hash[pcs.map { |k| [k.keys.first, Foreman::ImporterPuppetclass.new(k.values.first)] }]
     Environment.expects(:puppetEnvs).returns(envs).at_least(0)
     ProxyAPI::Puppet.any_instance.stubs(:environments).returns(["env1", "env2"])
@@ -156,7 +156,7 @@ class EnvironmentsControllerTest < ActionController::TestCase
 
     # assert_template "puppetclasses_or_envs_changed". This assertion will fail. And it should fail. See above.
     post :obsolete_and_new, params:
-      { "changed"=>
+      { "changed" =>
        {"obsolete" =>
         {"env1" => '["a","b","c","_destroy_"]'}
        }
diff --git a/test/controllers/hostgroups_controller_test.rb b/test/controllers/hostgroups_controller_test.rb
index bfed31e8b..cd6adc461 100644
--- a/test/controllers/hostgroups_controller_test.rb
+++ b/test/controllers/hostgroups_controller_test.rb
@@ -28,8 +28,8 @@ class HostgroupsControllerTest < ActionController::TestCase
   def test_create_valid
     Hostgroup.any_instance.stubs(:valid?).returns(true)
     pc = Puppetclass.first
-    post :create, params: { :hostgroup => {:name=>"test_it", :group_parameters_attributes=>{"1272344174448"=>{:name => "x", :value =>"y", :_destroy => ""}},
-                   :puppetclass_ids=>["", pc.id.to_s], :realm_id => realms(:myrealm).id} }, session: set_session_user
+    post :create, params: { :hostgroup => {:name => "test_it", :group_parameters_attributes => {"1272344174448" => {:name => "x", :value => "y", :_destroy => ""}},
+                   :puppetclass_ids => ["", pc.id.to_s], :realm_id => realms(:myrealm).id} }, session: set_session_user
     assert_redirected_to hostgroups_url
   end
 
@@ -193,7 +193,7 @@ class HostgroupsControllerTest < ActionController::TestCase
       FactoryBot.create(:environment_class, :puppetclass => @puppetclass, :environment => @environment, :puppetclass_lookup_key => lookup_key)
 
       # sending exactly what the host form would send which is lookup_value.value_before_type_cast
-      lk = {"lookup_values_attributes" => {lookup_key.id.to_s => {"value" => lookup_value.value_before_type_cast, "id" =>lookup_value.id, "lookup_key_id" => lookup_key.id, "_destroy" => false}}}
+      lk = {"lookup_values_attributes" => {lookup_key.id.to_s => {"value" => lookup_value.value_before_type_cast, "id" => lookup_value.id, "lookup_key_id" => lookup_key.id, "_destroy" => false}}}
 
       params = {
         hostgroup_id: hostgroup.id,
@@ -232,8 +232,8 @@ class HostgroupsControllerTest < ActionController::TestCase
     end
 
     it "creates a hostgroup with a parent parameter" do
-      post :create, params: { "hostgroup" => {"name"=>"test_it", "parent_id" => @base.id, :realm_id => realms(:myrealm).id,
-                                     :group_parameters_attributes => {"0" => {:name => "x", :value =>"overridden", :_destroy => ""}}} }, session: set_session_user
+      post :create, params: { "hostgroup" => {"name" => "test_it", "parent_id" => @base.id, :realm_id => realms(:myrealm).id,
+                                     :group_parameters_attributes => {"0" => {:name => "x", :value => "overridden", :_destroy => ""}}} }, session: set_session_user
       assert_redirected_to hostgroups_url
       hostgroup = Hostgroup.unscoped.where(:name => "test_it").last
       as_admin do
@@ -247,7 +247,7 @@ class HostgroupsControllerTest < ActionController::TestCase
         assert_equal "original", child.parameters["x"]
       end
       post :update, params: { "id" => child.id, "hostgroup" => {"name" => child.name,
-                                                       :group_parameters_attributes => {"0" => {:name => "x", :value =>"overridden", :_destroy => ""}}} }, session: set_session_user
+                                                       :group_parameters_attributes => {"0" => {:name => "x", :value => "overridden", :_destroy => ""}}} }, session: set_session_user
       assert_redirected_to hostgroups_url
       as_admin do
         child.reload
diff --git a/test/controllers/hosts_controller_test.rb b/test/controllers/hosts_controller_test.rb
index fc9878bd0..341d1d0dc 100644
--- a/test/controllers/hosts_controller_test.rb
+++ b/test/controllers/hosts_controller_test.rb
@@ -96,7 +96,7 @@ class HostsControllerTest < ActionController::TestCase
           :realm_id => realms(:myrealm).id,
           :disk => "empty partition",
           :puppet_proxy_id => smart_proxies(:puppetmaster).id,
-          :root_pass           => "xybxa6JUkz63w",
+          :root_pass => "xybxa6JUkz63w",
           :location_id => taxonomies(:location1).id,
           :organization_id => taxonomies(:organization1).id
         }
@@ -731,7 +731,7 @@ class HostsControllerTest < ActionController::TestCase
   test "should get disabled hosts for a user with a fact_filter" do
     one = users(:one)
     one.roles << [roles(:manager)]
-    FactName.create :name =>"architecture"
+    FactName.create :name => "architecture"
     get :disabled, session: set_session_user(one)
     assert_response :success
   end
@@ -841,7 +841,7 @@ class HostsControllerTest < ActionController::TestCase
     assert_empty @host.errors
     put :toggle_manage, params: { :id => @host.name }, session: set_session_user
     assert_redirected_to :controller => :hosts, :action => :edit
-    assert flash[:success] == _("Foreman now manages the build cycle for %s") %@host.name
+    assert flash[:success] == _("Foreman now manages the build cycle for %s") % @host.name
   end
 
   def test_unset_manage
@@ -850,7 +850,7 @@ class HostsControllerTest < ActionController::TestCase
     assert_empty @host.errors
     put :toggle_manage, params: { :id => @host.name }, session: set_session_user
     assert_redirected_to :controller => :hosts, :action => :edit
-    assert flash[:success] == _("Foreman now no longer manages the build cycle for %s") %@host.name
+    assert flash[:success] == _("Foreman now no longer manages the build cycle for %s") % @host.name
   end
 
   test 'when ":restrict_registered_smart_proxies" is false, HTTP requests should be able to get externalNodes' do
@@ -1285,7 +1285,7 @@ class HostsControllerTest < ActionController::TestCase
     end
 
     test 'returns templates with interfaces' do
-      nic=FactoryBot.build(:nic_managed, :host => @host)
+      nic = FactoryBot.build(:nic_managed, :host => @host)
       @attrs[:interfaces_attributes] = nic.attributes.except 'updated_at', 'created_at', 'attrs'
       put :template_used, params: {:provisioning => 'build', :host => @attrs, :id => @host.id }, session: set_session_user, xhr: true
       assert_response :success
@@ -1518,7 +1518,7 @@ class HostsControllerTest < ActionController::TestCase
     host.type = 'Host::Managed'
     host.managed = true
     host.primary_interface.managed = true
-    host.lookup_values.build({"match"=>"fqdn=#{host.fqdn}", "value"=>'4', "lookup_key_id" => lookup_key.id, "host_or_hostgroup" => host})
+    host.lookup_values.build({"match" => "fqdn=#{host.fqdn}", "value" => '4', "lookup_key_id" => lookup_key.id, "host_or_hostgroup" => host})
     assert_valid host.lookup_values.first
   end
 
@@ -1626,7 +1626,7 @@ class HostsControllerTest < ActionController::TestCase
       lookup_value = FactoryBot.create(:lookup_value, :lookup_key => lookup_key, :match => "fqdn=#{host.fqdn}", :value => ["c", "d"])
 
       # sending exactly what the host form would send which is lookup_value.value_before_type_cast
-      lk = {"lookup_values_attributes" => {lookup_key.id.to_s => {"value" => lookup_value.value_before_type_cast, "id" =>lookup_value.id, "lookup_key_id" => lookup_key.id, "_destroy" => false}}}
+      lk = {"lookup_values_attributes" => {lookup_key.id.to_s => {"value" => lookup_value.value_before_type_cast, "id" => lookup_value.id, "lookup_key_id" => lookup_key.id, "_destroy" => false}}}
 
       params = {
         host_id: host.id,
diff --git a/test/controllers/images_controller_test.rb b/test/controllers/images_controller_test.rb
index a9e877af2..5cc7f1a48 100644
--- a/test/controllers/images_controller_test.rb
+++ b/test/controllers/images_controller_test.rb
@@ -54,7 +54,7 @@ class ImagesControllerTest < ActionController::TestCase
   test "should list json images" do
     # This value is tested by the deprecation warning in application_controller
     # so we need to set it or the test will crash
-    request.env['REQUEST_URI']="compute_resources/#{@image.compute_resource_id}/images"
+    request.env['REQUEST_URI'] = "compute_resources/#{@image.compute_resource_id}/images"
     get :index, params: { :format => :json, :compute_resource_id => @image.compute_resource_id, :operatingsystem_id => @image.operatingsystem_id, :architecture_id => @image.architecture_id }, session: set_session_user
     assert_response :success
     body = JSON.parse(response.body)
diff --git a/test/controllers/locations_controller_test.rb b/test/controllers/locations_controller_test.rb
index cebd1508e..1a584dfa1 100644
--- a/test/controllers/locations_controller_test.rb
+++ b/test/controllers/locations_controller_test.rb
@@ -199,7 +199,7 @@ class LocationsControllerTest < ActionController::TestCase
     user2 = FactoryBot.create(:user, :with_mail)
     location = as_admin { FactoryBot.create(:location, :users => [user1, user2]) }
 
-    User.any_instance.expects(:expire_topbar_cache).times(2+User.only_admin.count) # 2 users, all admins
+    User.any_instance.expects(:expire_topbar_cache).times(2 + User.only_admin.count) # 2 users, all admins
     put :update, params: { :id => location.id, :location => {:name => "Topbar Loc" } }, session: set_session_user
   end
 
diff --git a/test/controllers/lookup_keys_controller_test.rb b/test/controllers/lookup_keys_controller_test.rb
index 08f7c45bc..e8a5b6495 100644
--- a/test/controllers/lookup_keys_controller_test.rb
+++ b/test/controllers/lookup_keys_controller_test.rb
@@ -12,8 +12,8 @@ class LookupKeysControllerTest < ActionController::TestCase
     }
     @value = @key.override_values[1]
     @key.override_values = [@value]
-    @create = {"1462788609698"=>{"match"=>"hostgroup=db", "value"=>'4', "omit"=>"0", "_destroy"=>"false"}}
-    @delete = {"0"=>{"match"=>@value.match, "value"=>@value.value, "omit"=>"0", "_destroy"=>"1", "id"=>@value.id } }
+    @create = {"1462788609698" => {"match" => "hostgroup=db", "value" => '4', "omit" => "0", "_destroy" => "false"}}
+    @delete = {"0" => {"match" => @value.match, "value" => @value.value, "omit" => "0", "_destroy" => "1", "id" => @value.id } }
   end
 
   test 'patch add valid override' do
diff --git a/test/controllers/notification_recipients_controller_test.rb b/test/controllers/notification_recipients_controller_test.rb
index d0b5a7c71..d9d04df8e 100644
--- a/test/controllers/notification_recipients_controller_test.rb
+++ b/test/controllers/notification_recipients_controller_test.rb
@@ -25,7 +25,7 @@ class NotificationRecipientsControllerTest < ActionController::TestCase
 
   test "should be able to update seen flag" do
     add_notification
-    get :index, params: { :format=>'json' }, session: set_session_user
+    get :index, params: { :format => 'json' }, session: set_session_user
     put :update, params: { :format => 'json', :id => first_notification,
                            :notification_recipient => {:seen => true} }, session: set_session_user
     assert_response :success
@@ -34,7 +34,7 @@ class NotificationRecipientsControllerTest < ActionController::TestCase
 
   test "should be able to delete notification" do
     add_notification
-    get :index, params: { :format=>'json' }, session: set_session_user
+    get :index, params: { :format => 'json' }, session: set_session_user
     notice_id = first_notification
     assert NotificationRecipient.find(notice_id)
     delete :destroy, params: { :id => notice_id }
@@ -43,7 +43,7 @@ class NotificationRecipientsControllerTest < ActionController::TestCase
   end
 
   test "should get 404 on invalid notification deletion" do
-    get :index, params: { :format=>'json' }, session: set_session_user
+    get :index, params: { :format => 'json' }, session: set_session_user
     notice_id = 1
     refute response['notifications'].map{|n| n['id']}.include?(notice_id)
     refute NotificationRecipient.find_by_id(notice_id)
@@ -53,7 +53,7 @@ class NotificationRecipientsControllerTest < ActionController::TestCase
 
   test "should not get notifications if settings login is disabled" do
     SETTINGS[:login] = false
-    get :index, params: { :format=>'json' }
+    get :index, params: { :format => 'json' }
     SETTINGS[:login] = true
     assert_response :not_found
   end
diff --git a/test/controllers/organizations_controller_test.rb b/test/controllers/organizations_controller_test.rb
index 12663951c..62b3e3352 100644
--- a/test/controllers/organizations_controller_test.rb
+++ b/test/controllers/organizations_controller_test.rb
@@ -203,7 +203,7 @@ class OrganizationsControllerTest < ActionController::TestCase
     user2 = FactoryBot.create(:user, :with_mail)
     organization = as_admin { FactoryBot.create(:organization, :users => [user1, user2]) }
 
-    User.any_instance.expects(:expire_topbar_cache).times(2+User.only_admin.count) # 2 users, all admins
+    User.any_instance.expects(:expire_topbar_cache).times(2 + User.only_admin.count) # 2 users, all admins
     put :update, params: { :id => organization.id, :organization => {:name => "Topbar Org" } }, session: set_session_user
   end
 
diff --git a/test/controllers/shared/smart_proxies_controller_shared_test.rb b/test/controllers/shared/smart_proxies_controller_shared_test.rb
index 935794b99..cda7eaa0f 100644
--- a/test/controllers/shared/smart_proxies_controller_shared_test.rb
+++ b/test/controllers/shared/smart_proxies_controller_shared_test.rb
@@ -24,7 +24,7 @@ module SmartProxiesControllerSharedTest
     # This is the on-disk status
     # and should result in a disk_tree of {"env1" => ["a", "b", "c"],"env2" => ["a", "b", "c"]}
     envs = HashWithIndifferentAccess.new(:env1 => %w{a b c}, :env2 => %w{a b c})
-    pcs = [HashWithIndifferentAccess.new("a" => { "name" => "a", "module" => nil, "params"=> {'key' => 'special'} })]
+    pcs = [HashWithIndifferentAccess.new("a" => { "name" => "a", "module" => nil, "params" => {'key' => 'special'} })]
     classes = Hash[pcs.map { |k| [k.keys.first, Foreman::ImporterPuppetclass.new(k.values.first)] }]
     Environment.expects(:puppetEnvs).returns(envs).at_least(0)
     ProxyAPI::Puppet.any_instance.stubs(:environments).returns(["env1", "env2"])
diff --git a/test/controllers/statistics_controller_test.rb b/test/controllers/statistics_controller_test.rb
index 25eb3a7a3..fe8504bc5 100644
--- a/test/controllers/statistics_controller_test.rb
+++ b/test/controllers/statistics_controller_test.rb
@@ -11,7 +11,7 @@ class StatisticsControllerTest < ActionController::TestCase
   test 'user with viewer rights should succeed in requesting statistics data via ajax' do
     @request.session[:user] = users(:one).id
     users(:one).roles = [Role.default, Role.find_by_name('Viewer')]
-    get :show, params: { :id => 'operatingsystem', :format=>'json' }, session: set_session_user
+    get :show, params: { :id => 'operatingsystem', :format => 'json' }, session: set_session_user
     assert_response :success
   end
 end
diff --git a/test/controllers/unattended_controller_test.rb b/test/controllers/unattended_controller_test.rb
index 979963a07..fa65a32ef 100644
--- a/test/controllers/unattended_controller_test.rb
+++ b/test/controllers/unattended_controller_test.rb
@@ -50,7 +50,7 @@ class UnattendedControllerTest < ActionController::TestCase
     end
 
     test "should set @static when requested" do
-      Setting[:safemode_render]=false
+      Setting[:safemode_render] = false
       @request.env["HTTP_X_RHN_PROVISIONING_MAC_0"] = "eth0 #{@rh_host.mac}"
       get(:host_template, params: { 'kind' => 'provision', 'static' => 'true' })
       assert_match(%r{static:true}, @response.body)
@@ -361,10 +361,10 @@ class UnattendedControllerTest < ActionController::TestCase
         Setting[:token_duration] = 30
         Setting[:update_ip_from_built_request] = false
         @request.env["REMOTE_ADDR"] = '127.0.0.1'
-        h=@ub_host
+        h = @ub_host
         h.create_token(:value => "aaaaaa", :expires => Time.now.utc + 5.minutes)
         get :built, params: { 'token' => h.token.value }
-        h_new=Host.find_by_name(h.name)
+        h_new = Host.find_by_name(h.name)
 
         assert_response :success
         assert_equal h.ip, h_new.ip
@@ -373,13 +373,13 @@ class UnattendedControllerTest < ActionController::TestCase
       test "hosts with mismatched ip and update_ip true should have the new ip" do
         Setting[:token_duration] = 30
         Setting[:update_ip_from_built_request] = true
-        h=@ub_host
+        h = @ub_host
         new_ip = h.subnet.network.gsub(/\.0$/, '.100') # Must be in the subnet, which isn't fixed
         @request.env["REMOTE_ADDR"] = new_ip
         refute_equal new_ip, h.ip
         h.create_token(:value => "aaaaab", :expires => Time.now.utc + 5.minutes)
         get :built, params: { 'token' => h.token.value }
-        h_new=Host.find_by_name(h.reload.name)
+        h_new = Host.find_by_name(h.reload.name)
         assert_response :success
         assert_equal new_ip, h_new.ip
       end
@@ -388,11 +388,11 @@ class UnattendedControllerTest < ActionController::TestCase
         Setting[:token_duration] = 30
         Setting[:update_ip_from_built_request] = true
         @request.env["REMOTE_ADDR"] = FactoryBot.create(:host).ip
-        h=@ub_host
+        h = @ub_host
         h.create_token(:value => "aaaaac", :expires => Time.now.utc + 5.minutes)
         get :built, params: { 'token' => h.token.value }
         assert_response :success
-        h_new=Host.find_by_name(h.reload.name)
+        h_new = Host.find_by_name(h.reload.name)
         assert_equal h.ip, h_new.ip
       end
 
diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb
index e07aa7bdf..ad25b2561 100644
--- a/test/controllers/users_controller_test.rb
+++ b/test/controllers/users_controller_test.rb
@@ -85,12 +85,12 @@ class UsersControllerTest < ActionController::TestCase
   test "should not remove the default role" do
     user = User.create :login => "foo", :mail => "foo@bar.com", :auth_source => auth_sources(:one)
 
-    assert user.roles =[roles(:default_role)]
+    assert user.roles = [roles(:default_role)]
 
     put :update, params: { :id => user.id, :user => {:login => "johnsmith"} }, session: set_session_user
     mod_user = User.unscoped.find_by_id(user.id)
 
-    assert mod_user.roles =[roles(:default_role)]
+    assert mod_user.roles = [roles(:default_role)]
   end
 
   test "should set password" do
@@ -199,14 +199,14 @@ class UsersControllerTest < ActionController::TestCase
   end
 
   test "should be able to create user without mail and update the mail later" do
-    user = User.create :login => "mailess", :mail=> nil, :auth_source => auth_sources(:one)
+    user = User.create :login => "mailess", :mail => nil, :auth_source => auth_sources(:one)
     user.admin = true
     user.save!(:validate => false)
 
-    update_hash = {"user"=>{
-      "login"  => user.login,
-      "mail"  => "you@have.mail"},
-      "id"     => user.id}
+    update_hash = {"user" => {
+      "login" => user.login,
+      "mail" => "you@have.mail"},
+      "id" => user.id}
     put :update, params: update_hash, session: set_session_user.merge(:user => user.id)
 
     assert User.unscoped.find_by_login(user.login).mail.present?
@@ -360,7 +360,7 @@ class UsersControllerTest < ActionController::TestCase
   end
 
   test "#login shows a warning for any user model errors" do
-    attrs = {:firstname=>"foo", :mail=>"foo#bar", :login=>"ldap-user", :auth_source_id=>auth_sources(:one).id}
+    attrs = {:firstname => "foo", :mail => "foo#bar", :login => "ldap-user", :auth_source_id => auth_sources(:one).id}
     AuthSourceLdap.any_instance.stubs(:authenticate).returns(attrs)
     AuthSourceLdap.any_instance.stubs(:update_usergroups).returns(true)
     AuthSourceLdap.any_instance.stubs(:organizations).returns([taxonomies(:organization1)])
@@ -431,7 +431,7 @@ class UsersControllerTest < ActionController::TestCase
 
   context 'default taxonomies' do
     test 'accessing a regular page sets default taxonomies' do
-      users(:one).update(:default_location_id     => taxonomies(:location1).id,
+      users(:one).update(:default_location_id => taxonomies(:location1).id,
                                     :default_organization_id => taxonomies(:organization1).id,
                                     :password                => 'changeme')
 
@@ -441,11 +441,11 @@ class UsersControllerTest < ActionController::TestCase
     end
 
     test 'users can update their own default taxonomies' do
-      users(:one).update(:locations     => [taxonomies(:location1)],
+      users(:one).update(:locations => [taxonomies(:location1)],
                                     :organizations => [taxonomies(:organization1)])
 
       put :update, params: { :id   => users(:one).id,
-                             :user => { :default_location_id     => taxonomies(:location1).id,
+                             :user => { :default_location_id => taxonomies(:location1).id,
                                 :default_organization_id => taxonomies(:organization1).id } }
       assert_redirected_to users_path
 
diff --git a/test/fact_importer_test_helper.rb b/test/fact_importer_test_helper.rb
index 111c5ae11..124e20390 100644
--- a/test/fact_importer_test_helper.rb
+++ b/test/fact_importer_test_helper.rb
@@ -142,10 +142,10 @@ module FactsData
 
     def flat_result
       {
-        "good"=>"hello",
-        "common_ancestor::good_subtree::good_key"=>"hello",
-        "common_ancestor::good_subtree"=>nil,
-        "common_ancestor"=>nil
+        "good" => "hello",
+        "common_ancestor::good_subtree::good_key" => "hello",
+        "common_ancestor::good_subtree" => nil,
+        "common_ancestor" => nil
       }
     end
   end
diff --git a/test/functional/api/v2/puppet_hosts_controller_test.rb b/test/functional/api/v2/puppet_hosts_controller_test.rb
index 8fb81429a..9d552ec6c 100644
--- a/test/functional/api/v2/puppet_hosts_controller_test.rb
+++ b/test/functional/api/v2/puppet_hosts_controller_test.rb
@@ -4,13 +4,13 @@ class Api::V2::PuppetHostsControllerTest < ActionController::TestCase
   test 'puppetrun routes to /host/:id/puppetrun' do
     assert_routing(
       { method: 'put', path: '/api/hosts/zzz.com/puppetrun' },
-      { "format"=>"json", "apiv"=>"v2", controller: "api/v2/puppet_hosts", action: "puppetrun", id: "zzz.com" },
-      { "format"=>"json", "apiv"=>"v2" })
+      { "format" => "json", "apiv" => "v2", controller: "api/v2/puppet_hosts", action: "puppetrun", id: "zzz.com" },
+      { "format" => "json", "apiv" => "v2" })
   end
 
   test "should run puppet for specific host" do
     as_admin { @phost = FactoryBot.create(:host, :with_puppet) }
-    User.current=nil
+    User.current = nil
     ProxyAPI::Puppet.any_instance.stubs(:run).returns(true)
     put :puppetrun, params: { :controller => 'puppet_hosts', :id => @phost.id }
     assert_response :success
diff --git a/test/helpers/home_helper_test.rb b/test/helpers/home_helper_test.rb
index 37e0b018e..f649d0cfa 100644
--- a/test/helpers/home_helper_test.rb
+++ b/test/helpers/home_helper_test.rb
@@ -2,7 +2,7 @@ require 'test_helper'
 
 class HomeHelperTest < ActionView::TestCase
   def test_menu_item_tag
-    item = Menu::Item.new(:test_good_menu, :url_hash => {:controller=>'hosts', :action=>'index'}, :after => :me, :turbolinks => false)
+    item = Menu::Item.new(:test_good_menu, :url_hash => {:controller => 'hosts', :action => 'index'}, :after => :me, :turbolinks => false)
     tag = menu_item_tag(item)
 
     assert tag.include?('data-no-turbolink')
diff --git a/test/integration/host_js_test.rb b/test/integration/host_js_test.rb
index acb2732cb..60c6028a0 100644
--- a/test/integration/host_js_test.rb
+++ b/test/integration/host_js_test.rb
@@ -562,8 +562,8 @@ class HostJSTest < IntegrationTestWithJavascript
         wait_for_ajax
         modal.find(:button, "Ok").click
 
-        assert table.find('td.fqdn').has_content?('name.'+domain.name)
-        assert page.find('#hostFQDN').has_content?('| name.'+domain.name)
+        assert table.find('td.fqdn').has_content?('name.' + domain.name)
+        assert page.find('#hostFQDN').has_content?('| name.' + domain.name)
 
         click_link('host_tab')
         assert_equal 'name', page.find('#host_name', :visible => false).value
diff --git a/test/integration/middleware_test.rb b/test/integration/middleware_test.rb
index d64c9baee..d404b3b54 100644
--- a/test/integration/middleware_test.rb
+++ b/test/integration/middleware_test.rb
@@ -7,8 +7,8 @@ class MiddlewareIntegrationTest < ActionDispatch::IntegrationTest
     assert_equal page.response_headers['X-XSS-Protection'], '1; mode=block'
     assert_equal page.response_headers['X-Content-Type-Options'], 'nosniff'
     assert_equal page.response_headers['Content-Security-Policy'], \
-      "default-src 'self'; child-src 'self'; connect-src 'self' ws: wss:; "+
-      "img-src 'self' data: *.gravatar.com; script-src 'unsafe-eval' 'unsafe-inline' "+
+      "default-src 'self'; child-src 'self'; connect-src 'self' ws: wss:; " +
+      "img-src 'self' data: *.gravatar.com; script-src 'unsafe-eval' 'unsafe-inline' " +
       "'self'; style-src 'unsafe-inline' 'self'"
   end
 
diff --git a/test/integration/puppetclass_test.rb b/test/integration/puppetclass_test.rb
index dd391b286..26d7520c8 100644
--- a/test/integration/puppetclass_test.rb
+++ b/test/integration/puppetclass_test.rb
@@ -17,8 +17,8 @@ class PuppetclassIntegrationTest < IntegrationTestWithJavascript
   test 'verify key label exists in case key is too long' do
     env_long = FactoryBot.create(:environment)
     puppet_class_long = FactoryBot.create(:puppetclass, :environments => [env_long])
-    smart_class_parameter_long = FactoryBot.create(:puppetclass_lookup_key, :as_smart_class_param, :puppetclass => puppet_class_long, :variable => "a"*50)
-    smart_variable_long = FactoryBot.create(:variable_lookup_key, :key_type => '', :puppetclass => puppet_class_long, :key => "c"*50)
+    smart_class_parameter_long = FactoryBot.create(:puppetclass_lookup_key, :as_smart_class_param, :puppetclass => puppet_class_long, :variable => "a" * 50)
+    smart_variable_long = FactoryBot.create(:variable_lookup_key, :key_type => '', :puppetclass => puppet_class_long, :key => "c" * 50)
     visit edit_puppetclass_path(puppet_class_long)
     click_link 'Smart Class Parameter'
     assert_equal smart_class_parameter_long.key, page.find("#pill_#{smart_class_parameter_long.id}-#{smart_class_parameter_long.key}")['data-original-title']
@@ -29,8 +29,8 @@ class PuppetclassIntegrationTest < IntegrationTestWithJavascript
   test 'verify key label is empty in case key is short' do
     env_short = FactoryBot.create(:environment)
     puppet_class_short = FactoryBot.create(:puppetclass, :environments => [env_short])
-    smart_class_parameter_short = FactoryBot.create(:puppetclass_lookup_key, :as_smart_class_param, :puppetclass => puppet_class_short, :variable => "a"*40)
-    smart_variable_short = FactoryBot.create(:variable_lookup_key, :key_type => '', :puppetclass => puppet_class_short, :key => "c"*40)
+    smart_class_parameter_short = FactoryBot.create(:puppetclass_lookup_key, :as_smart_class_param, :puppetclass => puppet_class_short, :variable => "a" * 40)
+    smart_variable_short = FactoryBot.create(:variable_lookup_key, :key_type => '', :puppetclass => puppet_class_short, :key => "c" * 40)
     visit edit_puppetclass_path(puppet_class_short)
     click_link 'Smart Class Parameter'
     assert_empty page.find("#pill_#{smart_class_parameter_short.id}-#{smart_class_parameter_short.key}")['data-original-title']
diff --git a/test/mailers/audit_mailer_test.rb b/test/mailers/audit_mailer_test.rb
index fd3daec1e..86547571e 100644
--- a/test/mailers/audit_mailer_test.rb
+++ b/test/mailers/audit_mailer_test.rb
@@ -1,7 +1,7 @@
 require 'test_helper'
 require 'cgi'
 
-class AuditMailerTest <ActionMailer::TestCase
+class AuditMailerTest < ActionMailer::TestCase
   def setup
     disable_orchestration
     # Add 'update' action to audits
diff --git a/test/models/auth_sources/auth_source_ldap_test.rb b/test/models/auth_sources/auth_source_ldap_test.rb
index 735d91161..330c7d085 100644
--- a/test/models/auth_sources/auth_source_ldap_test.rb
+++ b/test/models/auth_sources/auth_source_ldap_test.rb
@@ -249,7 +249,7 @@ class AuthSourceLdapTest < ActiveSupport::TestCase
   def setup_ldap_stubs(givenname = 'test')
     # stub out all the LDAP connectivity
     entry = Net::LDAP::Entry.new
-    {:givenname=>[givenname], :dn=>["uid=test123,cn=users,cn=accounts,dc=example,dc=com"], :mail=>["test123@example.com"], :sn=>["test"]}.each do |k, v|
+    {:givenname => [givenname], :dn => ["uid=test123,cn=users,cn=accounts,dc=example,dc=com"], :mail => ["test123@example.com"], :sn => ["test"]}.each do |k, v|
       entry[k] = v.map { |e| e.encode('UTF-8').force_encoding('ASCII-8BIT') }
     end
     LdapFluff.any_instance.stubs(:valid_user?).returns(true)
diff --git a/test/models/compute_resource_test.rb b/test/models/compute_resource_test.rb
index 88592f8be..abd071a4c 100644
--- a/test/models/compute_resource_test.rb
+++ b/test/models/compute_resource_test.rb
@@ -37,14 +37,14 @@ class ComputeResourceTest < ActiveSupport::TestCase
   end
 
   test "random_password should return nil when set_console_password is false" do
-    cr=compute_resources(:mycompute)
-    cr.set_console_password=0
+    cr = compute_resources(:mycompute)
+    cr.set_console_password = 0
     assert_nil cr.send(:random_password) # Can't call protected methods directly
   end
 
   test "random_password should return a string when set_console_password is true" do
-    cr=compute_resources(:mycompute)
-    cr.set_console_password=1
+    cr = compute_resources(:mycompute)
+    cr.set_console_password = 1
     assert_match /^[[:alnum:]]+$/, cr.send(:random_password) # Can't call protected methods directly
   end
 
@@ -67,10 +67,10 @@ class ComputeResourceTest < ActiveSupport::TestCase
   end
 
   test "libvirt vm_instance_defaults should contain the stored display type" do
-    cr=compute_resources(:mycompute)
-    cr.display_type='VNC'
+    cr = compute_resources(:mycompute)
+    cr.display_type = 'VNC'
     assert_equal 'vnc', cr.send(:vm_instance_defaults)['display']['type']
-    cr.display_type='SPICE'
+    cr.display_type = 'SPICE'
     assert_equal 'spice', cr.send(:vm_instance_defaults)['display']['type']
   end
 
diff --git a/test/models/compute_resources/libvirt_test.rb b/test/models/compute_resources/libvirt_test.rb
index 87669e517..cc6eea3ab 100644
--- a/test/models/compute_resources/libvirt_test.rb
+++ b/test/models/compute_resources/libvirt_test.rb
@@ -54,7 +54,7 @@ class Foreman::Model::LibvirtTest < ActiveSupport::TestCase
       cr.stubs(:find_vm_by_uuid).returns(vm)
 
       attrs = cr.vm_compute_attributes_for('abc')
-      assert_equal 6*1024, attrs[:memory]
+      assert_equal 6 * 1024, attrs[:memory]
     end
 
     test "returns nil memory when :memory_size is not provided" do
diff --git a/test/models/compute_resources/ovirt_test.rb b/test/models/compute_resources/ovirt_test.rb
index 1a9329553..7f509ab0d 100644
--- a/test/models/compute_resources/ovirt_test.rb
+++ b/test/models/compute_resources/ovirt_test.rb
@@ -46,7 +46,7 @@ class Foreman::Model:: OvirtTest < ActiveSupport::TestCase
     setup do
       operating_systems_xml = Nokogiri::XML(File.read('test/fixtures/ovirt_operating_systems.xml'))
       @ovirt_oses = operating_systems_xml.xpath('/operating_systems/operating_system').map do |os|
-        Fog::Compute::Ovirt::OperatingSystem.new({ :id => os[:id], :name => (os/'name').text, :href => os[:href] })
+        Fog::Compute::Ovirt::OperatingSystem.new({ :id => os[:id], :name => (os / 'name').text, :href => os[:href] })
       end
       @os_hashes = @ovirt_oses.map do |ovirt_os|
         { :id => ovirt_os.id, :name => ovirt_os.name, :href => ovirt_os.href }
diff --git a/test/models/compute_resources/vmware_test.rb b/test/models/compute_resources/vmware_test.rb
index e5724b9a0..67e61b65f 100644
--- a/test/models/compute_resources/vmware_test.rb
+++ b/test/models/compute_resources/vmware_test.rb
@@ -27,10 +27,10 @@ class Foreman::Model::VmwareTest < ActiveSupport::TestCase
                                              "volumes_attributes"    => volumes_attributes)
 
     attrs_parsed = HashWithIndifferentAccess.new("cpus"                  => "1",
-                                                 "interfaces_attributes" => {"new_interfaces"=>{"type"=>"VirtualE1000", "network"=>"Test network", "_delete"=>""},
-                                                                            "0" => {"type"=>"VirtualVmxnet3", "network"=>"Test network", "_delete"=>""}},
-                                                 "volumes_attributes"    => {"new_volumes"=>{"size_gb"=>"10", "_delete"=>""},
-                                                                             "0"=>{"size_gb"=>"1", "_delete"=>""}})
+                                                 "interfaces_attributes" => {"new_interfaces" => {"type" => "VirtualE1000", "network" => "Test network", "_delete" => ""},
+                                                                            "0" => {"type" => "VirtualVmxnet3", "network" => "Test network", "_delete" => ""}},
+                                                 "volumes_attributes"    => {"new_volumes" => {"size_gb" => "10", "_delete" => ""},
+                                                                             "0" => {"size_gb" => "1", "_delete" => ""}})
 
     mock_vm = mock('vm')
     mock_vm.expects(:save).returns(mock_vm)
@@ -44,9 +44,64 @@ class Foreman::Model::VmwareTest < ActiveSupport::TestCase
   end
 
   test "#new_vm merges defaults with user args and creates server" do
-    attrs_in = HashWithIndifferentAccess.new("cpus"=>"1", "interfaces_attributes"=>{"new_interfaces"=>{"type"=>"VirtualE1000", "network"=>"network-17", "_delete"=>""}, "0"=>{"type"=>"VirtualVmxnet3", "network"=>"network-17", "_delete"=>""}}, "volumes_attributes"=>{"new_volumes"=>{"size_gb"=>"10", "_delete"=>""}, "0"=>{"size_gb"=>"1", "_delete"=>""}})
-    attrs_parsed = {:cpus=>"1", :interfaces=>[{:type=>"VirtualVmxnet3", :network=>"network-17", :_delete=>""}], :volumes=>[{:size_gb=>"1", :_delete=>""}]}
-    attrs_out = {:name => 'test', :cpus=>"1", :interfaces=>[{:type=>"VirtualVmxnet3", :network=>"network-17", :_delete=>""}], :volumes=>[{:size_gb=>"1", :_delete=>""}]}
+    attrs_in = HashWithIndifferentAccess.new(
+      "cpus"                  => "1",
+      "interfaces_attributes" => {
+        "new_interfaces" => {
+          "type"    => "VirtualE1000",
+          "network" => "network-17",
+          "_delete" => ""
+        },
+        "0" => {
+          "type"    => "VirtualVmxnet3",
+          "network" => "network-17",
+          "_delete" => ""
+        }
+      },
+      "volumes_attributes" => {
+        "new_volumes" => {
+          "size_gb" => "10",
+          "_delete" => ""
+        },
+        "0" => {
+          "size_gb" => "1",
+          "_delete" => ""
+        }
+      }
+    )
+    attrs_parsed = {
+      :cpus       => "1",
+      :interfaces => [
+        {
+          :type    => "VirtualVmxnet3",
+          :network => "network-17",
+          :_delete => ""
+        }
+      ],
+      :volumes => [
+        {
+          :size_gb => "1",
+          :_delete => ""
+        }
+      ]
+    }
+    attrs_out = {
+      :name       => 'test',
+      :cpus       => "1",
+      :interfaces => [
+        {
+          :type    => "VirtualVmxnet3",
+          :network => "network-17",
+          :_delete => ""
+        }
+      ],
+      :volumes => [
+        {
+          :size_gb => "1",
+          :_delete => ""
+        }
+      ]
+    }
 
     mock_vm = mock('new server')
     mock_servers = mock('client.servers')
@@ -67,21 +122,21 @@ class Foreman::Model::VmwareTest < ActiveSupport::TestCase
       @cr.stubs(:test_connection)
     end
     test "calls clone_vm when image provisioning with symbol key and provision_method image" do
-      args = {:image_id =>"2", "provision_method" => "image" }
+      args = {:image_id => "2", "provision_method" => "image" }
       @cr.stubs(:parse_networks).returns(args)
       @cr.expects(:clone_vm)
       @cr.expects(:new_vm).times(0)
       @cr.create_vm(args)
     end
     test "calls clone_vm when image provisioning with string key and provision_method image" do
-      args = {"image_id" =>"2", "provision_method" => "image" }
+      args = {"image_id" => "2", "provision_method" => "image" }
       @cr.stubs(:parse_networks).returns(args)
       @cr.expects(:clone_vm)
       @cr.expects(:new_vm).times(0)
       @cr.create_vm(args)
     end
     test "does not call clone_vm when image provisioning with string key and provision_method build" do
-      args = {"image_id" =>"2", "provision_method" => "build" }
+      args = {"image_id" => "2", "provision_method" => "build" }
       mock_vm = mock('vm')
       mock_vm.expects(:save).returns(mock_vm)
       mock_vm.stubs(:firmware).returns('bios')
@@ -104,7 +159,32 @@ class Foreman::Model::VmwareTest < ActiveSupport::TestCase
   end
 
   test "#create_vm calls clone_vm when image provisioning" do
-    attrs_in = HashWithIndifferentAccess.new("image_id"=>"2", "cpus"=>"1", "interfaces_attributes"=>{"new_interfaces"=>{"type"=>"VirtualE1000", "network"=>"network-17", "_delete"=>""}, "0"=>{"type"=>"VirtualVmxnet3", "network"=>"network-17", "_delete"=>""}}, "volumes_attributes"=>{"new_volumes"=>{"size_gb"=>"10", "_delete"=>""}, "0"=>{"size_gb"=>"1", "_delete"=>""}})
+    attrs_in = HashWithIndifferentAccess.new(
+      "image_id"              => "2",
+      "cpus"                  => "1",
+      "interfaces_attributes" => {
+        "new_interfaces" => {
+          "type"    => "VirtualE1000",
+          "network" => "network-17",
+          "_delete" => ""
+        },
+        "0" => {
+          "type"    => "VirtualVmxnet3",
+          "network" => "network-17",
+          "_delete" => ""
+        }
+      },
+      "volumes_attributes" => {
+        "new_volumes" => {
+          "size_gb" => "10",
+          "_delete" => ""
+        },
+        "0" => {
+          "size_gb" => "1",
+          "_delete" => ""
+        }
+      }
+    )
     attrs_parsed = HashWithIndifferentAccess.new(
       "image_id" => "2",
       "cpus" => "1",
@@ -114,18 +194,18 @@ class Foreman::Model::VmwareTest < ActiveSupport::TestCase
           "network" => "Test network",
           "_delete" => ""
         },
-        "0"=>{
+        "0" => {
           "type" => "VirtualVmxnet3",
           "network" => "Test network",
           "_delete" => ""
         }
       },
-      "volumes_attributes"=>{
-        "new_volumes"=>{
+      "volumes_attributes" => {
+        "new_volumes" => {
           "size_gb" => "10",
           "_delete" => ""
         },
-        "0" => {"size_gb"=>"1", "_delete"=>""}
+        "0" => {"size_gb" => "1", "_delete" => ""}
       },
       "provision_method" => "image"
     )
@@ -148,21 +228,111 @@ class Foreman::Model::VmwareTest < ActiveSupport::TestCase
     end
 
     test "converts form attrs to fog attrs" do
-      attrs_in = HashWithIndifferentAccess.new("cpus"=>"1", "interfaces_attributes"=>{"new_interfaces"=>{"type"=>"VirtualE1000", "network"=>"network-17", "_delete"=>""}, "0"=>{"type"=>"VirtualVmxnet3", "network"=>"network-17", "_delete"=>""}}, "volumes_attributes"=>{"new_volumes"=>{"size_gb"=>"10", "_delete"=>""}, "0"=>{"size_gb"=>"1", "_delete"=>""}})
+      attrs_in = HashWithIndifferentAccess.new(
+        "cpus"                  => "1",
+        "interfaces_attributes" => {
+          "new_interfaces" => {
+            "type"    => "VirtualE1000",
+            "network" => "network-17",
+            "_delete" => ""
+          },
+          "0" => {
+            "type"    => "VirtualVmxnet3",
+            "network" => "network-17",
+            "_delete" => ""
+          }
+        },
+        "volumes_attributes" => {
+          "new_volumes" => {
+            "size_gb" => "10",
+            "_delete" => ""
+          },
+          "0" => {
+            "size_gb" => "1",
+            "_delete" => ""
+          }
+        }
+      )
       # All keys must be symbolized
-      attrs_out = {:cpus=>"1", :interfaces=>[{:type=>"VirtualVmxnet3", :network=>"network-17", :_delete=>""}], :volumes=>[{:size_gb=>"1", :_delete=>""}]}
+      attrs_out = {:cpus => "1", :interfaces => [{:type => "VirtualVmxnet3", :network => "network-17", :_delete => ""}], :volumes => [{:size_gb => "1", :_delete => ""}]}
       assert_equal attrs_out, @cr.parse_args(attrs_in)
     end
 
     test "is ommiting hardware_version, when it's set to Default" do
-      attrs_in = HashWithIndifferentAccess.new("cpus"=>"1", "hardware_version"=>"Default", "interfaces_attributes"=>{"new_interfaces"=>{"type"=>"VirtualE1000", "network"=>"network-17", "_delete"=>""}, "0"=>{"type"=>"VirtualVmxnet3", "network"=>"network-17", "_delete"=>""}}, "volumes_attributes"=>{"new_volumes"=>{"size_gb"=>"10", "_delete"=>""}, "0"=>{"size_gb"=>"1", "_delete"=>""}})
-      attrs_out = {:cpus=>"1", :interfaces=>[{:type=>"VirtualVmxnet3", :network=>"network-17", :_delete=>""}], :volumes=>[{:size_gb=>"1", :_delete=>""}]}
+      attrs_in = HashWithIndifferentAccess.new(
+        "cpus"                  => "1",
+        "hardware_version"      => "Default",
+        "interfaces_attributes" => {
+          "new_interfaces" => {
+            "type"    => "VirtualE1000",
+            "network" => "network-17",
+            "_delete" => ""
+          },
+          "0" => {
+            "type"    => "VirtualVmxnet3",
+            "network" => "network-17",
+            "_delete" => ""
+          }
+        },
+        "volumes_attributes" => {
+          "new_volumes" => {
+            "size_gb" => "10",
+            "_delete" => ""
+          },
+          "0" => {
+            "size_gb" => "1",
+            "_delete" => ""
+          }
+        }
+      )
+      attrs_out = {:cpus => "1", :interfaces => [{:type => "VirtualVmxnet3", :network => "network-17", :_delete => ""}], :volumes => [{:size_gb => "1", :_delete => ""}]}
       assert_equal attrs_out, @cr.parse_args(attrs_in)
     end
 
     test "is setting hardware_version, when it's set to a non-Default value" do
-      attrs_in = HashWithIndifferentAccess.new("cpus"=>"1", "hardware_version"=>"vmx-08", "interfaces_attributes"=>{"new_interfaces"=>{"type"=>"VirtualE1000", "network"=>"network-17", "_delete"=>""}, "0"=>{"type"=>"VirtualVmxnet3", "network"=>"network-17", "_delete"=>""}}, "volumes_attributes"=>{"new_volumes"=>{"size_gb"=>"10", "_delete"=>""}, "0"=>{"size_gb"=>"1", "_delete"=>""}})
-      attrs_out = {:cpus=>"1", :hardware_version=>"vmx-08", :interfaces=>[{:type=>"VirtualVmxnet3", :network=>"network-17", :_delete=>""}], :volumes=>[{:size_gb=>"1", :_delete=>""}]}
+      attrs_in = HashWithIndifferentAccess.new(
+        "cpus"                  => "1",
+        "hardware_version"      => "vmx-08",
+        "interfaces_attributes" => {
+          "new_interfaces" => {
+            "type"    => "VirtualE1000",
+            "network" => "network-17",
+            "_delete" => ""
+          },
+          "0" => {
+            "type"    => "VirtualVmxnet3",
+            "network" => "network-17",
+            "_delete" => ""
+          }
+        },
+        "volumes_attributes" => {
+          "new_volumes" => {
+            "size_gb" => "10",
+            "_delete" => ""
+          },
+          "0" => {
+            "size_gb" => "1",
+            "_delete" => ""
+          }
+        }
+      )
+      attrs_out = {
+        :cpus             => "1",
+        :hardware_version => "vmx-08",
+        :interfaces       => [
+          {
+            :type    => "VirtualVmxnet3",
+            :network => "network-17",
+            :_delete => ""
+          }
+        ],
+        :volumes => [
+          {
+            :size_gb => "1",
+            :_delete => ""
+          }
+        ]
+      }
       assert_equal attrs_out, @cr.parse_args(attrs_in)
     end
 
@@ -194,7 +364,7 @@ class Foreman::Model::VmwareTest < ActiveSupport::TestCase
 
     test "doesn't modify input hash" do
       # else compute profiles won't save properly
-      attrs_in = HashWithIndifferentAccess.new("interfaces_attributes"=>{"0"=>{"network"=>"network-17"}})
+      attrs_in = HashWithIndifferentAccess.new("interfaces_attributes" => {"0" => {"network" => "network-17"}})
       @cr.parse_args(attrs_in)
       assert_equal "network-17", attrs_in["interfaces_attributes"]["0"]["network"]
     end
@@ -215,19 +385,62 @@ class Foreman::Model::VmwareTest < ActiveSupport::TestCase
     end
 
     test "converts form network ID to network name" do
-      attrs_in = HashWithIndifferentAccess.new("interfaces_attributes"=>{"new_interfaces"=>{"type"=>"VirtualE1000", "network"=>"network-17", "_delete"=>""}, "0"=>{"type"=>"VirtualVmxnet3", "network"=>"network-17", "_delete"=>""}})
-      attrs_out = HashWithIndifferentAccess.new("interfaces_attributes"=>{"new_interfaces"=>{"type"=>"VirtualE1000", "network"=>"Test network", "virtualswitch" => nil, "_delete"=>""}, "0"=>{"type"=>"VirtualVmxnet3", "network"=>"Test network", "virtualswitch" => nil, "_delete"=>""}})
+      attrs_in = HashWithIndifferentAccess.new(
+        "interfaces_attributes" => {
+          "new_interfaces" => {
+            "type"    => "VirtualE1000",
+            "network" => "network-17",
+            "_delete" => ""
+          },
+          "0" => {
+            "type"    => "VirtualVmxnet3",
+            "network" => "network-17",
+            "_delete" => ""
+          }
+        }
+      )
+      attrs_out = HashWithIndifferentAccess.new(
+        "interfaces_attributes" => {
+          "new_interfaces" => {
+            "type"          => "VirtualE1000",
+            "network"       => "Test network",
+            "virtualswitch" => nil,
+            "_delete"       => ""
+          },
+          "0" => {
+            "type"          => "VirtualVmxnet3",
+            "network"       => "Test network",
+            "virtualswitch" => nil,
+            "_delete"       => ""
+          }
+        }
+      )
       assert_equal attrs_out, @cr.parse_networks(attrs_in)
     end
 
     test "ignores existing network names" do
-      attrs = HashWithIndifferentAccess.new("interfaces_attributes"=>{"new_interfaces"=>{"type"=>"VirtualE1000", "network"=>"Test network", "virtualswitch" => nil, "_delete"=>""}, "0"=>{"type"=>"VirtualVmxnet3", "network"=>"Test network", "virtualswitch" => nil, "_delete"=>""}})
+      attrs = HashWithIndifferentAccess.new(
+        "interfaces_attributes" => {
+          "new_interfaces" => {
+            "type"          => "VirtualE1000",
+            "network"       => "Test network",
+            "virtualswitch" => nil,
+            "_delete"       => ""
+          },
+          "0" => {
+            "type"          => "VirtualVmxnet3",
+            "network"       => "Test network",
+            "virtualswitch" => nil,
+            "_delete"       => ""
+          }
+        }
+      )
       assert_equal attrs, @cr.parse_networks(attrs)
     end
 
     test "doesn't modify input hash" do
       # else compute profiles won't save properly
-      attrs_in = HashWithIndifferentAccess.new("interfaces_attributes"=>{"0"=>{"network"=>"network-17"}})
+      attrs_in = HashWithIndifferentAccess.new("interfaces_attributes" => {"0" => {"network" => "network-17"}})
       @cr.parse_args(attrs_in)
       assert_equal "network-17", attrs_in["interfaces_attributes"]["0"]["network"]
     end
@@ -278,7 +491,7 @@ class Foreman::Model::VmwareTest < ActiveSupport::TestCase
       @vm.stubs(:volumes).returns(@volumes)
 
       scsi_controller1 = mock('scsi_controller1')
-      scsi_controller1.stubs(:attributes).returns({:type=>"VirtualLsiLogicController", :shared_bus=>"noSharing", :unit_number=>7, :key=>1000})
+      scsi_controller1.stubs(:attributes).returns({:type => "VirtualLsiLogicController", :shared_bus => "noSharing", :unit_number => 7, :key => 1000})
       @vm.stubs(:scsi_controllers).returns([scsi_controller1])
 
       @networks = [
@@ -330,7 +543,7 @@ class Foreman::Model::VmwareTest < ActiveSupport::TestCase
           "0" => { :vol => 1, :size_gb => 4 },
           "1" => { :vol => 2, :size_gb => 4 }
         },
-        :interfaces_attributes => {"0"=>{:compute_attributes=>{:network=>"Testnetwork", :type=>"VirtualVmxnet3"}, :mac=>"00:50:56:84:f1:b1"}},
+        :interfaces_attributes => {"0" => {:compute_attributes => {:network => "Testnetwork", :type => "VirtualVmxnet3"}, :mac => "00:50:56:84:f1:b1"}},
         :scsi_controllers => [
           {
             :type => "VirtualLsiLogicController",
@@ -460,7 +673,7 @@ class Foreman::Model::VmwareTest < ActiveSupport::TestCase
       }
       normalized = cr.normalize_vm_attrs(vm_attrs)
 
-      assert_equal(768*1024, normalized['memory'])
+      assert_equal(768 * 1024, normalized['memory'])
     end
 
     test 'path mapped to folder_path' do
diff --git a/test/models/concerns/fog_extensions/rackspace_v2/server_test.rb b/test/models/concerns/fog_extensions/rackspace_v2/server_test.rb
index 615e0ebdf..661104079 100644
--- a/test/models/concerns/fog_extensions/rackspace_v2/server_test.rb
+++ b/test/models/concerns/fog_extensions/rackspace_v2/server_test.rb
@@ -10,10 +10,10 @@ class RackspaceV2ServerTest < ActiveSupport::TestCase
     server.expects(:addresses).at_least_once.returns(
       {
         "public" => [
-          {"version"=>4, "addr"=>"166.78.105.63"},
-          {"version"=>6, "addr"=>"2001:4801:7817:0072:0fe1:75e8:ff10:61a9"}
+          {"version" => 4, "addr" => "166.78.105.63"},
+          {"version" => 6, "addr" => "2001:4801:7817:0072:0fe1:75e8:ff10:61a9"}
         ],
-        "private"=> [{"version"=>4, "addr"=>"10.177.18.209"}]
+        "private" => [{"version" => 4, "addr" => "10.177.18.209"}]
       }
     )
     assert_equal ["10.177.18.209", "166.78.105.63", "2001:4801:7817:0072:0fe1:75e8:ff10:61a9"], server.ip_addresses.sort
diff --git a/test/models/concerns/hostext/operating_system_test.rb b/test/models/concerns/hostext/operating_system_test.rb
index 498119571..d45ba94d8 100644
--- a/test/models/concerns/hostext/operating_system_test.rb
+++ b/test/models/concerns/hostext/operating_system_test.rb
@@ -29,7 +29,7 @@ module Hostext
 
       test "available_template_kinds finds templates for a PXE host" do
         os_dt = FactoryBot.create(:os_default_template,
-                                   :template_kind=> TemplateKind.friendly.find('finish'))
+                                   :template_kind => TemplateKind.friendly.find('finish'))
         host  = FactoryBot.create(:host, :operatingsystem => os_dt.operatingsystem)
 
         assert_equal [os_dt.provisioning_template], host.available_template_kinds('build')
@@ -38,7 +38,7 @@ module Hostext
       test "available_template_kinds finds templates for an image host" do
         Foreman::Model::EC2.any_instance.stubs(:image_exists?).returns(true)
         os_dt = FactoryBot.create(:os_default_template,
-                                   :template_kind=> TemplateKind.friendly.find('finish'))
+                                   :template_kind => TemplateKind.friendly.find('finish'))
         host  = FactoryBot.create(:host, :on_compute_resource,
                                    :operatingsystem => os_dt.operatingsystem)
         FactoryBot.create(:image, :uuid => 'abcde',
diff --git a/test/models/config_report_test.rb b/test/models/config_report_test.rb
index af675c994..b2cf363a5 100644
--- a/test/models/config_report_test.rb
+++ b/test/models/config_report_test.rb
@@ -7,59 +7,59 @@ class ConfigReportTest < ActiveSupport::TestCase
   end
 
   test "it should true on error? if there were errors" do
-    @report.status={"applied" => 92, "restarted" => 300, "failed" => 4, "failed_restarts" => 12, "skipped" => 3, "pending" => 0}
+    @report.status = {"applied" => 92, "restarted" => 300, "failed" => 4, "failed_restarts" => 12, "skipped" => 3, "pending" => 0}
     assert @report.error?
   end
 
   test "it should not be an error if there are only skips" do
-    @report.status={"applied" => 92, "restarted" => 300, "failed" => 0, "failed_restarts" => 0, "skipped" => 3, "pending" => 0}
+    @report.status = {"applied" => 92, "restarted" => 300, "failed" => 0, "failed_restarts" => 0, "skipped" => 3, "pending" => 0}
     assert !@report.error?
   end
 
   test "it should false on error? if there were no errors" do
-    @report.status={"applied" => 92, "restarted" => 300, "failed" => 0, "failed_restarts" => 0, "skipped" => 0, "pending" => 0}
+    @report.status = {"applied" => 92, "restarted" => 300, "failed" => 0, "failed_restarts" => 0, "skipped" => 0, "pending" => 0}
     assert !@report.error?
   end
 
   test "with named scope should return our report with applied resources" do
-    @report.status={"applied" => 15, "restarted" => 0, "failed" => 0, "failed_restarts" => 0, "skipped" => 0, "pending" => 0}
+    @report.status = {"applied" => 15, "restarted" => 0, "failed" => 0, "failed_restarts" => 0, "skipped" => 0, "pending" => 0}
     @report.save
     assert ConfigReport.with("applied", 14).include?(@report)
     assert !ConfigReport.with("applied", 15).include?(@report)
   end
 
   test "with named scope should return our report with restarted resources" do
-    @report.status={"applied" => 0, "restarted" => 5, "failed" => 0, "failed_restarts" => 0, "skipped" => 0, "pending" => 0}
+    @report.status = {"applied" => 0, "restarted" => 5, "failed" => 0, "failed_restarts" => 0, "skipped" => 0, "pending" => 0}
     @report.save
     assert ConfigReport.with("restarted").include?(@report)
   end
 
   test "with named scope should return our report with failed resources" do
-    @report.status={"applied" => 0, "restarted" => 0, "failed" => 9, "failed_restarts" => 0, "skipped" => 0, "pending" => 0}
+    @report.status = {"applied" => 0, "restarted" => 0, "failed" => 9, "failed_restarts" => 0, "skipped" => 0, "pending" => 0}
     @report.save
     assert ConfigReport.with("failed").include?(@report)
   end
 
   test "with named scope should return our report with failed_restarts resources" do
-    @report.status={"applied" => 0, "restarted" => 0, "failed" => 0, "failed_restarts" => 91, "skipped" => 0, "pending" => 0}
+    @report.status = {"applied" => 0, "restarted" => 0, "failed" => 0, "failed_restarts" => 91, "skipped" => 0, "pending" => 0}
     @report.save
     assert ConfigReport.with("failed_restarts").include?(@report)
   end
 
   test "with named scope should return our report with skipped resources" do
-    @report.status={"applied" => 0, "restarted" => 0, "failed" => 0, "failed_restarts" => 0, "skipped" => 8, "pending" => 0}
+    @report.status = {"applied" => 0, "restarted" => 0, "failed" => 0, "failed_restarts" => 0, "skipped" => 8, "pending" => 0}
     @report.save
     assert ConfigReport.with("skipped").include?(@report)
   end
 
   test "with named scope should return our report with skipped resources when other bits are also used" do
-    @report.status={"applied" => 0, "restarted" => 0, "failed" => 9, "failed_restarts" => 4, "skipped" => 8, "pending" => 3}
+    @report.status = {"applied" => 0, "restarted" => 0, "failed" => 9, "failed_restarts" => 4, "skipped" => 8, "pending" => 3}
     @report.save
     assert ConfigReport.with("skipped").include?(@report)
   end
 
   test "with named scope should return our report with pending resources when other bits are also used" do
-    @report.status={"applied" => 0, "restarted" => 0, "failed" => 9, "failed_restarts" => 4, "skipped" => 8, "pending" => 3}
+    @report.status = {"applied" => 0, "restarted" => 0, "failed" => 9, "failed_restarts" => 4, "skipped" => 8, "pending" => 3}
     @report.save
     assert ConfigReport.with("pending").include?(@report)
   end
diff --git a/test/models/fact_value_test.rb b/test/models/fact_value_test.rb
index b6b508142..58dbb98fd 100644
--- a/test/models/fact_value_test.rb
+++ b/test/models/fact_value_test.rb
@@ -18,13 +18,13 @@ class FactValueTest < ActiveSupport::TestCase
   end
 
   test "should return the count of each fact" do
-    h = [{:label=>"some value", :data=>1}]
+    h = [{:label => "some value", :data => 1}]
     assert_equal h, FactValue.count_each("my_facting_name")
 
     # Now creating a new fact value
     @other_host = FactoryBot.create(:host)
     FactValue.create(:value => "some value", :host => @other_host, :fact_name => @fact_name)
-    h = [{:label=>"some value", :data=>2}]
+    h = [{:label => "some value", :data => 2}]
     assert_equal h, FactValue.count_each("my_facting_name")
   end
 
diff --git a/test/models/filter_test.rb b/test/models/filter_test.rb
index ee3fba969..9166de30f 100644
--- a/test/models/filter_test.rb
+++ b/test/models/filter_test.rb
@@ -130,7 +130,7 @@ class FilterTest < ActiveSupport::TestCase
     end
 
     test "filter with location set is always limited before validation" do
-      f  = FactoryBot.build_stubbed(:filter, :search => '', :unlimited => '1',
+      f = FactoryBot.build_stubbed(:filter, :search => '', :unlimited => '1',
                          :organization_ids => [@organization.id, @organization1.id], :location_ids => [@location.id])
       assert f.valid?
       assert f.limited?
@@ -140,7 +140,7 @@ class FilterTest < ActiveSupport::TestCase
     end
 
     test "removing all organizations and locations from filter nilify taxonomy search" do
-      f  = FactoryBot.create(:filter, :search => '', :unlimited => '1',
+      f = FactoryBot.create(:filter, :search => '', :unlimited => '1',
                           :organization_ids => [@organization.id, @organization1.id], :location_ids => [@location.id])
 
       f.update :organization_ids => [], :location_ids => []
diff --git a/test/models/host_test.rb b/test/models/host_test.rb
index 21ed74e01..be4057fee 100644
--- a/test/models/host_test.rb
+++ b/test/models/host_test.rb
@@ -13,9 +13,9 @@ end
 # List of valid host names values.
 def valid_hosts_list(domain_length: 10)
   [
-    RFauxFactory.gen_alphanumeric(rand(1..255-6-domain_length)).downcase,
-    RFauxFactory.gen_alpha(rand(1..255-6-domain_length)).downcase,
-    RFauxFactory.gen_numeric_string(rand(1..255-6-domain_length))
+    RFauxFactory.gen_alphanumeric(rand(1..255 - 6 - domain_length)).downcase,
+    RFauxFactory.gen_alpha(rand(1..255 - 6 - domain_length)).downcase,
+    RFauxFactory.gen_numeric_string(rand(1..255 - 6 - domain_length))
   ]
 end
 
@@ -286,7 +286,7 @@ class HostTest < ActiveSupport::TestCase
       :puppet_proxy => smart_proxies(:puppetmaster), :medium => media(:one),
       :organization => users(:one).organizations.first, :location => users(:one).locations.first,
       :environment => environments(:production), :disk => "empty partition",
-      :lookup_values_attributes => {"new_123456" => {"lookup_key_id" => lookup_keys(:complex).id, "value"=>"some_value", "match" => "fqdn=abc.mydomain.net"}}
+      :lookup_values_attributes => {"new_123456" => {"lookup_key_id" => lookup_keys(:complex).id, "value" => "some_value", "match" => "fqdn=abc.mydomain.net"}}
     end
   end
 
@@ -296,7 +296,7 @@ class HostTest < ActiveSupport::TestCase
         :domain => domains(:mydomain), :operatingsystem => operatingsystems(:redhat), :medium => media(:one),
         :subnet => subnets(:two), :architecture => architectures(:x86_64), :puppet_proxy => smart_proxies(:puppetmaster),
         :environment => environments(:production), :disk => "empty partition",
-        :lookup_values_attributes => {"new_123456" => {"lookup_key_id" => lookup_keys(:five).id, "value"=>"some_value"}}
+        :lookup_values_attributes => {"new_123456" => {"lookup_key_id" => lookup_keys(:five).id, "value" => "some_value"}}
     end
   end
 
@@ -941,45 +941,45 @@ class HostTest < ActiveSupport::TestCase
 
       # dummy external node info
       nodeinfo = {"environment" => "production",
-                  "parameters"=> {"puppetmaster"=>"puppet", "MYVAR"=>"value", "port" => "80",
-                                  "ssl_port" => "443", "foreman_env"=> "production", "owner_name"=>"Admin User",
-                                  "root_pw"=>"xybxa6JUkz63w", "owner_email"=>"admin@someware.com",
-                                  "foreman_subnets"=>
-      [{"network"=>"3.3.4.0",
-        "name"=>"two",
-        "gateway"=>nil,
-        "mask"=>"255.255.255.0",
-        "dns_primary"=>nil,
-        "dns_secondary"=>nil,
-        "from"=>nil,
-        "to"=>nil,
-        "boot_mode"=>"DHCP",
+                  "parameters" => {"puppetmaster" => "puppet", "MYVAR" => "value", "port" => "80",
+                                  "ssl_port" => "443", "foreman_env" => "production", "owner_name" => "Admin User",
+                                  "root_pw" => "xybxa6JUkz63w", "owner_email" => "admin@someware.com",
+                                  "foreman_subnets" =>
+      [{"network" => "3.3.4.0",
+        "name" => "two",
+        "gateway" => nil,
+        "mask" => "255.255.255.0",
+        "dns_primary" => nil,
+        "dns_secondary" => nil,
+        "from" => nil,
+        "to" => nil,
+        "boot_mode" => "DHCP",
         "vlanid" => "41",
-        "ipam"=>"DHCP"}],
-        "foreman_interfaces"=>
-      [{"mac"=>"aa:bb:ac:dd:ee:ff",
-        "ip"=>"3.3.4.12",
-        "type"=>"Interface",
-        "name"=>'myfullhost.mydomain.net',
-        "attrs"=>{},
-        "virtual"=>false,
-        "link"=>true,
-        "identifier"=>nil,
-        "managed"=>true,
-        "primary"=>true,
-        "provision"=>true,
-        "subnet"=> {"network"=>"3.3.4.0",
-                    "mask"=>"255.255.255.0",
-                    "name"=>"two",
-                    "gateway"=>nil,
-                    "dns_primary"=>nil,
-                    "dns_secondary"=>nil,
-                    "from"=>nil,
-                    "to"=>nil,
-                    "boot_mode"=>"DHCP",
+        "ipam" => "DHCP"}],
+        "foreman_interfaces" =>
+      [{"mac" => "aa:bb:ac:dd:ee:ff",
+        "ip" => "3.3.4.12",
+        "type" => "Interface",
+        "name" => 'myfullhost.mydomain.net',
+        "attrs" => {},
+        "virtual" => false,
+        "link" => true,
+        "identifier" => nil,
+        "managed" => true,
+        "primary" => true,
+        "provision" => true,
+        "subnet" => {"network" => "3.3.4.0",
+                    "mask" => "255.255.255.0",
+                    "name" => "two",
+                    "gateway" => nil,
+                    "dns_primary" => nil,
+                    "dns_secondary" => nil,
+                    "from" => nil,
+                    "to" => nil,
+                    "boot_mode" => "DHCP",
                     "vlanid" => "41",
-                    "ipam"=>"DHCP"}}]},
-                    "classes"=>{"apache"=>{"custom_class_param"=>"abcdef"}, "base"=>{"cluster"=>"secret"}} }
+                    "ipam" => "DHCP"}}]},
+                    "classes" => {"apache" => {"custom_class_param" => "abcdef"}, "base" => {"cluster" => "secret"}} }
 
       host.importNode nodeinfo
       nodeinfo["parameters"]["special_info"] = "secret" # smart variable on apache
@@ -1989,7 +1989,7 @@ class HostTest < ActiveSupport::TestCase
         :provider => "IPMI", :username => "root", :password => "secret", :ip => "10.35.19.35",
         :identifier => 'eth2'
       as_user :one do
-        assert h.update!("interfaces_attributes" => {"0" => {"mac"=>"00:52:10:1e:45:16"}})
+        assert h.update!("interfaces_attributes" => {"0" => {"mac" => "00:52:10:1e:45:16"}})
       end
     end
 
@@ -3079,7 +3079,7 @@ class HostTest < ActiveSupport::TestCase
     test "invoking lookup_values_attributes= does not save lookup values in db until #save is invoked" do
       host = FactoryBot.create(:host)
       assert_no_difference('LookupValue.count') do
-        host.lookup_values_attributes = {"new_123456" => {"lookup_key_id" => lookup_keys(:complex).id, "value"=>"some_value", "match" => "fqdn=abc.mydomain.net"}}
+        host.lookup_values_attributes = {"new_123456" => {"lookup_key_id" => lookup_keys(:complex).id, "value" => "some_value", "match" => "fqdn=abc.mydomain.net"}}
       end
 
       assert_difference('LookupValue.count') do
@@ -3100,7 +3100,7 @@ class HostTest < ActiveSupport::TestCase
     end
 
     test "same works for destruction of lookup keys" do
-      host = FactoryBot.create(:host, :lookup_values_attributes => {"new_123456" => {"lookup_key_id" => lookup_keys(:complex).id, "value"=>"some_value", "match" => "fqdn=abc.mydomain.net"}})
+      host = FactoryBot.create(:host, :lookup_values_attributes => {"new_123456" => {"lookup_key_id" => lookup_keys(:complex).id, "value" => "some_value", "match" => "fqdn=abc.mydomain.net"}})
       lookup_value = host.lookup_values.first
       assert_no_difference('LookupValue.count') do
         host.lookup_values_attributes = {'0' => {'lookup_key_id' => lookup_keys(:complex).id.to_s, 'id' => lookup_value.id.to_s, '_destroy' => '1'}}.with_indifferent_access
@@ -3489,13 +3489,13 @@ class HostTest < ActiveSupport::TestCase
 
     test "should create host without compute profile when compute_attributes contain some data" do
       @host.compute_attributes = {
-        "volumes_attributes"=>{
+        "volumes_attributes" => {
           '0' => {
             'size' => 20
           }
         },
-        "interfaces_attributes"=>{},
-        "nics_attributes"=>{}
+        "interfaces_attributes" => {},
+        "nics_attributes" => {}
       }
 
       @host.compute_resource.expects(:create_vm).once.with do |vm_attrs|
diff --git a/test/models/hostgroup_test.rb b/test/models/hostgroup_test.rb
index ddc071ac2..c5d267227 100644
--- a/test/models/hostgroup_test.rb
+++ b/test/models/hostgroup_test.rb
@@ -59,8 +59,8 @@ class HostgroupTest < ActiveSupport::TestCase
     assert_equal "2", second.parameters["secondA"]
 
     third = Hostgroup.new(:name => "ThirdA", :parent_id => second.id,
-                          :group_parameters_attributes => { pid += 1 => {"name"=>"topB", "value"=>"3"},
-                                                            pid +  1 => {"name"=>"topA", "value"=>"3"}})
+                          :group_parameters_attributes => { pid += 1 => {"name" => "topB", "value" => "3"},
+                                                            pid +  1 => {"name" => "topA", "value" => "3"}})
     assert third.save
 
     assert third.parameters.include? "topA"
diff --git a/test/models/lookup_key_test.rb b/test/models/lookup_key_test.rb
index f588d7ff0..f15485ab6 100644
--- a/test/models/lookup_key_test.rb
+++ b/test/models/lookup_key_test.rb
@@ -34,7 +34,7 @@ class LookupKeyTest < ActiveSupport::TestCase
     puppetclass = puppetclasses(:one)
 
     as_admin do
-      key   = PuppetclassLookupKey.create!(:key => "dns", :path => "domain\npuppetversion", :override=>true)
+      key   = PuppetclassLookupKey.create!(:key => "dns", :path => "domain\npuppetversion", :override => true)
       value = LookupValue.create!(:value => "[1.2.3.4,2.3.4.5]", :match => "domain =  mydomain.net", :lookup_key => key)
       EnvironmentClass.create!(:puppetclass => puppetclass, :environment => environments(:production),
                                :puppetclass_lookup_key => key)
@@ -62,16 +62,16 @@ class LookupKeyTest < ActiveSupport::TestCase
     value2 = ""
     puppetclass = Puppetclass.first
     as_admin do
-      key    = PuppetclassLookupKey.create!(:key => "dns", :path => "environment,hostgroup\nhostgroup\nfqdn", :default_value => default, :override=>true)
+      key    = PuppetclassLookupKey.create!(:key => "dns", :path => "environment,hostgroup\nhostgroup\nfqdn", :default_value => default, :override => true)
       value1 = LookupValue.create!(:value => "v1", :match => "environment=testing,hostgroup=Common", :lookup_key => key)
       value2 = LookupValue.create!(:value => "v2", :match => "hostgroup=Unusual", :lookup_key => key)
 
       LookupValue.create!(:value => "v22", :match => "fqdn=#{@host2.fqdn}", :lookup_key => key)
       EnvironmentClass.create!(:puppetclass => puppetclass, :environment => environments(:testing),
                                :puppetclass_lookup_key => key)
-      HostClass.create!(:host => @host1, :puppetclass=>puppetclass)
-      HostClass.create!(:host => @host2, :puppetclass=>puppetclass)
-      HostClass.create!(:host => @host3, :puppetclass=>puppetclass)
+      HostClass.create!(:host => @host1, :puppetclass => puppetclass)
+      HostClass.create!(:host => @host2, :puppetclass => puppetclass)
+      HostClass.create!(:host => @host3, :puppetclass => puppetclass)
     end
 
     key.reload
@@ -95,7 +95,7 @@ class LookupKeyTest < ActiveSupport::TestCase
 
     as_admin do
       key    = VariableLookupKey.create!(:key => "dns", :path => "environment,hostgroup \n hostgroup", :puppetclass => puppetclass,
-                                 :default_value => default, :override=>true)
+                                 :default_value => default, :override => true)
       value1 = LookupValue.create!(:value => "v1", :match => "hostgroup=Common", :lookup_key => key)
       value2 = LookupValue.create!(:value => "v2", :match => "hostgroup=Unusual", :lookup_key => key)
 
diff --git a/test/models/lookup_keys/variable_lookup_key_test.rb b/test/models/lookup_keys/variable_lookup_key_test.rb
index 7de920963..a0aa39b6c 100644
--- a/test/models/lookup_keys/variable_lookup_key_test.rb
+++ b/test/models/lookup_keys/variable_lookup_key_test.rb
@@ -7,7 +7,7 @@ def valid_sc_variable_data
     { sc_type: 'boolean', value: RFauxFactory.gen_boolean },
     { sc_type: 'integer', value: rand(1..10000) },
     # random float in range -1000..1000
-    { sc_type: 'real', value: (rand*2000)-1000 },
+    { sc_type: 'real', value: (rand * 2000) - 1000 },
     { sc_type: 'array',
       value: "[\"#{RFauxFactory.gen_utf8}\",\"#{RFauxFactory.gen_numeric_string}\",\"#{RFauxFactory.gen_html}\"]" },
     { sc_type: 'hash',
diff --git a/test/models/lookup_value_test.rb b/test/models/lookup_value_test.rb
index 29a4fc33f..bdb4f2dca 100644
--- a/test/models/lookup_value_test.rb
+++ b/test/models/lookup_value_test.rb
@@ -42,7 +42,7 @@ class LookupValueTest < ActiveSupport::TestCase
     FactoryBot.create(:filter, :role => role, :permissions => [Permission.find_by_name(:view_hosts)], :search => "name = #{@host1.name}")
     # Todo, restore the ip test variant once our scoped-search works with host.ip again
     # FactoryBot.create(:filter, :role => role, :permissions => [Permission.find_by_name(:view_hosts)], :search => "ip = #{@host1.ip}")
-    user.roles<< [ role ]
+    user.roles << [ role ]
     as_user :one do
       assert Host.authorized(:view_hosts, Host).where(:name => @host1.name).exists?
       refute Host.authorized(:view_hosts, Host).where(:name => @host2.name).exists?
@@ -271,7 +271,7 @@ this is a multiline value
 with leading and trailing whitespace
 
 EOF
-    value = LookupValue.new(:value => text, :match => "hostgroup=Common", :lookup_key_id =>key.id)
+    value = LookupValue.new(:value => text, :match => "hostgroup=Common", :lookup_key_id => key.id)
     assert value.save!
     assert_equal value.value, text
   end
diff --git a/test/models/nics/base_test.rb b/test/models/nics/base_test.rb
index eb8f8f362..2cfd9aa51 100644
--- a/test/models/nics/base_test.rb
+++ b/test/models/nics/base_test.rb
@@ -51,7 +51,7 @@ class Nic::BaseTest < ActiveSupport::TestCase
   test 'should update with multiple valid names' do
     host = FactoryBot.create(:host, :managed)
     valid_interfaces_names.each do |name|
-      name = name[1..254-host.domain.name.length] if name.length + host.domain.name.length > 254
+      name = name[1..254 - host.domain.name.length] if name.length + host.domain.name.length > 254
       host.interfaces.first.name = name
       assert host.valid?, "Can't update nic with valid name #{name}.#{host.domain.name}"
     end
diff --git a/test/models/operatingsystem_test.rb b/test/models/operatingsystem_test.rb
index d20fdccc2..b477a27dc 100644
--- a/test/models/operatingsystem_test.rb
+++ b/test/models/operatingsystem_test.rb
@@ -210,19 +210,19 @@ class OperatingsystemTest < ActiveSupport::TestCase
   test "should create os with two different parameters" do
     pid = Time.now.to_i
     operatingsystem = FactoryBot.build_stubbed(:operatingsystem, :os_parameters_attributes =>
-        {pid += 1=>{"name"=>"a", "value"=>"1"},
-         pid +  1=>{"name"=>"b", "value"=>"1"}})
+        {pid += 1 => {"name" => "a", "value" => "1"},
+         pid +  1 => {"name" => "b", "value" => "1"}})
     assert_valid operatingsystem
   end
 
   test "should not create os with two new parameters with the same name" do
     pid = Time.now.to_i
     operatingsystem = FactoryBot.build_stubbed(:operatingsystem, :os_parameters_attributes =>
-        {pid += 1=>{"name"=>"a", "value"=>"1"},
-         pid += 1=>{"name"=>"a", "value"=>"2"},
-         pid +  1=>{"name"=>"b", "value"=>"1"}})
+        {pid += 1 => {"name" => "a", "value" => "1"},
+         pid += 1 => {"name" => "a", "value" => "2"},
+         pid +  1 => {"name" => "b", "value" => "1"}})
     refute_valid operatingsystem
-    assert_equal "has already been taken", operatingsystem.os_parameters.select {|param| param.name=='a'}.sort[1].errors[:name].first
+    assert_equal "has already been taken", operatingsystem.os_parameters.select {|param| param.name == 'a'}.sort[1].errors[:name].first
     assert_equal "Please ensure the following parameters name are unique", operatingsystem.errors[:os_parameters].first
   end
 
@@ -237,9 +237,9 @@ class OperatingsystemTest < ActiveSupport::TestCase
   test "should not create os with an invalid parameter - no name" do
     pid = Time.now.to_i
     operatingsystem = FactoryBot.build_stubbed(:operatingsystem, :os_parameters_attributes =>
-        {pid += 1=>{"value"=>"1"},
-         pid += 1=>{"name"=>"a", "value"=>"2"},
-         pid +  1=>{"name"=>"b", "value"=>"1"}})
+        {pid += 1 => {"value" => "1"},
+         pid += 1 => {"name" => "a", "value" => "2"},
+         pid +  1 => {"name" => "b", "value" => "1"}})
     refute_valid operatingsystem
   end
 
diff --git a/test/models/operatingsystems/operatingsystems_test.rb b/test/models/operatingsystems/operatingsystems_test.rb
index f8d93878e..3c80efffd 100644
--- a/test/models/operatingsystems/operatingsystems_test.rb
+++ b/test/models/operatingsystems/operatingsystems_test.rb
@@ -81,7 +81,7 @@ class OperatingsystemsTest < ActiveSupport::TestCase
     end
   end
 
-  { :coreos      => { 'os' => :coreos, 'arch' => :x86_64, 'medium' => :coreos,
+  { :coreos => { 'os' => :coreos, 'arch' => :x86_64, 'medium' => :coreos,
                       'kernel' => 'http://stable.release.core-os.net/amd64-usr/494.5.0/coreos_production_pxe.vmlinuz',
                       'initrd' => 'http://stable.release.core-os.net/amd64-usr/494.5.0/coreos_production_pxe_image.cpio.gz'},
     :debian7_0   => { 'os' => :debian7_0, 'arch' => :x86_64, 'medium' => :debian,
diff --git a/test/models/orchestration/compute_test.rb b/test/models/orchestration/compute_test.rb
index a43272adb..9f14cfaca 100644
--- a/test/models/orchestration/compute_test.rb
+++ b/test/models/orchestration/compute_test.rb
@@ -98,7 +98,7 @@ class ComputeOrchestrationTest < ActiveSupport::TestCase
     image = images(:one)
     host = FactoryBot.build_stubbed(:host, :operatingsystem => image.operatingsystem, :image => image,
                              :compute_resource => image.compute_resource)
-    prov_temp = FactoryBot.create(:provisioning_template, :template_kind => TemplateKind.create(:name =>"user_data"))
+    prov_temp = FactoryBot.create(:provisioning_template, :template_kind => TemplateKind.create(:name => "user_data"))
     host.stubs(:provisioning_template).returns(prov_temp)
     attrs = {}
     host.stubs(:compute_attributes).returns(attrs)
diff --git a/test/models/puppetclass_test.rb b/test/models/puppetclass_test.rb
index 11e2ff9f2..2a4fe2b5d 100644
--- a/test/models/puppetclass_test.rb
+++ b/test/models/puppetclass_test.rb
@@ -38,7 +38,7 @@ class PuppetclassTest < ActiveSupport::TestCase
       @one.save!
     end
     as_user :one do
-      nested_lookup_key_params = {:new_1372154591368 => {:key=>"test_param", :key_type=>"string", :default_value => "7777", :path =>"fqdn\r\nhostgroup\r\nos\r\ndomain"}}
+      nested_lookup_key_params = {:new_1372154591368 => {:key => "test_param", :key_type => "string", :default_value => "7777", :path => "fqdn\r\nhostgroup\r\nos\r\ndomain"}}
       assert Puppetclass.first.update(:lookup_keys_attributes => nested_lookup_key_params)
     end
   end
@@ -160,20 +160,20 @@ class PuppetclassTest < ActiveSupport::TestCase
     klass = FactoryBot.create(:puppetclass)
     hostgroup = FactoryBot.create(:hostgroup)
     lk = FactoryBot.create(:variable_lookup_key, puppetclass_id: klass.id)
-    attributes = {"hostgroup_ids"=>[hostgroup.id],
-      "lookup_keys_attributes"=>
-      {"0"=>
-        { "_destroy"=>"false",
-          "key"=>"hahs",
-          "description"=>"",
-          "key_type"=>"hash",
-          "default_value"=>"{\"foo\" => \"bar\"}",
-          "hidden_value"=>"0",
-          "validator_type"=>"",
-          "path"=>"owner\r\nfqdn\r\nhostgroup\r\nos\r\ndomain",
-          "merge_overrides"=>"0",
-          "lookup_values_attributes"=>{"0"=>{"match"=>"owner=sdgsd", "value"=>"{\"foo\" => \"bar\"}", "_destroy"=>"false"}},
-          "id"=>lk.id
+    attributes = {"hostgroup_ids" => [hostgroup.id],
+      "lookup_keys_attributes" =>
+      {"0" =>
+        { "_destroy" => "false",
+          "key" => "hahs",
+          "description" => "",
+          "key_type" => "hash",
+          "default_value" => "{\"foo\" => \"bar\"}",
+          "hidden_value" => "0",
+          "validator_type" => "",
+          "path" => "owner\r\nfqdn\r\nhostgroup\r\nos\r\ndomain",
+          "merge_overrides" => "0",
+          "lookup_values_attributes" => {"0" => {"match" => "owner=sdgsd", "value" => "{\"foo\" => \"bar\"}", "_destroy" => "false"}},
+          "id" => lk.id
         }
       }
     }
diff --git a/test/models/report_test.rb b/test/models/report_test.rb
index 14e202717..e9133b5ab 100644
--- a/test/models/report_test.rb
+++ b/test/models/report_test.rb
@@ -11,9 +11,9 @@ class ReportTest < ActiveSupport::TestCase
     Source.delete_all
     FactoryBot.create_list(:report, report_count, :with_logs)
     FactoryBot.create_list(:report, report_count, :with_logs, :old_report)
-    assert_equal report_count*2, Report.count
-    assert_difference('Report.count', -1*report_count) do
-      assert_difference(['Log.count', 'Message.count', 'Source.count'], -1*report_count*5) do
+    assert_equal report_count * 2, Report.count
+    assert_difference('Report.count', -1 * report_count) do
+      assert_difference(['Log.count', 'Message.count', 'Source.count'], -1 * report_count * 5) do
         Report.expire
       end
     end
@@ -107,7 +107,7 @@ class ReportTest < ActiveSupport::TestCase
       assert_equal({}, report.metrics)
       report = ConfigReport.import read_json_fixture('reports/no-logs.json')
       refute_equal({}, report.metrics)
-      assert_equal({'success' => 1, 'total' => 1, 'failure' =>0}, report.metrics['events'])
+      assert_equal({'success' => 1, 'total' => 1, 'failure' => 0}, report.metrics['events'])
       report = TestReport.new
       assert_equal({}, report.metrics)
     end
diff --git a/test/models/role_test.rb b/test/models/role_test.rb
index 9e2360af7..1b56ffe8a 100644
--- a/test/models/role_test.rb
+++ b/test/models/role_test.rb
@@ -186,7 +186,7 @@ class RoleTest < ActiveSupport::TestCase
       let(:first) { Role.create(:name => 'First') }
       let(:second) { Role.create(:name => 'Second') }
       before do
-        users(:one).roles<< first
+        users(:one).roles << first
         User.current = users(:one)
       end
 
diff --git a/test/models/setting_test.rb b/test/models/setting_test.rb
index b48e61955..2fee57e6e 100644
--- a/test/models/setting_test.rb
+++ b/test/models/setting_test.rb
@@ -321,7 +321,7 @@ class SettingTest < ActiveSupport::TestCase
     attrs = { :name => "foreman_url", :default => "http://foo.com" }
     assert Setting.where(:name => attrs[:name]).first || Setting.create(attrs)
     setting = Setting.find_by_name("foreman_url")
-    setting.value="##"
+    setting.value = "##"
     assert !setting.save
     assert_equal "URL must be valid and schema must be one of http and https", setting.errors[:value].first
   end
@@ -347,7 +347,7 @@ class SettingTest < ActiveSupport::TestCase
     attrs = { :name => "unattended_url", :default => "http://foo.com" }
     assert Setting.where(:name => attrs[:name]).first || Setting.create(attrs)
     setting = Setting.find_by_name("unattended_url")
-    setting.value="##"
+    setting.value = "##"
     assert !setting.save
     assert_equal "URL must be valid and schema must be one of http and https", setting.errors[:value].first
   end
diff --git a/test/models/shared/taxonomies_base_test.rb b/test/models/shared/taxonomies_base_test.rb
index cf703ffec..23ec3d9e6 100644
--- a/test/models/shared/taxonomies_base_test.rb
+++ b/test/models/shared/taxonomies_base_test.rb
@@ -292,9 +292,9 @@ module TaxonomiesBaseTest
                          :subnet           => subnet)
       FactoryBot.build(:host,
                          :"#{taxonomy_name}" => parent,
-                         :domain           => domain2)
+                         :domain => domain2)
       FactoryBot.build(:os_default_template,
-                         :provisioning_template  => templates(:mystring2),
+                         :provisioning_template => templates(:mystring2),
                          :operatingsystem  => operatingsystems(:centos5_3),
                          :template_kind    => TemplateKind.find_by_name('provision'))
 
diff --git a/test/models/smart_proxy_test.rb b/test/models/smart_proxy_test.rb
index e5857ce22..f836ff46b 100644
--- a/test/models/smart_proxy_test.rb
+++ b/test/models/smart_proxy_test.rb
@@ -88,7 +88,7 @@ class SmartProxyTest < ActiveSupport::TestCase
 
   test "should be saved if features exist" do
     proxy = FactoryBot.build(:smart_proxy)
-    ProxyAPI::Features.any_instance.stubs(:features =>["tftp"])
+    ProxyAPI::Features.any_instance.stubs(:features => ["tftp"])
     assert proxy.save
     assert_include(proxy.features, features(:tftp))
   end
@@ -97,7 +97,7 @@ class SmartProxyTest < ActiveSupport::TestCase
     proxy = SmartProxy.new(:name => 'Proxy', :url => 'https://some.where.net:8443')
     error_message = 'Features "feature" in this proxy are not recognized by Foreman. '\
     'If these features come from a Smart Proxy plugin, make sure Foreman has the plugin installed too.'
-    ProxyAPI::Features.any_instance.stubs(:features =>["feature"])
+    ProxyAPI::Features.any_instance.stubs(:features => ["feature"])
     refute proxy.save
     assert_equal(error_message, proxy.errors[:base].first)
   end
diff --git a/test/models/subnet/ipv4_test.rb b/test/models/subnet/ipv4_test.rb
index cf3809815..f33bb15b7 100644
--- a/test/models/subnet/ipv4_test.rb
+++ b/test/models/subnet/ipv4_test.rb
@@ -53,29 +53,29 @@ class Subnet::Ipv4Test < ActiveSupport::TestCase
   end
 
   test "should be able to save ranges" do
-    s=subnets(:one)
+    s = subnets(:one)
     s.from = "2.3.4.15"
     s.to   = "2.3.4.17"
     assert s.save
   end
 
   test "should not be able to save ranges if they dont belong to the subnet" do
-    s=subnets(:one)
+    s = subnets(:one)
     s.from = "2.3.3.15"
     s.to   = "2.3.4.17"
     assert !s.save
   end
 
   test "should not be able to save ranges if one of them is missing" do
-    s=subnets(:one)
+    s = subnets(:one)
     s.from = "2.3.4.15"
     assert !s.save
-    s.to   = "2.3.4.17"
+    s.to = "2.3.4.17"
     assert s.save
   end
 
   test "should not be able to save ranges if one of them is invalid" do
-    s=subnets(:one)
+    s = subnets(:one)
     s.from = "2.3.4.abc"
     s.to   = "2.3.4.17"
     refute s.valid?
diff --git a/test/models/taxonomix_test.rb b/test/models/taxonomix_test.rb
index 1cea16ba8..29f80299f 100644
--- a/test/models/taxonomix_test.rb
+++ b/test/models/taxonomix_test.rb
@@ -318,7 +318,7 @@ class TaxonomixTest < ActiveSupport::TestCase
   test "#used_organization_ids should not return organization for user with same id as of user_group which is assigned to host as owner." do
     org = FactoryBot.create(:organization)
     user = FactoryBot.create(:user, :id => 25, :organizations => [org])
-    ugroup = FactoryBot.create(:usergroup, :id=> 25)
+    ugroup = FactoryBot.create(:usergroup, :id => 25)
     FactoryBot.create(:host, :owner => ugroup, :organization => org)
     as_admin do
       used_organizations = user.used_organization_ids
diff --git a/test/models/token_test.rb b/test/models/token_test.rb
index 889ed6d6c..333dbac0f 100644
--- a/test/models/token_test.rb
+++ b/test/models/token_test.rb
@@ -16,7 +16,7 @@ class TokenTest < ActiveSupport::TestCase
     h = FactoryBot.create(:host)
     h.create_token(:value => "aaaaaa", :expires => Time.now.utc + 1.minute)
     assert_instance_of Token, h.token
-    h.token=nil
+    h.token = nil
     assert Token.where(:value => "aaaaaa", :host_id => h.id).empty?
   end
 
@@ -26,7 +26,7 @@ class TokenTest < ActiveSupport::TestCase
     h1.create_token(:value => "aaaaaa", :expires => Time.now.utc + 1.minute)
     h2.create_token(:value => "bbbbbb", :expires => Time.now.utc + 1.minute)
     assert_equal Token.all.size, 2
-    h1.token=nil
+    h1.token = nil
     assert_equal Token.all.size, 1
   end
 
diff --git a/test/models/user_role_test.rb b/test/models/user_role_test.rb
index 409141956..66af9faf4 100644
--- a/test/models/user_role_test.rb
+++ b/test/models/user_role_test.rb
@@ -75,7 +75,7 @@ class UserRoleTest < ActiveSupport::TestCase
     @admin_user      = FactoryBot.create(:user, :login => 'ur_admin1')
     @superadmin_user = FactoryBot.create(:user, :login => 'ur_superadmin1')
 
-    @semiadmins.users  += @semiadmin_users
+    @semiadmins.users += @semiadmin_users
     @admins.users      = [@admin_user]
     @superadmins.users = [@superadmin_user]
 
diff --git a/test/models/user_test.rb b/test/models/user_test.rb
index f53d243d2..7e8973cc9 100644
--- a/test/models/user_test.rb
+++ b/test/models/user_test.rb
@@ -113,7 +113,7 @@ class UserTest < ActiveSupport::TestCase
 
   test "create user with roles" do
     (1..test_roles.length).each do |index|
-      chosen_roles = test_roles[0..index-1]
+      chosen_roles = test_roles[0..index - 1]
       user = FactoryBot.create :user, :roles => chosen_roles
       assert_equal chosen_roles.length + 1, user.roles.length
       assert_equal chosen_roles.push(Role.find_by_name('Default role')).sort, user.roles.sort
@@ -124,7 +124,7 @@ class UserTest < ActiveSupport::TestCase
     user = FactoryBot.create :user
     assert_equal 1, user.roles.length
     (1..test_roles.length).each do |index|
-      chosen_roles = test_roles[0..index-1]
+      chosen_roles = test_roles[0..index - 1]
       user.roles = chosen_roles
       assert_equal chosen_roles.length, user.roles.length
       assert_equal chosen_roles, user.roles
@@ -165,7 +165,7 @@ class UserTest < ActiveSupport::TestCase
   test 'login should also be unique across usergroups' do
     Usergroup.expects(:where).with(:name => 'foo').returns(['fakeuser'])
     u = FactoryBot.build_stubbed(:user, :auth_source => auth_sources(:one),
-                                 :login => "foo", :mail  => "foo@bar.com")
+                                 :login => "foo", :mail => "foo@bar.com")
     refute u.valid?
   end
 
@@ -255,7 +255,7 @@ class UserTest < ActiveSupport::TestCase
       end
 
       test "ldap user attribute should not be saved in DB on create when invalid format (mail)" do
-        attrs = {:firstname=>"foo", :mail=>"foo#bar", :login=>"ldap-user", :auth_source_id=>auth_sources(:one).id}
+        attrs = {:firstname => "foo", :mail => "foo#bar", :login => "ldap-user", :auth_source_id => auth_sources(:one).id}
         AuthSourceLdap.any_instance.stubs(:authenticate).returns(attrs)
         user = User.try_to_auto_create_user('foo', 'password')
         assert_equal 'foo#bar', user.mail
@@ -264,7 +264,7 @@ class UserTest < ActiveSupport::TestCase
       end
 
       test "ldap user attribute should not be saved in DB on create when invalid format (firstname)" do
-        attrs = {:firstname=>"$%$%%%", :mail=>"foo@bar.com", :login=>"ldap-user", :auth_source_id=>auth_sources(:one).id}
+        attrs = {:firstname => "$%$%%%", :mail => "foo@bar.com", :login => "ldap-user", :auth_source_id => auth_sources(:one).id}
         AuthSourceLdap.any_instance.stubs(:authenticate).returns(attrs)
         user = User.try_to_auto_create_user('foo', 'password')
         assert_equal '$%$%%%', user.firstname
@@ -273,7 +273,7 @@ class UserTest < ActiveSupport::TestCase
       end
 
       test "ldap user attribute should not be saved in DB on login when invalid format (mail)" do
-        attrs = {:firstname=>"foo", :mail=>"foo#bar", :login=>"ldap-user", :auth_source_id=>auth_sources(:one).id}
+        attrs = {:firstname => "foo", :mail => "foo#bar", :login => "ldap-user", :auth_source_id => auth_sources(:one).id}
         AuthSourceLdap.any_instance.stubs(:authenticate).returns(attrs)
         user = User.try_to_login('foo', 'password')
         assert_equal 'foo#bar', user.mail
@@ -282,7 +282,7 @@ class UserTest < ActiveSupport::TestCase
       end
 
       test "ldap user attribute should not be saved in DB on login when invalid format (firstname)" do
-        attrs = {:firstname=>"$%$%%%", :mail=>"foo@bar.com", :login=>"ldap-user", :auth_source_id=>auth_sources(:one).id}
+        attrs = {:firstname => "$%$%%%", :mail => "foo@bar.com", :login => "ldap-user", :auth_source_id => auth_sources(:one).id}
         AuthSourceLdap.any_instance.stubs(:authenticate).returns(attrs)
         user = User.try_to_login('foo', 'password')
         assert_equal '$%$%%%', user.firstname
@@ -550,7 +550,7 @@ class UserTest < ActiveSupport::TestCase
     user   = users(:one)
     foobar = Role.where(:name => "foobar").first_or_create
     barfoo = Role.where(:name => "barfoo").first_or_create
-    user.roles<< foobar
+    user.roles << foobar
 
     assert user.can_assign?([foobar.id])
     refute user.can_assign?([foobar.id, barfoo.id])
@@ -562,7 +562,7 @@ class UserTest < ActiveSupport::TestCase
     user   = users(:one)
     foobar = Role.where(:name => "foobar").first_or_create
     barfoo = Role.where(:name => "barfoo").first_or_create
-    user.roles<< foobar
+    user.roles << foobar
 
     user.role_ids = [foobar.id]
     refute user.role_ids_changed?
@@ -583,7 +583,7 @@ class UserTest < ActiveSupport::TestCase
     user   = users(:one)
     foobar = Role.where(:name => "foobar").first_or_create
     Role.where(:name => "barfoo").first_or_create
-    user.roles<< foobar
+    user.roles << foobar
 
     user.role_ids = []
     assert_empty user.roles
@@ -593,7 +593,7 @@ class UserTest < ActiveSupport::TestCase
     user   = users(:one)
     foobar = Role.where(:name => "foobar").first_or_create
     Role.where(:name => "barfoo").first_or_create
-    user.roles<< foobar
+    user.roles << foobar
 
     user.role_ids = nil
     assert_empty user.roles
diff --git a/test/models/usergroup_member_test.rb b/test/models/usergroup_member_test.rb
index 89b6a5a0e..955904653 100644
--- a/test/models/usergroup_member_test.rb
+++ b/test/models/usergroup_member_test.rb
@@ -104,8 +104,8 @@ class UsergroupMemberTest < ActiveSupport::TestCase
 
     basic      = FactoryBot.create :usergroup, :name => 'um_basic'
     basic_role = FactoryBot.create :role, :name => 'um_basic_role'
-    basic.roles<< basic_role
-    basic.usergroups<< @semiadmins
+    basic.roles << basic_role
+    basic.usergroups << @semiadmins
     [@semiadmin_user, @admin_user, @superadmin_user].map(&:reload)
 
     assert_includes @semiadmin_user.cached_user_roles.map(&:role), basic_role
@@ -122,8 +122,8 @@ class UsergroupMemberTest < ActiveSupport::TestCase
 
     basic      = FactoryBot.create :usergroup, :name => 'um_basic'
     basic_role = FactoryBot.create :role, :name => 'um_basic_role'
-    basic.roles<< basic_role
-    basic.usergroups<< @admins
+    basic.roles << basic_role
+    basic.usergroups << @admins
     [@semiadmin_user, @admin_user, @superadmin_user].map(&:reload)
 
     assert_not_includes @semiadmin_user.cached_user_roles.map(&:role), basic_role
@@ -140,8 +140,8 @@ class UsergroupMemberTest < ActiveSupport::TestCase
 
     basic      = FactoryBot.create :usergroup, :name => 'um_basic'
     basic_role = FactoryBot.create :role, :name => 'um_basic_role'
-    basic.roles<< basic_role
-    basic.usergroups<< @superadmins
+    basic.roles << basic_role
+    basic.usergroups << @superadmins
     [@semiadmin_user, @admin_user, @superadmin_user].map(&:reload)
 
     assert_not_includes @semiadmin_user.cached_user_roles.map(&:role), basic_role
@@ -209,7 +209,7 @@ class UsergroupMemberTest < ActiveSupport::TestCase
     setup_redundant_scenario
     @superadmins = FactoryBot.create :usergroup, :name => 'um_superadmins'
     @superadmins.usergroups = [@semiadmins]
-    @superadmins.roles<< @admin_role
+    @superadmins.roles << @admin_role
 
     @admins.users = []
     @semiadmin_user.reload
@@ -361,9 +361,9 @@ class UsergroupMemberTest < ActiveSupport::TestCase
       @role1 = FactoryBot.create(:role)
       @role2 = FactoryBot.create(:role)
       @role3 = FactoryBot.create(:role)
-      @semiadmin_user.roles<< @role1
-      @admin_user.roles<< @role2
-      @superadmin_user.roles<< @role3
+      @semiadmin_user.roles << @role1
+      @admin_user.roles << @role2
+      @superadmin_user.roles << @role3
     end
   end
 end
diff --git a/test/models/usergroup_test.rb b/test/models/usergroup_test.rb
index 8ee389589..9faa30d9a 100644
--- a/test/models/usergroup_test.rb
+++ b/test/models/usergroup_test.rb
@@ -92,7 +92,7 @@ class UsergroupTest < ActiveSupport::TestCase
 
   def populate_usergroups
     (1..6).each do |number|
-      instance_variable_set("@ug#{number}", FactoryBot.create(:usergroup, :name=> "ug#{number}"))
+      instance_variable_set("@ug#{number}", FactoryBot.create(:usergroup, :name => "ug#{number}"))
       instance_variable_set("@u#{number}", FactoryBot.create(:user, :mail => "u#{number}@someware.com",
                                                               :login => "u#{number}"))
     end
diff --git a/test/unit/classification_test.rb b/test/unit/classification_test.rb
index af8ead6e7..d12e90837 100644
--- a/test/unit/classification_test.rb
+++ b/test/unit/classification_test.rb
@@ -572,7 +572,7 @@ class ClassificationTest < ActiveSupport::TestCase
 
     as_admin do
       LookupValue.create! :lookup_key_id => key.id,
-                          :match =>"organization=#{taxonomies(:organization1)}",
+                          :match => "organization=#{taxonomies(:organization1)}",
                           :value => "org",
                           :omit => false
     end
@@ -613,7 +613,7 @@ class ClassificationTest < ActiveSupport::TestCase
 
     as_admin do
       LookupValue.create! :lookup_key_id => key.id,
-                          :match =>"location=#{taxonomies(:location1)}",
+                          :match => "location=#{taxonomies(:location1)}",
                           :value => "loc",
                           :omit => true
     end
@@ -677,7 +677,7 @@ class ClassificationTest < ActiveSupport::TestCase
 
     as_admin do
       LookupValue.create! :lookup_key_id => key.id,
-                          :match =>"location=#{taxonomies(:location1)}",
+                          :match => "location=#{taxonomies(:location1)}",
                           :value => "loc",
                           :omit => false
     end
diff --git a/test/unit/csv_exporter_test.rb b/test/unit/csv_exporter_test.rb
index f04091304..fc8e989c4 100644
--- a/test/unit/csv_exporter_test.rb
+++ b/test/unit/csv_exporter_test.rb
@@ -4,7 +4,7 @@ class CsvExporterTest < ActiveSupport::TestCase
   test 'return correct amount of lines' do
     result = CsvExporter.export(Host::Managed, [:id])
     assert_equal "Id\n", result.next
-    assert_equal result.count, Host::Managed.count+1
+    assert_equal result.count, Host::Managed.count + 1
     assert_difference('CsvExporter.export(Host::Managed, [:id]).count') do
       FactoryBot.create(:host)
     end
diff --git a/test/unit/hash_for_test.rb b/test/unit/hash_for_test.rb
index 4cb056c93..98e8edc38 100644
--- a/test/unit/hash_for_test.rb
+++ b/test/unit/hash_for_test.rb
@@ -11,7 +11,7 @@ class HashForTest < ActionView::TestCase
   end
 
   test "hash_for_* causes link_to to generate links to root from within nested controller" do
-    opts = url_options.merge(:_recall => {:controller=>"foreman_example/examples", :action=>"index"})
+    opts = url_options.merge(:_recall => {:controller => "foreman_example/examples", :action => "index"})
     expects(:url_options).returns(opts)
     assert_includes link_to('test', hash_for_hosts_path), 'href="/hosts"'
   end
diff --git a/test/unit/menu_item_test.rb b/test/unit/menu_item_test.rb
index 6621f0fc1..b90b1b2fc 100644
--- a/test/unit/menu_item_test.rb
+++ b/test/unit/menu_item_test.rb
@@ -42,17 +42,17 @@ class MenuItemTest < ActiveSupport::TestCase
   end
 
   def test_new_menu_item_with_all_required_parameters
-    assert Menu::Item.new(:test_good_menu, :url_hash => {:controller=>'test', :action=>'index'}, :after => :me)
+    assert Menu::Item.new(:test_good_menu, :url_hash => {:controller => 'test', :action => 'index'}, :after => :me)
   end
 
   def test_menu_item_should_use_url_parameter_when_available
-    item = Menu::Item.new(:test_good_menu, :url => '/overriden/url', :url_hash => {:controller=>'test', :action=>'index'}, :after => :me)
+    item = Menu::Item.new(:test_good_menu, :url => '/overriden/url', :url_hash => {:controller => 'test', :action => 'index'}, :after => :me)
     assert_equal '/overriden/url', item.url
   end
 
   def test_menu_item_uses_url_hash_by_default
-    item = Menu::Item.new(:test_good_menu, :url_hash => {:controller=>'test', :action=>'index'}, :after => :me)
-    ActionDispatch::Routing::RouteSet.any_instance.expects(:url_for).with(:controller=>'test', :action=>'index', :only_path => true).returns('/url')
+    item = Menu::Item.new(:test_good_menu, :url_hash => {:controller => 'test', :action => 'index'}, :after => :me)
+    ActionDispatch::Routing::RouteSet.any_instance.expects(:url_for).with(:controller => 'test', :action => 'index', :only_path => true).returns('/url')
     assert_equal '/url', item.url
   end
 
@@ -95,7 +95,7 @@ class MenuItemTest < ActiveSupport::TestCase
   end
 
   def test_menu_item_exposes_turbolinks_option
-    item = Menu::Item.new(:test_good_menu, :url_hash => {:controller=>'test', :action=>'index'}, :after => :me, :turbolinks => false)
+    item = Menu::Item.new(:test_good_menu, :url_hash => {:controller => 'test', :action => 'index'}, :after => :me, :turbolinks => false)
     assert_equal item.turbolinks, false
   end
 end
diff --git a/test/unit/menu_manager_test.rb b/test/unit/menu_manager_test.rb
index f2f139509..d5159b883 100644
--- a/test/unit/menu_manager_test.rb
+++ b/test/unit/menu_manager_test.rb
@@ -45,13 +45,13 @@ class MenuManagerTest < ActiveSupport::TestCase
       :name => "User",
       :icon => "fa-icon",
       :children =>
-        [{:type => :item, :name=>"Item", :url=>"some url"},
-         {:type => :divider, :name=>nil},
-         {:type => :item, :name=>"Item 2", :url=>"some url"}]},
+        [{:type => :item, :name => "Item", :url => "some url"},
+         {:type => :divider, :name => nil},
+         {:type => :item, :name => "Item 2", :url => "some url"}]},
      {:type => :sub_menu,
       :name => "User",
       :icon => "fa-icon",
-      :children => [{:type=>:item, :name=>"Item 3", :url=>"some url"}]}]
+      :children => [{:type => :item, :name => "Item 3", :url => "some url"}]}]
   end
 
   def create_nested_menu
diff --git a/test/unit/menu_mapper_test.rb b/test/unit/menu_mapper_test.rb
index df20e58cd..b57ab0e07 100644
--- a/test/unit/menu_mapper_test.rb
+++ b/test/unit/menu_mapper_test.rb
@@ -183,8 +183,8 @@ class MenuMapperTest < ActiveSupport::TestCase
   test 'deleting all items' do
     # Exposed by deleting :last items
     Menu::Manager.map :test_menu do |menu|
-      menu.item :not_last, :url_hash=> { :controller => 'hosts', :action => 'index'}
-      menu.item :administration, :url_hash=> { :controller => 'hosts', :action => 'show'}, :last => true
+      menu.item :not_last, :url_hash => { :controller => 'hosts', :action => 'index'}
+      menu.item :administration, :url_hash => { :controller => 'hosts', :action => 'show'}, :last => true
       menu.item :help, :url_hash => { :controller => 'help', :action => 'show'}, :last => true
     end
 
diff --git a/test/unit/net/dhcp_test.rb b/test/unit/net/dhcp_test.rb
index a7a4311de..87e8c2607 100644
--- a/test/unit/net/dhcp_test.rb
+++ b/test/unit/net/dhcp_test.rb
@@ -66,7 +66,7 @@ class DhcpTest < ActiveSupport::TestCase
   end
 
   test "conflicts should be detected for mismatched records" do
-    proxy_lease = {"starts"=>"2014-05-09 11:55:21 UTC", "ends"=>"2014-05-09 12:05:21 UTC", "state"=>"active", "mac"=>"aa:bb:cc:dd:ee:ff", "subnet"=>"127.0.0.0/255.0.0.0", "ip"=>"127.0.0.1"}
+    proxy_lease = {"starts" => "2014-05-09 11:55:21 UTC", "ends" => "2014-05-09 12:05:21 UTC", "state" => "active", "mac" => "aa:bb:cc:dd:ee:ff", "subnet" => "127.0.0.0/255.0.0.0", "ip" => "127.0.0.1"}
     ProxyAPI::Resource.any_instance.stubs(:get).with('127.0.0.0/mac/aa:bb:cc:dd:ee:ff').returns("lease")
     ProxyAPI::Resource.any_instance.stubs(:get).with('127.0.0.0/ip/127.0.0.1').returns("")
     ProxyAPI::Resource.any_instance.stubs(:get).with('127.0.0.0/ip/127.0.0.2').returns("")
@@ -79,7 +79,7 @@ class DhcpTest < ActiveSupport::TestCase
   end
 
   test "conflicts should be not detected for records with no hostname" do
-    proxy_lease = {"starts"=>"2014-05-09 11:55:21 UTC", "ends"=>"2014-05-09 12:05:21 UTC", "state"=>"active", "mac"=>"aa:bb:cc:dd:ee:ff", "subnet"=>"127.0.0.0/255.0.0.0", "ip"=>"127.0.0.1"}
+    proxy_lease = {"starts" => "2014-05-09 11:55:21 UTC", "ends" => "2014-05-09 12:05:21 UTC", "state" => "active", "mac" => "aa:bb:cc:dd:ee:ff", "subnet" => "127.0.0.0/255.0.0.0", "ip" => "127.0.0.1"}
     ProxyAPI::Resource.any_instance.stubs(:get).with('127.0.0.0/mac/aa:bb:cc:dd:ee:ff').returns("lease")
     ProxyAPI::Resource.any_instance.stubs(:get).with('127.0.0.0/ip/127.0.0.1').returns("")
     ProxyAPI::Resource.any_instance.stubs(:parse).with('lease').returns(proxy_lease)
diff --git a/test/unit/plugin_test.rb b/test/unit/plugin_test.rb
index 32488e8c1..a5df98b37 100644
--- a/test/unit/plugin_test.rb
+++ b/test/unit/plugin_test.rb
@@ -77,10 +77,10 @@ class PluginTest < ActiveSupport::TestCase
   end
 
   def test_menu
-    url_hash = {:controller=>'hosts', :action=>'index'}
+    url_hash = {:controller => 'hosts', :action => 'index'}
     assert_difference 'Menu::Manager.items(:project_menu).size' do
       @klass.register :foo do
-        menu :project_menu, :foo_menu_item, :url_hash=>url_hash, :caption => 'Foo'
+        menu :project_menu, :foo_menu_item, :url_hash => url_hash, :caption => 'Foo'
       end
     end
     menu_item = Menu::Manager.items(:project_menu).detect {|i| i.name == :foo_menu_item}
diff --git a/test/unit/proxy_api/bmc_test.rb b/test/unit/proxy_api/bmc_test.rb
index e71f7a34a..2def04792 100644
--- a/test/unit/proxy_api/bmc_test.rb
+++ b/test/unit/proxy_api/bmc_test.rb
@@ -13,7 +13,7 @@ class ProxyApiBmcTest < ActiveSupport::TestCase
   end
 
   test "base url should equal /bmc" do
-    expected = @url+"/bmc"
+    expected = @url + "/bmc"
     assert_equal(expected, @testbmc.url)
   end
 
diff --git a/test/unit/proxy_api/dhcp_test.rb b/test/unit/proxy_api/dhcp_test.rb
index 451917e66..09fb76534 100644
--- a/test/unit/proxy_api/dhcp_test.rb
+++ b/test/unit/proxy_api/dhcp_test.rb
@@ -34,14 +34,14 @@ class ProxyApiDhcpTest < ActiveSupport::TestCase
       test 'retrieves an array with a single dhcp record' do
         result = proxy_dhcp.record('192.168.0.0', '192.168.0.10')
         assert_kind_of Net::DHCP::Record, result
-        assert_equal({:hostname=>"www.example.com",
-                      :mac=>"00:11:22:33:44:55",
-                      :ip=>"192.168.0.10",
-                      :network=>"192.168.0.0",
-                      :nextServer=>"1.2.3.4",
-                      :filename=>"pxelinux.0",
-                      :name=>"www.example.com",
-                      :related_macs=>[]}, result.attrs)
+        assert_equal({:hostname => "www.example.com",
+                      :mac => "00:11:22:33:44:55",
+                      :ip => "192.168.0.10",
+                      :network => "192.168.0.0",
+                      :nextServer => "1.2.3.4",
+                      :filename => "pxelinux.0",
+                      :name => "www.example.com",
+                      :related_macs => []}, result.attrs)
       end
     end
 
@@ -54,14 +54,14 @@ class ProxyApiDhcpTest < ActiveSupport::TestCase
         result = proxy_dhcp.records_by_ip('192.168.0.0', '192.168.0.10')
         assert_kind_of Array, result
         assert_kind_of Net::DHCP::Record, result.first
-        assert_equal({:hostname=>"www.example.com",
-                      :mac=>"00:11:22:33:44:55",
-                      :ip=>"192.168.0.10",
-                      :network=>"192.168.0.0",
-                      :nextServer=>"1.2.3.4",
-                      :filename=>"pxelinux.0",
-                      :name=>"www.example.com",
-                      :related_macs=>[]}, result.first.attrs)
+        assert_equal({:hostname => "www.example.com",
+                      :mac => "00:11:22:33:44:55",
+                      :ip => "192.168.0.10",
+                      :network => "192.168.0.0",
+                      :nextServer => "1.2.3.4",
+                      :filename => "pxelinux.0",
+                      :name => "www.example.com",
+                      :related_macs => []}, result.first.attrs)
       end
     end
   end
@@ -71,8 +71,8 @@ class ProxyApiDhcpTest < ActiveSupport::TestCase
     subnet_mock.expects(:network).returns('192.168.0.0')
     subnet_mock.expects(:from).returns(nil)
 
-    proxy_dhcp.expects(:get).with('192.168.0.0/unused_ip').returns(fake_rest_client_response({:ip=>'192.168.0.50'}))
-    assert_equal({'ip'=>'192.168.0.50'}, proxy_dhcp.unused_ip(subnet_mock))
+    proxy_dhcp.expects(:get).with('192.168.0.0/unused_ip').returns(fake_rest_client_response({:ip => '192.168.0.50'}))
+    assert_equal({'ip' => '192.168.0.50'}, proxy_dhcp.unused_ip(subnet_mock))
   end
 
   test "unused_ip should get an IP using the network, from and to addresses" do
@@ -92,8 +92,8 @@ class ProxyApiDhcpTest < ActiveSupport::TestCase
       path.include?('192.168.0.0/unused_ip?') &&
         path.include?('from=192.168.0.50') &&
         path.include?('to=192.168.0.150')
-    end.returns(fake_rest_client_response({:ip=>'192.168.0.50'}))
-    assert_equal({'ip'=>'192.168.0.50'}, proxy_dhcp.unused_ip(subnet_mock))
+    end.returns(fake_rest_client_response({:ip => '192.168.0.50'}))
+    assert_equal({'ip' => '192.168.0.50'}, proxy_dhcp.unused_ip(subnet_mock))
   end
 
   test "unused_ip should get an IP using the network and MAC address" do
@@ -101,7 +101,7 @@ class ProxyApiDhcpTest < ActiveSupport::TestCase
     subnet_mock.expects(:network).returns('192.168.0.0')
     subnet_mock.expects(:from).returns(nil)
 
-    proxy_dhcp.expects(:get).with('192.168.0.0/unused_ip?mac=00:11:22:33:44:55').returns(fake_rest_client_response({:ip=>'192.168.0.50'}))
-    assert_equal({'ip'=>'192.168.0.50'}, proxy_dhcp.unused_ip(subnet_mock, '00:11:22:33:44:55'))
+    proxy_dhcp.expects(:get).with('192.168.0.0/unused_ip?mac=00:11:22:33:44:55').returns(fake_rest_client_response({:ip => '192.168.0.50'}))
+    assert_equal({'ip' => '192.168.0.50'}, proxy_dhcp.unused_ip(subnet_mock, '00:11:22:33:44:55'))
   end
 end
diff --git a/test/unit/proxy_api/template_test.rb b/test/unit/proxy_api/template_test.rb
index b60dff7c1..1ad019096 100644
--- a/test/unit/proxy_api/template_test.rb
+++ b/test/unit/proxy_api/template_test.rb
@@ -12,7 +12,7 @@ class ProxyApiTemplateTest < ActiveSupport::TestCase
   end
 
   test "should get template server url" do
-    @template.expects(:get).with('templateServer').returns(fake_rest_client_response({'templateServer'=>'mytemplateserver'}))
+    @template.expects(:get).with('templateServer').returns(fake_rest_client_response({'templateServer' => 'mytemplateserver'}))
     assert_equal('mytemplateserver', @template.template_url)
   end
 end
diff --git a/test/unit/proxy_statuses/proxy_status_puppetca_test.rb b/test/unit/proxy_statuses/proxy_status_puppetca_test.rb
index d1ffd9ba2..0441461c6 100644
--- a/test/unit/proxy_statuses/proxy_status_puppetca_test.rb
+++ b/test/unit/proxy_statuses/proxy_status_puppetca_test.rb
@@ -9,12 +9,12 @@ class ProxyStatusPuppetcaTest < ActiveSupport::TestCase
 
   context 'CA has certificates' do
     setup do
-      certificates = { "proxy.host2"=>{"state"=>"valid", "fingerprint"=>"SHA256", "serial"=>3, "not_before"=>"2015-12-25T14:33:10UTC", "not_after"=>"2020-12-25T14:33:10UTC"},
-                       "secure.proxy"=>{"state"=>"valid", "fingerprint"=>"SHA256", "serial"=>1, "not_before"=>"2015-12-12T14:33:10UTC", "not_after"=>"2020-12-11T14:33:10UTC"},
-                       "proxy.host"=>{"state"=>"valid", "fingerprint"=>"SHA256", "serial"=>2, "not_before"=>"2015-12-22T14:33:10UTC", "not_after"=>"2020-12-22T14:33:10UTC"},
-                       "proxy.host.with_no_dates"=>{"state"=>"valid", "fingerprint"=>"SHA256", "serial"=>5, "not_before"=>nil, "not_after"=>nil},
-                       "refuted.host"=>{"state"=>"refuted", "fingerprint"=>"SHA256", "serial"=>4, "not_before"=>"2015-12-22T14:33:10UTC", "not_after"=>"2020-12-22T14:33:10UTC"},
-                       "pending.host"=>{"state"=>"pending", "fingerprint"=>"SHA256", "serial"=>6}}
+      certificates = { "proxy.host2" => {"state" => "valid", "fingerprint" => "SHA256", "serial" => 3, "not_before" => "2015-12-25T14:33:10UTC", "not_after" => "2020-12-25T14:33:10UTC"},
+                       "secure.proxy" => {"state" => "valid", "fingerprint" => "SHA256", "serial" => 1, "not_before" => "2015-12-12T14:33:10UTC", "not_after" => "2020-12-11T14:33:10UTC"},
+                       "proxy.host" => {"state" => "valid", "fingerprint" => "SHA256", "serial" => 2, "not_before" => "2015-12-22T14:33:10UTC", "not_after" => "2020-12-22T14:33:10UTC"},
+                       "proxy.host.with_no_dates" => {"state" => "valid", "fingerprint" => "SHA256", "serial" => 5, "not_before" => nil, "not_after" => nil},
+                       "refuted.host" => {"state" => "refuted", "fingerprint" => "SHA256", "serial" => 4, "not_before" => "2015-12-22T14:33:10UTC", "not_after" => "2020-12-22T14:33:10UTC"},
+                       "pending.host" => {"state" => "pending", "fingerprint" => "SHA256", "serial" => 6}}
       ProxyAPI::Puppetca.any_instance.expects(:all).returns(certificates)
     end
 
diff --git a/test/unit/puppet_fact_importer_test.rb b/test/unit/puppet_fact_importer_test.rb
index 1353a83e8..006b78db2 100644
--- a/test/unit/puppet_fact_importer_test.rb
+++ b/test/unit/puppet_fact_importer_test.rb
@@ -19,7 +19,7 @@ class PuppetFactImporterTest < ActiveSupport::TestCase
   end
 
   test 'importer imports structured facts' do
-    import({"system_uptime"=>{"seconds"=>14911897, "hours"=>4142, "days"=>172, "uptime"=>"172 days"}})
+    import({"system_uptime" => {"seconds" => 14911897, "hours" => 4142, "days" => 172, "uptime" => "172 days"}})
     assert_nil value('system_uptime')
     assert_equal '172 days', value('system_uptime::uptime')
   end
diff --git a/test/unit/statistics_test.rb b/test/unit/statistics_test.rb
index 28faabd91..a61b4f281 100644
--- a/test/unit/statistics_test.rb
+++ b/test/unit/statistics_test.rb
@@ -18,15 +18,15 @@ class StatisticsTest < ActiveSupport::TestCase
 
   test 'it should set taxonomies as API paramaters according to current context' do
     os = Statistics.charts(taxonomies(:empty_organization).id, nil).detect {|s| s.id == 'operatingsystem'}
-    data = { :id=>"operatingsystem", :title=>"OS Distribution", :url=>"/statistics/operatingsystem?organization_id=#{taxonomies(:empty_organization).id}", :search=>"/hosts?search=os_title=~VAL~" }
+    data = { :id => "operatingsystem", :title => "OS Distribution", :url => "/statistics/operatingsystem?organization_id=#{taxonomies(:empty_organization).id}", :search => "/hosts?search=os_title=~VAL~" }
     assert_equal data, os.metadata
 
     os = Statistics.charts(nil, taxonomies(:location1).id).detect {|s| s.id == 'operatingsystem'}
-    data = { :id=>"operatingsystem", :title=>"OS Distribution", :url=>"/statistics/operatingsystem?location_id=#{taxonomies(:location1).id}", :search=>"/hosts?search=os_title=~VAL~" }
+    data = { :id => "operatingsystem", :title => "OS Distribution", :url => "/statistics/operatingsystem?location_id=#{taxonomies(:location1).id}", :search => "/hosts?search=os_title=~VAL~" }
     assert_equal data, os.metadata
 
     os = Statistics.charts(taxonomies(:empty_organization).id, taxonomies(:location1).id).detect {|s| s.id == 'operatingsystem'}
-    data = { :id=>"operatingsystem", :title=>"OS Distribution", :url=>"/statistics/operatingsystem?location_id=#{taxonomies(:location1).id}&organization_id=#{taxonomies(:empty_organization).id}", :search=>"/hosts?search=os_title=~VAL~" }
+    data = { :id => "operatingsystem", :title => "OS Distribution", :url => "/statistics/operatingsystem?location_id=#{taxonomies(:location1).id}&organization_id=#{taxonomies(:empty_organization).id}", :search => "/hosts?search=os_title=~VAL~" }
     assert_equal data, os.metadata
   end
 
diff --git a/test/unit/ui_notifications/cache_handler_test.rb b/test/unit/ui_notifications/cache_handler_test.rb
index b33258e06..9bc1c9fc0 100644
--- a/test/unit/ui_notifications/cache_handler_test.rb
+++ b/test/unit/ui_notifications/cache_handler_test.rb
@@ -7,7 +7,7 @@ class UINotificationsCacheHandlerTest < ActiveSupport::TestCase
 
   test 'should provide JSON payload' do
     response = JSON.parse(UINotifications::CacheHandler.new(User.first.id).payload)
-    assert_equal({"notifications"=>[]}, response)
+    assert_equal({"notifications" => []}, response)
   end
 
   test 'should have a unique cache key per user' do
