From fe1f4b2ad56f010a4e9b93d547d63a15953d9dc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Sat, 29 Oct 2016 01:05:58 -0200 Subject: Add more rubocop rules about whitespaces --- activejob/test/cases/queue_naming_test.rb | 2 +- activejob/test/cases/queue_priority_test.rb | 2 +- activejob/test/helper.rb | 2 +- activejob/test/models/person.rb | 2 +- activejob/test/support/backburner/inline.rb | 2 +- activejob/test/support/delayed_job/delayed/backend/test.rb | 6 +++--- activejob/test/support/integration/adapters/que.rb | 2 +- activejob/test/support/integration/adapters/queue_classic.rb | 2 +- activejob/test/support/integration/adapters/sneakers.rb | 2 +- activejob/test/support/integration/test_case_helpers.rb | 8 ++++---- 10 files changed, 15 insertions(+), 15 deletions(-) (limited to 'activejob/test') diff --git a/activejob/test/cases/queue_naming_test.rb b/activejob/test/cases/queue_naming_test.rb index 7777e557c9..0e1e0decd1 100644 --- a/activejob/test/cases/queue_naming_test.rb +++ b/activejob/test/cases/queue_naming_test.rb @@ -56,7 +56,7 @@ class QueueNamingTest < ActiveSupport::TestCase original_queue_name = HelloJob.queue_name begin - HelloJob.queue_as { self.arguments.first=="1" ? :one : :two } + HelloJob.queue_as { self.arguments.first == "1" ? :one : :two } assert_equal "one", HelloJob.new("1").queue_name assert_equal "two", HelloJob.new("3").queue_name ensure diff --git a/activejob/test/cases/queue_priority_test.rb b/activejob/test/cases/queue_priority_test.rb index ab4a1bdf7b..ec78a402d7 100644 --- a/activejob/test/cases/queue_priority_test.rb +++ b/activejob/test/cases/queue_priority_test.rb @@ -32,7 +32,7 @@ class QueuePriorityTest < ActiveSupport::TestCase original_priority = HelloJob.priority begin - HelloJob.queue_with_priority { self.arguments.first=="1" ? 99 : 11 } + HelloJob.queue_with_priority { self.arguments.first == "1" ? 99 : 11 } assert_equal 99, HelloJob.new("1").priority assert_equal 11, HelloJob.new("3").priority ensure diff --git a/activejob/test/helper.rb b/activejob/test/helper.rb index dbc7dad109..758506b3c0 100644 --- a/activejob/test/helper.rb +++ b/activejob/test/helper.rb @@ -4,7 +4,7 @@ require "support/job_buffer" ActiveSupport.halt_callback_chains_on_return_false = false GlobalID.app = "aj" -@adapter = ENV["AJ_ADAPTER"] || "inline" +@adapter = ENV["AJ_ADAPTER"] || "inline" if ENV["AJ_INTEGRATION_TESTS"] require "support/integration/helper" diff --git a/activejob/test/models/person.rb b/activejob/test/models/person.rb index 76a8f40616..b5d68ad9c1 100644 --- a/activejob/test/models/person.rb +++ b/activejob/test/models/person.rb @@ -6,7 +6,7 @@ class Person attr_reader :id def self.find(id) - raise RecordNotFound.new("Cannot find person with ID=404") if id.to_i==404 + raise RecordNotFound.new("Cannot find person with ID=404") if id.to_i == 404 new(id) end diff --git a/activejob/test/support/backburner/inline.rb b/activejob/test/support/backburner/inline.rb index 647dbf317f..9758332b6f 100644 --- a/activejob/test/support/backburner/inline.rb +++ b/activejob/test/support/backburner/inline.rb @@ -2,7 +2,7 @@ require "backburner" Backburner::Worker.class_eval do class << self; alias_method :original_enqueue, :enqueue; end - def self.enqueue(job_class, args=[], opts={}) + def self.enqueue(job_class, args = [], opts = {}) job_class.perform(*args) end end diff --git a/activejob/test/support/delayed_job/delayed/backend/test.rb b/activejob/test/support/delayed_job/delayed/backend/test.rb index a900b18e2a..98d731ff1e 100644 --- a/activejob/test/support/delayed_job/delayed/backend/test.rb +++ b/activejob/test/support/delayed_job/delayed/backend/test.rb @@ -26,7 +26,7 @@ module Delayed self.attempts = 0 self.priority = 0 self.id = (self.class.id += 1) - hash.each { |k,v| send(:"#{k}=", v) } + hash.each { |k, v| send(:"#{k}=", v) } end @jobs = [] @@ -63,7 +63,7 @@ module Delayed jobs = jobs.select { |j| Worker.queues.include?(j.queue) } if Worker.queues.any? jobs = jobs.select { |j| j.priority >= Worker.min_priority } if Worker.min_priority jobs = jobs.select { |j| j.priority <= Worker.max_priority } if Worker.max_priority - jobs.sort_by { |j| [j.priority, j.run_at] }[0..limit-1] + jobs.sort_by { |j| [j.priority, j.run_at] }[0..limit - 1] end # Lock this job for this worker. @@ -84,7 +84,7 @@ module Delayed end def update_attributes(attrs = {}) - attrs.each { |k,v| send(:"#{k}=", v) } + attrs.each { |k, v| send(:"#{k}=", v) } save end diff --git a/activejob/test/support/integration/adapters/que.rb b/activejob/test/support/integration/adapters/que.rb index 3d35a0439f..20faee3427 100644 --- a/activejob/test/support/integration/adapters/que.rb +++ b/activejob/test/support/integration/adapters/que.rb @@ -13,7 +13,7 @@ module QueJobsManager def start_workers que_url = ENV["QUE_DATABASE_URL"] || "postgres:///active_jobs_que_int_test" uri = URI.parse(que_url) - user = uri.user||ENV["USER"] + user = uri.user || ENV["USER"] pass = uri.password db = uri.path[1..-1] %x{#{"PGPASSWORD=\"#{pass}\"" if pass} psql -c 'drop database if exists "#{db}"' -U #{user} -t template1} diff --git a/activejob/test/support/integration/adapters/queue_classic.rb b/activejob/test/support/integration/adapters/queue_classic.rb index b5d831428e..369693e947 100644 --- a/activejob/test/support/integration/adapters/queue_classic.rb +++ b/activejob/test/support/integration/adapters/queue_classic.rb @@ -12,7 +12,7 @@ module QueueClassicJobsManager def start_workers uri = URI.parse(ENV["QC_DATABASE_URL"]) - user = uri.user||ENV["USER"] + user = uri.user || ENV["USER"] pass = uri.password db = uri.path[1..-1] %x{#{"PGPASSWORD=\"#{pass}\"" if pass} psql -c 'drop database if exists "#{db}"' -U #{user} -t template1} diff --git a/activejob/test/support/integration/adapters/sneakers.rb b/activejob/test/support/integration/adapters/sneakers.rb index 08743c1f05..911f70407e 100644 --- a/activejob/test/support/integration/adapters/sneakers.rb +++ b/activejob/test/support/integration/adapters/sneakers.rb @@ -39,7 +39,7 @@ module SneakersJobsManager @pid = fork do queues = %w(integration_tests) workers = queues.map do |q| - worker_klass = "ActiveJobWorker"+Digest::MD5.hexdigest(q) + worker_klass = "ActiveJobWorker" + Digest::MD5.hexdigest(q) Sneakers.const_set(worker_klass, Class.new(ActiveJob::QueueAdapters::SneakersAdapter::JobWrapper) do from_queue q end) diff --git a/activejob/test/support/integration/test_case_helpers.rb b/activejob/test/support/integration/test_case_helpers.rb index da8638895b..3357489f20 100644 --- a/activejob/test/support/integration/test_case_helpers.rb +++ b/activejob/test/support/integration/test_case_helpers.rb @@ -32,7 +32,7 @@ module TestCaseHelpers adapter_class_symbols.map(&:to_s).include? adapter end - def wait_for_jobs_to_finish_for(seconds=60) + def wait_for_jobs_to_finish_for(seconds = 60) begin Timeout.timeout(seconds) do while !job_executed do @@ -47,7 +47,7 @@ module TestCaseHelpers Dummy::Application.root.join("tmp/#{id}") end - def job_executed(id=@id) + def job_executed(id = @id) job_file(id).exist? end @@ -55,11 +55,11 @@ module TestCaseHelpers Marshal.load(File.binread(job_file(id))) end - def job_executed_at(id=@id) + def job_executed_at(id = @id) job_data(id)["executed_at"] end - def job_executed_in_locale(id=@id) + def job_executed_in_locale(id = @id) job_data(id)["locale"] end end -- cgit v1.2.3