From fd613c00e9ea58489fad154d63a38290db807eab Mon Sep 17 00:00:00 2001 From: benk-gc Date: Sat, 6 Jul 2024 22:17:05 +0100 Subject: [PATCH] Fix rubocop violations. --- .rubocop.yml | 27 +++++----- Gemfile | 6 ++- Rakefile | 2 +- benchmark/seed-jobs | 2 +- benchmark/setup.rb | 2 +- bin/que | 12 ++--- lib/que.rb | 6 +-- lib/que/adapters/base.rb | 6 +-- lib/que/job.rb | 8 +-- lib/que/leaky_bucket.rb | 8 +-- lib/que/middleware/queue_collector.rb | 2 - lib/que/middleware/worker_collector.rb | 6 +-- lib/que/migrations.rb | 2 - lib/que/version.rb | 2 +- lib/que/worker.rb | 6 +-- que.gemspec | 5 +- spec/integration/integration_spec.rb | 2 + spec/lib/que/job_spec.rb | 11 +++-- spec/lib/que/leaky_bucket_spec.rb | 28 ++++++----- spec/lib/que/locker_spec.rb | 6 ++- .../que/middleware/queue_collector_spec.rb | 15 +++--- spec/lib/que/worker_spec.rb | 49 ++++++++++--------- spec/spec_helper.rb | 14 +++--- 23 files changed, 121 insertions(+), 106 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 0218d00f..1758b328 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,26 +1,27 @@ inherit_gem: gc_ruboconfig: rubocop.yml -AllCops: - Exclude: [legacy_spec/**/*] +require: + - rubocop-performance + - rubocop-rake + - rubocop-rspec + - rubocop-sequel -Metrics/MethodLength: - Max: 20 +AllCops: + NewCops: enable + Exclude: + - "vendor/**/*" + - "legacy_spec/**/*" + - "lib/generators/que/templates/*.rb" RSpec/MultipleExpectations: Enabled: false -RSpec/NestedGroups: - Max: 5 - -RSpec/NamedSubject: - Enabled: false - RSpec/ExampleLength: Enabled: false -RSpec/DescribeClass: +RSpec/IndexedLet: Enabled: false -Metrics/CyclomaticComplexity: - Max: 10 +RSpec/NestedGroups: + Max: 5 diff --git a/Gemfile b/Gemfile index cba95989..07119106 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,11 @@ group :development, :test do gem 'pg', require: nil, platform: :ruby gem 'pg_jruby', require: nil, platform: :jruby gem 'pond', require: nil - gem 'rubocop' + gem 'rubocop', '~> 1.6' + gem 'rubocop-performance', '~> 1.2' + gem 'rubocop-rake', '~> 0.6' + gem 'rubocop-rspec', '~> 3.0' + gem 'rubocop-sequel', '~> 0.3' gem 'sequel', require: nil end diff --git a/Rakefile b/Rakefile index 1c789a83..b37d574f 100644 --- a/Rakefile +++ b/Rakefile @@ -2,4 +2,4 @@ require "bundler/gem_tasks" -Dir["./tasks/*.rb"].sort.each { |f| require f } +Dir["./tasks/*.rb"].each { |f| require f } diff --git a/benchmark/seed-jobs b/benchmark/seed-jobs index df0570ca..b745016b 100755 --- a/benchmark/seed-jobs +++ b/benchmark/seed-jobs @@ -19,7 +19,7 @@ unless ARGV.count == 3 end def parse_range(token) - [*Range.new(*token.split("..").map(&:to_i))] + Array(Range.new(*token.split("..").map(&:to_i))) rescue StandardError [token.to_i] end diff --git a/benchmark/setup.rb b/benchmark/setup.rb index bd257ce9..92f8be05 100755 --- a/benchmark/setup.rb +++ b/benchmark/setup.rb @@ -9,7 +9,7 @@ Que.connection = ActiveRecord Que.migrate! -Que.logger = Logger.new(STDOUT) +Que.logger = Logger.new($stdout) Que.logger.formatter = proc do |severity, datetime, _progname, payload| { ts: datetime, tid: Thread.current.object_id, level: severity }. merge(payload).to_json + "\n" diff --git a/bin/que b/bin/que index dab30326..ec9ff682 100755 --- a/bin/que +++ b/bin/que @@ -13,7 +13,7 @@ $stdout.sync = true options = OpenStruct.new -# rubocop:disable Metrics/LineLength +# rubocop:disable Layout/LineLength OptionParser.new do |opts| opts.banner = "usage: que [options] file/to/require ..." @@ -59,7 +59,7 @@ OptionParser.new do |opts| opts.on("-v", "--version", "Show Que version") do require "que" - $stdout.puts "Que version #{Que::Version}" + $stdout.puts "Que version #{Que::VERSION}" exit 0 end @@ -68,9 +68,9 @@ OptionParser.new do |opts| exit 0 end end.parse!(ARGV) -# rubocop:enable Metrics/LineLength +# rubocop:enable Layout/LineLength -if ARGV.length.zero? +if ARGV.empty? $stdout.puts <<~OUTPUT You didn't include any Ruby files to require! Que needs to be able to load your application before it can process jobs. @@ -92,9 +92,9 @@ wake_interval = options.wake_interval || ENV["QUE_WAKE_INTERVAL"]&.to_f || Qu cursor_expiry = options.cursor_expiry || wake_interval worker_count = options.worker_count || 1 timeout = options.timeout -secondary_queues = options.secondary_queues || [] +secondary_queues = options.secondary_queues || [] -Que.logger ||= Logger.new(STDOUT) +Que.logger ||= Logger.new($stdout) begin Que.logger.level = Logger.const_get(log_level.upcase) if log_level diff --git a/lib/que.rb b/lib/que.rb index 08855159..fbc935e3 100644 --- a/lib/que.rb +++ b/lib/que.rb @@ -42,7 +42,7 @@ module Que SYMBOLIZER = proc do |object| case object when Hash - object.keys.each do |key| + object.each_key do |key| object[key.to_sym] = SYMBOLIZER.call(object.delete(key)) end object @@ -145,11 +145,11 @@ def transaction begin execute "BEGIN" yield - rescue StandardError => error + rescue StandardError => e raise ensure # Handle a raised error or a killed thread. - if error || Thread.current.status == "aborting" + if e || Thread.current.status == "aborting" execute "ROLLBACK" else execute "COMMIT" diff --git a/lib/que/adapters/base.rb b/lib/que/adapters/base.rb index edf0b92d..669e9d90 100644 --- a/lib/que/adapters/base.rb +++ b/lib/que/adapters/base.rb @@ -82,7 +82,7 @@ def execute_prepared(name, params) end conn.exec_prepared("que_#{name}", params) - rescue ::PG::InvalidSqlStatementName => error + rescue ::PG::InvalidSqlStatementName => e # Reconnections on ActiveRecord can cause the same connection # objects to refer to new backends, so recover as well as we can. @@ -92,7 +92,7 @@ def execute_prepared(name, params) retry end - raise error + raise e end end end @@ -102,7 +102,7 @@ def execute_prepared(name, params) 16 => ->(value) { case value when String then value == "t" - else !!value + else !value.nil? end }, # bigint diff --git a/lib/que/job.rb b/lib/que/job.rb index 31a4d246..6d0074bc 100644 --- a/lib/que/job.rb +++ b/lib/que/job.rb @@ -84,15 +84,17 @@ def self.custom_log_context(custom_proc) if custom_proc.is_a?(Proc) self.log_context_proc = custom_proc else - raise ArgumentError.new "Custom log context must be a Proc " \ - "which receives the job as an argument and " \ - "returns a hash" + raise ArgumentError, "Custom log context must be a Proc " \ + "which receives the job as an argument and " \ + "returns a hash" end end + # rubocop:disable Naming/AccessorMethodName def get_custom_log_context self.class.log_context_proc&.call(@attrs) || {} end + # rubocop:enable Naming/AccessorMethodName # This is accepting JOB_OPTIONS and args as keyword parameters. In future we want to # set instance variables instead of using a grab bag of parameters, which would allow diff --git a/lib/que/leaky_bucket.rb b/lib/que/leaky_bucket.rb index f724b502..c226d0f2 100644 --- a/lib/que/leaky_bucket.rb +++ b/lib/que/leaky_bucket.rb @@ -56,11 +56,11 @@ def refill private - def catch_error(&block) - result = block.call + def catch_error + result = yield [result, nil] - rescue StandardError => err - [result, err] + rescue StandardError => e + [result, e] end end end diff --git a/lib/que/middleware/queue_collector.rb b/lib/que/middleware/queue_collector.rb index 501c436b..42e69999 100644 --- a/lib/que/middleware/queue_collector.rb +++ b/lib/que/middleware/queue_collector.rb @@ -41,7 +41,6 @@ def initialize(app, options = {}) end end - # rubocop:disable Metrics/AbcSize def call(env) # Reset all the previously observed values back to zero, ensuring we only ever # report metric values that are current in every scrape. @@ -72,7 +71,6 @@ def call(env) @app.call(env) end - # rubocop:enable Metrics/AbcSize def refresh_materialized_view # Ensure generating metrics never take more than 5000ms to execute. If we can't diff --git a/lib/que/middleware/worker_collector.rb b/lib/que/middleware/worker_collector.rb index dc6ea1f7..9d498b9e 100644 --- a/lib/que/middleware/worker_collector.rb +++ b/lib/que/middleware/worker_collector.rb @@ -28,8 +28,7 @@ def call(env) private - # rubocop:disable Lint/HandleExceptions - # rubocop:disable Style/RedundantBegin + # rubocop:disable Style/RedundantBegin, Lint/SuppressedException def register(*metrics) begin metrics.each do |metric| @@ -38,8 +37,7 @@ def register(*metrics) rescue Prometheus::Client::Registry::AlreadyRegisteredError end end - # rubocop:enable Style/RedundantBegin - # rubocop:enable Lint/HandleExceptions + # rubocop:enable Style/RedundantBegin, Lint/SuppressedException end end end diff --git a/lib/que/migrations.rb b/lib/que/migrations.rb index aaebde83..2bbdc305 100644 --- a/lib/que/migrations.rb +++ b/lib/que/migrations.rb @@ -8,7 +8,6 @@ module Migrations CURRENT_VERSION = 6 class << self - # rubocop:disable Metrics/AbcSize def migrate!(options = { version: CURRENT_VERSION }) Que.transaction do version = options[:version] @@ -32,7 +31,6 @@ def migrate!(options = { version: CURRENT_VERSION }) self.db_version = version end end - # rubocop:enable Metrics/AbcSize def db_version result = Que.execute <<-SQL diff --git a/lib/que/version.rb b/lib/que/version.rb index edaf61be..3fce4118 100644 --- a/lib/que/version.rb +++ b/lib/que/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Que - Version = "1.0.0" + VERSION = "1.0.0" end diff --git a/lib/que/worker.rb b/lib/que/worker.rb index a511e0e6..2f644ecf 100644 --- a/lib/que/worker.rb +++ b/lib/que/worker.rb @@ -145,7 +145,7 @@ def work_loop @tracer.trace(RunningSecondsTotal, queue: @queue, primary_queue: @queue) do loop do - case event = work + case work when :postgres_error Que.logger&.info(event: "que.postgres_error", wake_interval: @wake_interval) @tracer.trace(SleepingSecondsTotal, queue: @queue, primary_queue: @queue) do @@ -252,7 +252,7 @@ def work # For compatibility with que-failure, we need to allow failure handlers to be # defined on the job class. - if klass&.respond_to?(:handle_job_failure) + if klass.respond_to?(:handle_job_failure) klass.handle_job_failure(e, job) else handle_job_failure(e, job) @@ -302,7 +302,7 @@ def class_for(string) end def actual_job_class_name(class_name, args) - return args.first["job_class"] if /ActiveJob::QueueAdapters/.match?(class_name) + return args.first["job_class"] if class_name.include?("ActiveJob::QueueAdapters") class_name end diff --git a/que.gemspec b/que.gemspec index 5957d64a..1126f8da 100644 --- a/que.gemspec +++ b/que.gemspec @@ -6,7 +6,7 @@ require "que/version" Gem::Specification.new do |spec| spec.name = "que" - spec.version = Que::Version + spec.version = Que::VERSION spec.authors = ["Chris Hanks"] spec.email = ["christopher.m.hanks@gmail.com"] spec.description = @@ -15,9 +15,9 @@ Gem::Specification.new do |spec| spec.homepage = "https://github.com/chanks/que" spec.license = "MIT" + spec.required_ruby_version = ">= 3.0" spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR) spec.executables = ["que"] - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] # We're pointing to our own branch of the Prometheus Client. @@ -31,4 +31,5 @@ Gem::Specification.new do |spec| spec.add_dependency "webrick", "~> 1.7" spec.add_runtime_dependency "activesupport" + spec.metadata["rubygems_mfa_required"] = "true" end diff --git a/spec/integration/integration_spec.rb b/spec/integration/integration_spec.rb index 635f7cd6..ffa67a86 100644 --- a/spec/integration/integration_spec.rb +++ b/spec/integration/integration_spec.rb @@ -3,6 +3,7 @@ require "spec_helper" require "que/worker" # required to prevent autoload races +# rubocop:disable RSpec/DescribeClass RSpec.describe "multiple workers" do def with_workers(num, stop_timeout: 5, secondary_queues: [], &block) Que::WorkerGroup.start( @@ -150,3 +151,4 @@ def wait_for_jobs_to_be_worked(timeout: 10) end end end +# rubocop:enable RSpec/DescribeClass diff --git a/spec/lib/que/job_spec.rb b/spec/lib/que/job_spec.rb index 09a71127..33b4f271 100644 --- a/spec/lib/que/job_spec.rb +++ b/spec/lib/que/job_spec.rb @@ -56,7 +56,7 @@ custom_log_2: "test-log", } } - job_class.enqueue(500, :gbp, :testing, run_at: run_at) + job_class.enqueue(500, :gbp, :testing, run_at: run_at) end context "with a custom adapter specified" do @@ -97,10 +97,11 @@ (1..fake_args.keys.count). flat_map { |n| fake_args.keys.combination(n).to_a }.each do |arg_keys| context "with #{arg_keys.inspect}" do - let(:args) { Hash[arg_keys.zip(fake_args.values_at(*arg_keys))] } + let(:job_args) { { a_real_arg: true } } + let(:args) { arg_keys.zip(fake_args.values_at(*arg_keys)).to_h } it "handles them properly" do - described_class.enqueue(1, true, "foo", **{ a_real_arg: true }.merge(args)) + described_class.enqueue(1, true, "foo", **job_args.merge(args)) job = QueJob.last arg_keys.each do |key| @@ -131,7 +132,7 @@ describe ".adapter" do context "with an adapter specified" do - let(:custom_adapter) { double(Que::Adapters::Base) } + let(:custom_adapter) { instance_double(Que::Adapters::Base) } let(:job_with_adapter) { Class.new(described_class) } it "uses the correct adapter" do @@ -211,7 +212,7 @@ end it "returns a hash of keys constructed from the job attrs" do - job_class.custom_log_context -> (attrs) { + job_class.custom_log_context ->(attrs) { { first_argument: attrs[:args][0], second_argument: attrs[:args][1], diff --git a/spec/lib/que/leaky_bucket_spec.rb b/spec/lib/que/leaky_bucket_spec.rb index f48dddd9..b64761e9 100644 --- a/spec/lib/que/leaky_bucket_spec.rb +++ b/spec/lib/que/leaky_bucket_spec.rb @@ -7,23 +7,25 @@ let(:window) { 5.0 } let(:budget) { 1.0 } - let(:clock) { FakeClock.new } + let(:clock) { fake_clock.new } # Provide a test clock interface, allowing the observations and sleeps made by the # bucket to advance test time. - FakeClock = Class.new do - def initialize - @now = 0.0 - end + let(:fake_clock) do + Class.new do + def initialize + @now = 0.0 + end - attr_reader :now + attr_reader :now - def sleep(duration) - @now += duration - end + def sleep(duration) + @now += duration + end - def advance(duration) - @now += duration + def advance(duration) + @now += duration + end end end @@ -38,8 +40,8 @@ def measure_total_work(clock, bucket, runtime:, work_duration: 0.05, error: fals total_work += duration raise StandardError, "throwing" if error end - rescue StandardError => err - fail(err) unless error + rescue StandardError => e + raise(e) unless error end end diff --git a/spec/lib/que/locker_spec.rb b/spec/lib/que/locker_spec.rb index 47f0db26..610c25db 100644 --- a/spec/lib/que/locker_spec.rb +++ b/spec/lib/que/locker_spec.rb @@ -95,13 +95,15 @@ def expect_to_lock_with(cursor:) let(:cursor_expiry) { 5 } before do - # we need this to avoid flakiness during resetting the cursor. + # we need this to avoid flakiness during resetting the cursor. # Cursors are reset in the beginning when the locker class object is created. # It is reset in handle_expired_cursors! method. Sometimes the execution is fast enough that # the condition to reset is not met because the Process.clock_gettime remains same(monotonic_now method). - locker.instance_variable_get(:@queue_expires_at)[queue] = Process.clock_gettime(Process::CLOCK_MONOTONIC) + cursor_expiry + locker.instance_variable_get(:@queue_expires_at)[queue] = + Process.clock_gettime(Process::CLOCK_MONOTONIC) + cursor_expiry allow(locker).to receive(:monotonic_now) { @epoch } end + # This test simulates the repeated locking of jobs. We're trying to prove that # the locker will use the previous jobs ID as a cursor until the expiry has # elapsed, after which we'll reset. diff --git a/spec/lib/que/middleware/queue_collector_spec.rb b/spec/lib/que/middleware/queue_collector_spec.rb index ac42c902..e9022cb1 100644 --- a/spec/lib/que/middleware/queue_collector_spec.rb +++ b/spec/lib/que/middleware/queue_collector_spec.rb @@ -3,8 +3,9 @@ require "spec_helper" RSpec.describe Que::Middleware::QueueCollector do - subject(:collector) { described_class.new(->(_env) { nil }, options) } - let(:options) { {refresh_interval: 0.1.second} } + subject(:collector) { described_class.new(->(_env) {}, options) } + + let(:options) { { refresh_interval: 0.1.second } } let(:now) { postgres_now } let(:due_now_delay) { 1000.0 } let(:due_later_than_now_delay) { due_now_delay / 2 } @@ -77,15 +78,15 @@ end end - context "when creating a collector" do - let(:registry) { double(Prometheus::Client::Registry) } - let(:options) do + context "when creating a collector" do + let(:registry) { instance_double(Prometheus::Client::Registry) } + let(:options) do { - registry: registry + registry: registry, } end - it "will register metrics" do + it "will register metrics" do expect(registry).to receive(:register).with(described_class::Queued) expect(registry).to receive(:register).with(described_class::QueuedPastDue) diff --git a/spec/lib/que/worker_spec.rb b/spec/lib/que/worker_spec.rb index 7cb7985e..400ec0f9 100644 --- a/spec/lib/que/worker_spec.rb +++ b/spec/lib/que/worker_spec.rb @@ -4,22 +4,22 @@ RSpec.describe Que::Worker do describe ".work" do - subject { described_class.new.work } + subject(:work) { described_class.new.work } it "returns job_not_found if there's no job to work" do - expect(subject).to eq(:job_not_found) + expect(work).to eq(:job_not_found) end context "when there's a job to work" do let!(:job) { FakeJob.enqueue(1) } it "works the job" do - expect(subject).to eq(:job_worked) + expect(work).to eq(:job_worked) expect(FakeJob.log).to eq([1]) expect(QueJob.count).to eq(0) end - xit "logs the work without custom log context" do + it "logs the work without custom log context" do expect(Que.logger).to receive(:info). with(hash_including( event: "que_job.job_begin", @@ -31,7 +31,7 @@ queue: "default", primary_queue: "default", que_job_id: job.attrs["job_id"], - latency: an_instance_of(Float), + latency: an_instance_of(BigDecimal), )) expect(Que.logger).to receive(:info). @@ -47,12 +47,12 @@ primary_queue: "default", que_job_id: job.attrs["job_id"], )) - subject + work end context "with custom log context" do let!(:job) do - class FakeJobWithCustomLogs < FakeJob + klass = Class.new(FakeJob) do custom_log_context ->(attrs) { { custom_log_1: attrs[:args][0], @@ -62,10 +62,13 @@ class FakeJobWithCustomLogs < FakeJob @log = [] end + + stub_const("FakeJobWithCustomLogs", klass) + FakeJobWithCustomLogs.enqueue(1) end - xit "logs the work with custom log context" do + it "logs the work with custom log context" do expect(Que.logger).to receive(:info). with(hash_including( event: "que_job.job_begin", @@ -77,7 +80,7 @@ class FakeJobWithCustomLogs < FakeJob queue: "default", primary_queue: "default", que_job_id: job.attrs["job_id"], - latency: an_instance_of(Float), + latency: an_instance_of(BigDecimal), custom_log_1: 1, custom_log_2: "test-log", )) @@ -97,7 +100,7 @@ class FakeJobWithCustomLogs < FakeJob custom_log_1: 1, custom_log_2: "test-log", )) - subject + work end end end @@ -106,12 +109,12 @@ class FakeJobWithCustomLogs < FakeJob it "rescues it" do ExceptionalJob.enqueue(1) - expect(subject).to eq(:job_worked) + expect(work).to eq(:job_worked) end it "logs the work" do - class ExceptionalJobWithCustomLogging < ExceptionalJob - custom_log_context -> (attrs) { + klass = Class.new(ExceptionalJob) do + custom_log_context ->(attrs) { { first_arg: attrs[:args][0], } @@ -120,6 +123,8 @@ class ExceptionalJobWithCustomLogging < ExceptionalJob @log = [] end + stub_const("ExceptionalJobWithCustomLogging", klass) + ExceptionalJobWithCustomLogging.enqueue(1) expect(Que.logger).to receive(:info). @@ -128,7 +133,7 @@ class ExceptionalJobWithCustomLogging < ExceptionalJob handler: "ExceptionalJobWithCustomLogging", job_class: "ExceptionalJobWithCustomLogging", msg: "Job acquired, beginning work", - first_arg: 1 + first_arg: 1, )) expect(Que.logger).to receive(:error). @@ -138,10 +143,10 @@ class ExceptionalJobWithCustomLogging < ExceptionalJob job_class: "ExceptionalJobWithCustomLogging", msg: "Job failed with error", error: "#", - first_arg: 1 + first_arg: 1, )) - subject + work end context "and the job has a failure handler" do @@ -150,7 +155,7 @@ class ExceptionalJobWithCustomLogging < ExceptionalJob it "calls it" do job_class.enqueue(1) - expect(subject).to eq(:job_worked) + expect(work).to eq(:job_worked) expect(job_class.log.count).to eq(2) expect(job_class.log.first).to eq([:run, 1]) @@ -169,7 +174,7 @@ class ExceptionalJobWithCustomLogging < ExceptionalJob it "calls the default one" do job_class.enqueue("foo") - expect(subject).to eq(:job_worked) + expect(work).to eq(:job_worked) job = QueJob.first @@ -191,7 +196,7 @@ class ExceptionalJobWithCustomLogging < ExceptionalJob Que.adapter.execute(:insert_job, [*job_options.values_at(*Que::Job::JOB_OPTIONS), []]) - expect(subject).to eq(:job_worked) + expect(work).to eq(:job_worked) job = QueJob.first @@ -207,7 +212,7 @@ class ExceptionalJobWithCustomLogging < ExceptionalJob expect(Que). to receive(:execute).with(:lock_job, ["default", 0]).and_raise(PG::Error) - expect(subject).to eq(:postgres_error) + expect(work).to eq(:postgres_error) end end @@ -218,7 +223,7 @@ class ExceptionalJobWithCustomLogging < ExceptionalJob expect(Que). to receive(:execute).with(:lock_job, ["default", 0]). and_raise(ActiveRecord::ConnectionTimeoutError) - expect(subject).to eq(:postgres_error) + expect(work).to eq(:postgres_error) end end @@ -229,7 +234,7 @@ class ExceptionalJobWithCustomLogging < ExceptionalJob expect(Que). to receive(:execute).with(:lock_job, ["default", 0]). and_raise(ActiveRecord::ConnectionNotEstablished) - expect(subject).to eq(:postgres_error) + expect(work).to eq(:postgres_error) end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 62222a1d..3e45ff11 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,13 +6,13 @@ require "rspec" require "active_record" -require_relative "./helpers/create_user" -require_relative "./helpers/exceptional_job" -require_relative "./helpers/fake_job" -require_relative "./helpers/que_job" -require_relative "./helpers/sleep_job" -require_relative "./helpers/interruptible_sleep_job" -require_relative "./helpers/user" +require_relative "helpers/create_user" +require_relative "helpers/exceptional_job" +require_relative "helpers/fake_job" +require_relative "helpers/que_job" +require_relative "helpers/sleep_job" +require_relative "helpers/interruptible_sleep_job" +require_relative "helpers/user" def postgres_now ActiveRecord::Base.connection.execute("SELECT NOW();")[0]["now"]