From 0b55cd81474768813a3c47243a389d1f1aa90eb4 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Fri, 21 Aug 2015 23:53:53 +0200 Subject: [PATCH] Fixed rubocop checks. --- app/controllers/search_controller.rb | 2 +- app/models/user_device.rb | 8 ++++---- lib/models.rb | 2 +- test/controllers/search_controller_test.rb | 1 - test/unit/user_device_test.rb | 2 -- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 0fa3af35c..25946bf47 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -34,7 +34,7 @@ class SearchController < ApplicationController next if !preferences objects_in_order_hash[preferences[:prio]] = object } - objects_in_order_hash.keys.sort.reverse.each {|prio| + objects_in_order_hash.keys.sort.reverse_each {|prio| objects_in_order.push objects_in_order_hash[prio] } diff --git a/app/models/user_device.rb b/app/models/user_device.rb index 858d7813e..094597c17 100644 --- a/app/models/user_device.rb +++ b/app/models/user_device.rb @@ -46,7 +46,7 @@ store device for user end # get browser details - browser = Browser.new(:ua => user_agent, :accept_language => 'en-us') + browser = Browser.new(ua: user_agent, accept_language: 'en-us') browser = { plattform: browser.platform.to_s.camelize, name: browser.name, @@ -73,7 +73,7 @@ store device for user end # check if exists - user_device = self.find_by( + user_device = find_by( user_id: user_id, os: browser[:plattform], browser: browser[:name], @@ -85,7 +85,7 @@ store device for user end # create new device - user_device = self.create( + user_device = create( user_id: user_id, name: name, os: browser[:plattform], @@ -120,7 +120,7 @@ log user device action =end - def self.action(user_device_id, user_agent, ip, user_id) + def self.action(user_device_id, _user_agent, ip, _user_id) user_device = UserDevice.find(user_device_id) # update location if needed diff --git a/lib/models.rb b/lib/models.rb index c798a9aaa..ea73526a1 100644 --- a/lib/models.rb +++ b/lib/models.rb @@ -64,7 +64,7 @@ returns def self.searchable models = [] - all.each {|model_class, options| + all.each {|model_class, _options| next if !model_class next if !model_class.respond_to? :search_preferences models.push model_class diff --git a/test/controllers/search_controller_test.rb b/test/controllers/search_controller_test.rb index 760241ae4..ebe6e18b8 100644 --- a/test/controllers/search_controller_test.rb +++ b/test/controllers/search_controller_test.rb @@ -452,5 +452,4 @@ class SearchControllerTest < ActionDispatch::IntegrationTest end - end diff --git a/test/unit/user_device_test.rb b/test/unit/user_device_test.rb index 8d61e9888..7565fa328 100644 --- a/test/unit/user_device_test.rb +++ b/test/unit/user_device_test.rb @@ -21,7 +21,6 @@ class UserDeviceTest < ActiveSupport::TestCase ) end - test 'session test' do # signin with fingerprint A from country A via session -> new device #1 @@ -186,5 +185,4 @@ class UserDeviceTest < ActiveSupport::TestCase end - end