repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/system/performance_spec.rb
spec/system/performance_spec.rb
# frozen_string_literal: true require 'rails_helper' describe 'Performance Page', :js do before do ActiveJob::Base.queue_adapter = GoodJob::Adapter.new(execution_mode: :external) end it 'renders index properly' do ExampleJob.perform_later GoodJob.perform_inline visit good_job.root_path cli...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/support/sleep_helper.rb
spec/support/sleep_helper.rb
# frozen_string_literal: true module SleepHelper TooSlowError = Class.new(StandardError) def wait_until(max: 5.seconds, increments_of: 0.1.seconds, &block) start_time = Time.current loop do failed = false begin GoodJob::BaseRecord.uncached(&block) rescue RSpec::Expectations::Ex...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/support/pre_documentation_formatter.rb
spec/support/pre_documentation_formatter.rb
# frozen_string_literal: true RSpec::Support.require_rspec_core "formatters/base_text_formatter" RSpec::Support.require_rspec_core "formatters/console_codes" class PreDocumentationFormatter < RSpec::Core::Formatters::BaseTextFormatter RSpec::Core::Formatters.register self, :example_started, :example_group_started, ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/support/example_app_helper.rb
spec/support/example_app_helper.rb
# frozen_string_literal: true require 'fileutils' module ExampleAppHelper def setup_example_app FileUtils.rm_rf(example_app_path) # Rails will not install within a directory containing `bin/rails` Rails.root.join("../bin/rails").rename(Rails.root.join("../bin/_rails")) if Rails.root.join("../bin/rails"...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/support/logger.rb
spec/support/logger.rb
# frozen_string_literal: true RSpec.configure do |config| config.around do |example| Rails.logger.debug { "\n\n---- START EXAMPLE: #{example.full_description} (#{example.location})" } Thread.current.name = "RSpec: #{example.description}" example.run Rails.logger.debug { "---- END EXAMPLE: #{example.f...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/support/shell_out.rb
spec/support/shell_out.rb
# frozen_string_literal: true require 'open3' class ShellOut WaitTimeout = Class.new(StandardError) KILL_TIMEOUT = 5 PROCESS_EXIT = "[PROCESS EXIT]" def self.command(command, env: {}, &block) new.command(command, env: env, &block) end attr_reader :output def initialize @output = Concurrent::A...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/support/timecop.rb
spec/support/timecop.rb
# frozen_string_literal: true RSpec.configure do |config| config.after do Timecop.return end end
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/support/jruby.rb
spec/support/jruby.rb
# frozen_string_literal: true RSpec.configure do |c| if RUBY_PLATFORM.include?('java') puts "Excluding System Tests in JRuby" c.filter_run_excluding type: :system c.filter_run_excluding :skip_if_java end end # https://stackoverflow.com/a/63442278 RSPEC_MUTEX = Mutex.new RSpec::Core::Example.prepend(Mo...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/support/postgres_notices.rb
spec/support/postgres_notices.rb
# frozen_string_literal: true # # Raise an exception when Postgres writes a notice to $stderr # POSTGRES_NOTICES = Concurrent::Array.new ActiveSupport.on_load :active_record do ActiveRecord::ConnectionAdapters::AbstractAdapter.set_callback :checkout, :before, lambda { |conn| raw_connection = conn.raw_connection...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/support/database_cleaner.rb
spec/support/database_cleaner.rb
# frozen_string_literal: true RSpec.configure do |config| # Disabled because this causes the same database connection to be reused across threads # which causes Advisory Locks to not be effective because they are locked per-connection/per-thread. config.use_transactional_fixtures = false config.before(:suite)...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/support/uuid.rb
spec/support/uuid.rb
# frozen_string_literal: true RSpec::Matchers.define :be_a_uuid do match do |actual| regexp = /\A\h{8}-\h{4}-(\h{4})-\h{4}-\h{12}\z/ actual.is_a?(String) && actual.match?(regexp) end description { "a UUID" } failure_message { "expected #{description}" } failure_message_when_negated { "did not expect...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/support/reset_good_job.rb
spec/support/reset_good_job.rb
# frozen_string_literal: true THREAD_ERRORS = Concurrent::Array.new ActiveSupport.on_load :active_record do ActiveRecord::ConnectionAdapters::AbstractAdapter.set_callback :checkout, :after, lambda { thread_name = Thread.current.name || Thread.current.object_id sql = "SET application_name = #{quote(thread_na...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/support/reset_rails_queue_adapter.rb
spec/support/reset_rails_queue_adapter.rb
# frozen_string_literal: true # https://github.com/rails/rails/issues/37270 # Avoid overriding TestQueueAdapter altogether module ActiveJob module TestHelper # Avoid calling #descendants because JRuby has trouble with it # https://github.com/jruby/jruby/issues/6896 silence_redefinition_of_method :queue_a...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/support/sql_helper.rb
spec/support/sql_helper.rb
# frozen_string_literal: true module SqlHelper def normalize_sql(sql) sql.gsub(/\s/, ' ').gsub(/([()])/, ' \1 ').squish end end RSpec.configure { |c| c.include SqlHelper }
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/support/thread_helper.rb
spec/support/thread_helper.rb
# frozen_string_literal: true module ThreadHelper def rails_promise(*args) wrapped_task = proc do |*proc_args| Rails.application.executor.wrap { yield(*proc_args) } end Concurrent::Promises.future(*args, &wrapped_task) end end RSpec.configure { |c| c.include ThreadHelper }
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/support/rspec_not_change.rb
spec/support/rspec_not_change.rb
# frozen_string_literal: true RSpec::Matchers.define_negated_matcher :not_change, :change
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/support/system.rb
spec/support/system.rb
# frozen_string_literal: true require "capybara/cuprite" Capybara.default_max_wait_time = 5 Capybara.disable_animation = true Capybara.server = :puma, { Silent: true } module SystemTestHelpers def js_driver? Capybara.current_driver != :rack_test end def wait_for_turbo_load return unless js_driver? ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/support/output_helper.rb
spec/support/output_helper.rb
# frozen_string_literal: true module OutputHelper def quiet(&block) if ENV['LOUD'].present? yield else expect(&block).to output(/.*/).to_stderr_from_any_process.and output(/.*/).to_stdout_from_any_process end end end RSpec.configure { |c| c.include OutputHelper }
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/support/rails_executor.rb
spec/support/rails_executor.rb
# frozen_string_literal: true # Wraps each example in a Rails Executor # This more closely matches the behavior of Rails Minitest helpers: # # https://github.com/rails/rails/pull/43550 # # This also avoids the issue of Active Job wrapping ActiveJob::Base#execute # with its own Reloader, which causes database connectio...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/integration/jobs_spec.rb
spec/integration/jobs_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Complex Jobs' do let(:capsule) { GoodJob::Capsule.new } let(:inline_adapter) { GoodJob::Adapter.new(execution_mode: :inline, _capsule: capsule) } let(:async_adapter) { GoodJob::Adapter.new(execution_mode: :async_all, _capsule: capsule) } be...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/integration/process_locks_spec.rb
spec/integration/process_locks_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Process Locks' do let(:capsule) { GoodJob::Capsule.new } let(:inline_adapter) { GoodJob::Adapter.new(execution_mode: :inline, _capsule: capsule) } let(:async_adapter) { GoodJob::Adapter.new(execution_mode: :async, _capsule: capsule) } befor...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/integration/scheduler_spec.rb
spec/integration/scheduler_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Schedule Integration' do let(:adapter) { GoodJob::Adapter.new(execution_mode: :external) } before do ActiveJob::Base.queue_adapter = adapter GoodJob.preserve_job_records = true stub_const "RUN_JOBS", Concurrent::Array.new stub_...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/integration/server_spec.rb
spec/integration/server_spec.rb
# frozen_string_literal: true require 'rails_helper' require 'uri' require 'net/http' RSpec.describe 'Server modes', :skip_if_java do let(:port) { 3009 } let(:pidfile) { Rails.root.join('tmp/pids/test_server.pid') } context 'when development async' do it 'successfully runs in the server' do env = { ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/integration/capsule_spec.rb
spec/integration/capsule_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Capsule' do it 'hands off and executes in a different capsule as if it was a separate process' do total_jobs = 250 stub_const "LATCH", Concurrent::CountDownLatch.new(total_jobs) stub_const "TestJob", (Class.new(ActiveJob::Base) do ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/integration/batch_spec.rb
spec/integration/batch_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Batches' do let(:adapter) { GoodJob::Adapter.new(execution_mode: :external) } before do ActiveJob::Base.queue_adapter = adapter GoodJob.preserve_job_records = true stub_const 'ExpectedError', Class.new(StandardError) stub_const...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/integration/adapter_spec.rb
spec/integration/adapter_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Adapter Integration' do let(:adapter) { GoodJob::Adapter.new(execution_mode: :external) } around do |example| original_adapter = ActiveJob::Base.queue_adapter ActiveJob::Base.queue_adapter = adapter example.run ActiveJob::Base.q...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/app/charts/good_job/scheduled_by_queue_chart_spec.rb
spec/app/charts/good_job/scheduled_by_queue_chart_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe GoodJob::ScheduledByQueueChart do subject(:chart) { described_class.new(GoodJob::JobsFilter.new({})) } describe "#data" do it "returns a hash of chart configuration and data" do expect(chart.data).to be_a(Hash) end end end
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/app/jobs/example_job_spec.rb
spec/app/jobs/example_job_spec.rb
# frozen_string_literal: true require 'rails_helper' describe ExampleJob do before do allow(GoodJob).to receive(:preserve_job_records).and_return(true) ActiveJob::Base.queue_adapter = GoodJob::Adapter.new(execution_mode: :inline) end describe "#perform" do describe "SUCCESS_TYPE" do it 'compl...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/app/controllers/good_job/pauses_controller_spec.rb
spec/app/controllers/good_job/pauses_controller_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe GoodJob::PausesController, type: :controller do render_views # seems required for Rails HEAD before do @routes = GoodJob::Engine.routes ActiveJob::Base.queue_adapter = GoodJob::Adapter.new(execution_mode: :external) end describe '#i...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/app/controllers/good_job/application_controller_spec.rb
spec/app/controllers/good_job/application_controller_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe GoodJob::ApplicationController, type: :controller do render_views # seems required for Rails HEAD controller do def index render plain: "OK" end end describe "#current_locale" do it "defers to GET queries of params (to all...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/app/controllers/good_job/performance_controller_spec.rb
spec/app/controllers/good_job/performance_controller_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe GoodJob::PerformanceController, type: :controller do render_views # seems required for Rails HEAD before do @routes = GoodJob::Engine.routes ActiveJob::Base.queue_adapter = GoodJob::Adapter.new(execution_mode: :external) ExampleJob.p...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/app/models/concerns/good_job/advisory_lockable_spec.rb
spec/app/models/concerns/good_job/advisory_lockable_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe GoodJob::AdvisoryLockable do before do stub_const "TestRecord", (Class.new(GoodJob::BaseRecord) do include GoodJob::AdvisoryLockable self.table_name = "good_jobs" self.advisory_lockable_column = "active_job_id" end) end...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/app/models/concerns/good_job/filterable_spec.rb
spec/app/models/concerns/good_job/filterable_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe GoodJob::Filterable do let(:model_class) { GoodJob::Job } let!(:job) do model_class.create!( active_job_id: SecureRandom.uuid, queue_name: "default", job_class: "ExampleJob", scheduled_at: Time.current, serialize...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/app/models/good_job/cron_entry_spec.rb
spec/app/models/good_job/cron_entry_spec.rb
# frozen_string_literal: true require 'rails_helper' describe GoodJob::CronEntry do subject(:entry) { described_class.new(params) } let(:params) do { key: 'test', cron: "* * * * *", class: "TestJob", args: [42], kwargs: { name: "Alice" }, set: { queue: 'test_queue' }, ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/app/models/good_job/batch_record_spec.rb
spec/app/models/good_job/batch_record_spec.rb
# frozen_string_literal: true require 'rails_helper' describe GoodJob::BatchRecord do before do stub_const 'TestJob', Class.new(ActiveJob::Base) TestJob.queue_adapter = GoodJob::Adapter.new(execution_mode: :external) end describe '#to_batch' do it 'returns a GoodJob::Batch' do record = descri...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/app/models/good_job/setting_spec.rb
spec/app/models/good_job/setting_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe GoodJob::Setting do describe 'implicit sort order' do it 'is by created_at' do first_job = described_class.create(id: '67160140-1bec-4c3b-bc34-1a8b36f87b21') described_class.create(id: '3732d706-fd5a-4c39-b1a5-a9bc6d265811') l...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/app/models/good_job/job_spec.rb
spec/app/models/good_job/job_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe GoodJob::Job do let(:active_job_id) { SecureRandom.uuid } let(:job) do described_class.create!( id: active_job_id, active_job_id: active_job_id, scheduled_at: 10.minutes.from_now, queue_name: 'mice', priority: 1...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
true
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/app/models/good_job/batch_spec.rb
spec/app/models/good_job/batch_spec.rb
# frozen_string_literal: true require 'rails_helper' describe GoodJob::Batch do before do ActiveJob::Base.queue_adapter = GoodJob::Adapter.new(execution_mode: :external) stub_const 'TestJob', (Class.new(ActiveJob::Base) do def perform end end) stub_const 'CallbackJob', (Class.new(ActiveJ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/app/models/good_job/process_spec.rb
spec/app/models/good_job/process_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe GoodJob::Process do describe 'Scopes' do describe '.active' do it 'returns active processes' do expect(described_class.active.count).to eq 0 end end describe '.inactive' do it 'returns inactive processes' do ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/app/filters/good_job/jobs_filter_spec.rb
spec/app/filters/good_job/jobs_filter_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe GoodJob::JobsFilter do subject(:filter) { described_class.new(params) } let(:params) { {} } before do allow(GoodJob).to receive_messages(retry_on_unhandled_error: false, preserve_job_records: true) ActiveJob::Base.queue_adapter = Goo...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/requests/good_job/jobs_controller_spec.rb
spec/requests/good_job/jobs_controller_spec.rb
# frozen_string_literal: true require 'rails_helper' describe GoodJob::JobsController do around do |example| orig_value = ActionController::Base.allow_forgery_protection ActionController::Base.allow_forgery_protection = false example.run ActionController::Base.allow_forgery_protection = orig_value ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/requests/good_job/frontends_controller_spec.rb
spec/requests/good_job/frontends_controller_spec.rb
# frozen_string_literal: true require 'rails_helper' describe GoodJob::FrontendsController do describe '#static' do it 'returns a file when it matches' do get good_job.frontend_static_path(:bootstrap, format: :js, locale: nil) expect(response).to have_http_status(:ok) get good_job.frontend_st...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/requests/good_job/cron_entries_controller_spec.rb
spec/requests/good_job/cron_entries_controller_spec.rb
# frozen_string_literal: true require 'rails_helper' describe GoodJob::CronEntriesController do around do |example| orig_value = ActionController::Base.allow_forgery_protection ActionController::Base.allow_forgery_protection = false example.call ActionController::Base.allow_forgery_protection = orig...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/requests/good_job/metrics_controller_spec.rb
spec/requests/good_job/metrics_controller_spec.rb
# frozen_string_literal: true require 'rails_helper' describe GoodJob::MetricsController do describe 'GET #primary_nav' do it 'returns the primary navigation metrics' do get good_job.metrics_primary_nav_path expect(response).to have_http_status(:ok) expect(response.body).to eq( { ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/generators/good_job/update_generator_spec.rb
spec/generators/good_job/update_generator_spec.rb
# frozen_string_literal: true require 'rails_helper' require 'generators/good_job/update_generator' describe GoodJob::UpdateGenerator, :skip_if_java, type: :generator do context 'when running the generator alone' do # Migrations are caught up and removed every major release of GoodJob let(:migration_templat...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/generators/good_job/install_generator_spec.rb
spec/generators/good_job/install_generator_spec.rb
# frozen_string_literal: true require 'rails_helper' require 'generators/good_job/install_generator' describe GoodJob::InstallGenerator, :skip_if_java, type: :generator do around do |example| quiet { setup_example_app } example.run teardown_example_app end it 'creates a migration for good_jobs tabl...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job_spec.rb
spec/lib/good_job_spec.rb
# frozen_string_literal: true require 'rails_helper' describe GoodJob do let(:configuration) { GoodJob::Configuration.new({ queues: 'mice:1', poll_interval: -1 }) } describe '.shutdown' do it 'shuts down all capsules' do capsule = GoodJob::Capsule.new(configuration: configuration) capsule.start ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/probe_server_spec.rb
spec/lib/good_job/probe_server_spec.rb
# frozen_string_literal: true require 'rails_helper' require 'net/http' RSpec.describe GoodJob::ProbeServer do let(:port) { 3434 } describe 'default rack app' do include Rack::Test::Methods let(:app) { described_class.default_app } it "responds to the expected routes" do get "/" # See h...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/systemd_service_spec.rb
spec/lib/good_job/systemd_service_spec.rb
# frozen_string_literal: true require 'rails_helper' # Creates a socket at a temp path that you can read from during a test. class TestSocket attr_accessor :path def initialize @socket = Socket.new(:UNIX, :DGRAM, 0) @path = nil Dir::Tmpname.create("test_socket") do |filepath| @path = filepath ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/notifier_spec.rb
spec/lib/good_job/notifier_spec.rb
# frozen_string_literal: true require 'rails_helper' require 'concurrent/executor/fixed_thread_pool' RSpec.describe GoodJob::Notifier do describe '.instances' do it 'contains all registered instances' do notifier = nil expect do notifier = described_class.new(enable_listening: true) en...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/cron_manager_spec.rb
spec/lib/good_job/cron_manager_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe GoodJob::CronManager do let(:cron_entries) { [] } describe '#start' do it 'stops the cron manager' do cron_manager = described_class.new(cron_entries, start_on_initialize: false) expect do cron_manager.start end.to ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/shared_executor_spec.rb
spec/lib/good_job/shared_executor_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe GoodJob::SharedExecutor do let(:shared_executor) { described_class.new } describe '#shutdown' do it 'takes a timeout' do shared_executor.shutdown(timeout: -1) expect(shared_executor).to be_shutdown end end describe '#res...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/thread_status_spec.rb
spec/lib/good_job/thread_status_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe GoodJob::ThreadStatus do describe ".current_thread_running?" do context "when called outside of an execution context" do it "returns true" do expect(GoodJob.current_thread_running?).to eq(true) end end end describe ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/configuration_spec.rb
spec/lib/good_job/configuration_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe GoodJob::Configuration do describe '.total_estimated_threads' do before do allow(ActiveRecord::Base.connection_pool).to receive(:size).and_return(2) end it 'counts up the total estimated threads' do expect(described_class.t...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/log_subscriber_spec.rb
spec/lib/good_job/log_subscriber_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe GoodJob::LogSubscriber do let(:subscriber) { described_class.new } around do |example| orig_loggers = described_class.loggers.dup described_class.loggers.clear described_class.reset_logger example.run described_class.logger...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/cli_spec.rb
spec/lib/good_job/cli_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe GoodJob::CLI do let(:capsule_mock) { instance_double GoodJob::Capsule, start: nil, shutdown?: false, shutdown: nil, idle?: false } before do stub_const 'GoodJob::CLI::RAILS_ENVIRONMENT_RB', File.expand_path("demo/config/environment.rb") ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/daemon_spec.rb
spec/lib/good_job/daemon_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe GoodJob::Daemon, :skip_if_java do let(:pidfile) { Rails.application.root.join('tmp/pidfile.pid') } let(:daemon) { described_class.new(pidfile: pidfile) } before do FileUtils.mkdir_p Rails.application.root.join('tmp') allow(Process).to ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/capsule_tracker_spec.rb
spec/lib/good_job/capsule_tracker_spec.rb
# frozen_string_literal: true require 'rails_helper' describe GoodJob::CapsuleTracker do let(:tracker) { described_class.new } describe '#register' do context 'when used with an advisory lock' do it 'creates a Process and sets the lock_type' do expect do tracker.register(with_advisory...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/bulk_spec.rb
spec/lib/good_job/bulk_spec.rb
# frozen_string_literal: true require 'rails_helper' describe GoodJob::Bulk do before do stub_const 'TestJob', (Class.new(ActiveJob::Base) do def perform true end end) TestJob.queue_adapter = GoodJob::Adapter.new(execution_mode: :external) end describe '.capture' do describe...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/poller_spec.rb
spec/lib/good_job/poller_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe GoodJob::Poller do describe '.instances' do it 'contains all registered instances' do poller = nil expect do poller = described_class.new end.to change { described_class.instances.size }.by(1) expect(described_c...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/cleanup_tracker_spec.rb
spec/lib/good_job/cleanup_tracker_spec.rb
# frozen_string_literal: true require 'rails_helper' describe GoodJob::CleanupTracker do describe '#new' do it 'raises an argument error when provided zero' do expect { described_class.new(cleanup_interval_seconds: 0) }.to raise_error(ArgumentError) expect { described_class.new(cleanup_interval_jobs...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/job_performer_spec.rb
spec/lib/good_job/job_performer_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe GoodJob::JobPerformer do describe '#name' do it 'displays the queues' do queue_string = 'mice, elephants' job_performer = described_class.new(queue_string) expect(job_performer.name).to eq queue_string end end describ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/scheduler_spec.rb
spec/lib/good_job/scheduler_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe GoodJob::Scheduler do let(:performer) { GoodJob::JobPerformer.new('*') } describe '#name' do it 'is human readable and contains configuration values' do scheduler = described_class.new(performer) expect(scheduler.name).to eq('Goo...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/multi_scheduler_spec.rb
spec/lib/good_job/multi_scheduler_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe GoodJob::MultiScheduler do describe '.from_configuration' do describe 'multi-scheduling' do it 'instantiates multiple schedulers' do configuration = GoodJob::Configuration.new({ queues: '*:1;mice,ferrets:2;elephant:4' }) m...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/capsule_spec.rb
spec/lib/good_job/capsule_spec.rb
# frozen_string_literal: true require 'rails_helper' describe GoodJob::Capsule do describe '#initialize' do it 'does not start' do capsule = described_class.new expect(capsule).not_to be_running end end describe '#start' do it 'creates execution objects' do capsule = described_cla...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/current_thread_spec.rb
spec/lib/good_job/current_thread_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe GoodJob::CurrentThread do after { described_class.reset } [ :cron_at, :cron_key, :error_on_discard, :error_on_retry, :error_on_retry_stopped, :execution_interrupted, :retried_job, :job, ].each do |accessor| ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/engine_spec.rb
spec/lib/good_job/engine_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe GoodJob::Engine do it 'copies over the Rails logger by default' do expect(GoodJob.logger).to eq Rails.logger end end
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/adapter_spec.rb
spec/lib/good_job/adapter_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe GoodJob::Adapter do let(:adapter) { described_class.new(execution_mode: :external) } let(:active_job) { instance_double(ActiveJob::Base) } let(:good_job) { instance_double(GoodJob::Job, queue_name: 'default', scheduled_at: nil, job_state: { que...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/probe_server/not_found_app_spec.rb
spec/lib/good_job/probe_server/not_found_app_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe GoodJob::ProbeServer::NotFoundApp do describe '#call' do it 'returns "Not Found"' do response = described_class.call("") expect(response[0]).to eq(404) end end end
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/probe_server/healthcheck_middleware_spec.rb
spec/lib/good_job/probe_server/healthcheck_middleware_spec.rb
# frozen_string_literal: true require 'rails_helper' require 'net/http' RSpec.describe GoodJob::ProbeServer::HealthcheckMiddleware do let(:app) { instance_double(Proc, call: nil) } let(:healthcheck_middleware) { described_class.new(app) } let(:port) { 3434 } describe '#call' do let(:path) { nil } let...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/job_performer/metrics_spec.rb
spec/lib/good_job/job_performer/metrics_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe GoodJob::JobPerformer::Metrics do describe '#to_h' do it 'contains the expected keys' do metrics = described_class.new expect(metrics.to_h).to eq( { empty_executions_count: 0, errored_executions_count: 0...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/active_job_extensions/notify_options_spec.rb
spec/lib/good_job/active_job_extensions/notify_options_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe GoodJob::ActiveJobExtensions::NotifyOptions do before do ActiveJob::Base.queue_adapter = GoodJob::Adapter.new(execution_mode: :external) allow(GoodJob::Notifier).to receive(:notify) stub_const 'TestJob', (Class.new(ActiveJob::Base) do...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/active_job_extensions/batches_spec.rb
spec/lib/good_job/active_job_extensions/batches_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe GoodJob::ActiveJobExtensions::Batches do before do allow(GoodJob).to receive(:retry_on_unhandled_error).and_return(false) ActiveJob::Base.queue_adapter = GoodJob::Adapter.new(execution_mode: :inline) stub_const 'RESULTS', Concurrent::A...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/active_job_extensions/labels_spec.rb
spec/lib/good_job/active_job_extensions/labels_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe GoodJob::ActiveJobExtensions::Labels do before do ActiveJob::Base.queue_adapter = GoodJob::Adapter.new(execution_mode: :external) stub_const 'TestJob', (Class.new(ActiveJob::Base) do include GoodJob::ActiveJobExtensions::Labels ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/active_job_extensions/interrupt_errors_spec.rb
spec/lib/good_job/active_job_extensions/interrupt_errors_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe GoodJob::ActiveJobExtensions::InterruptErrors do before do ActiveJob::Base.queue_adapter = GoodJob::Adapter.new(execution_mode: :external) stub_const 'TestJob', (Class.new(ActiveJob::Base) do include GoodJob::ActiveJobExtensions::Int...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/active_job_extensions/concurrency_spec.rb
spec/lib/good_job/active_job_extensions/concurrency_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe GoodJob::ActiveJobExtensions::Concurrency do before do ActiveJob::Base.queue_adapter = GoodJob::Adapter.new(execution_mode: :external) stub_const 'JOB_PERFORMED', Concurrent::AtomicBoolean.new(false) stub_const 'TestJob', (Class.new(Ac...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/good_job/adapter/inline_buffer_spec.rb
spec/lib/good_job/adapter/inline_buffer_spec.rb
# frozen_string_literal: true require 'rails_helper' describe GoodJob::Adapter::InlineBuffer do before do stub_const 'SuccessJob', (Class.new(ActiveJob::Base) do def perform true end end) SuccessJob.queue_adapter = GoodJob::Adapter.new(execution_mode: :inline) stub_const 'ErrorJ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/lib/active_job/queue_adapters/good_job_adapter_spec.rb
spec/lib/active_job/queue_adapters/good_job_adapter_spec.rb
# frozen_string_literal: true require 'rails_helper' describe ActiveJob::QueueAdapters::GoodJobAdapter do before do GoodJob.configuration.instance_variable_set(:@_in_webserver, nil) end it 'inherits from GoodJob::Adapter' do expect(described_class).to be < GoodJob::Adapter end it 'allows usage of ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/lib/good_job.rb
lib/good_job.rb
# frozen_string_literal: true require "active_job" require "active_job/queue_adapters" require_relative "good_job/version" require_relative "good_job/engine" require_relative "good_job/adapter" require_relative "good_job/adapter/inline_buffer" require_relative "active_job/queue_adapters/good_job_adapter" require_rel...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/lib/good_job/overridable_connection.rb
lib/good_job/overridable_connection.rb
# frozen_string_literal: true module GoodJob # :nodoc: # Extends an ActiveRecord odel to override the connection and use # an explicit connection that has been removed from the pool. module OverridableConnection extend ActiveSupport::Concern included do thread_cattr_accessor :_overridden_connectio...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/lib/good_job/version.rb
lib/good_job/version.rb
# frozen_string_literal: true module GoodJob # GoodJob gem version. VERSION = '4.13.1' # GoodJob version as Gem::Version object GEM_VERSION = Gem::Version.new(VERSION) end
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/lib/good_job/cron_manager.rb
lib/good_job/cron_manager.rb
# frozen_string_literal: true require "concurrent/hash" require "concurrent/scheduled_task" require "fugit" module GoodJob # :nodoc: # # CronManagers enqueue jobs on a repeating schedule. # class CronManager # @!attribute [r] instances # @!scope class # List of all instantiated CronManagers in...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/lib/good_job/systemd_service.rb
lib/good_job/systemd_service.rb
# frozen_string_literal: true require 'concurrent/timer_task' require 'good_job/sd_notify' module GoodJob # :nodoc: # # Manages communication with systemd to notify it about the status of the # GoodJob CLI. If it doesn't look like systemd is controlling the process, # SystemdService doesn't do anything. # ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/lib/good_job/log_subscriber.rb
lib/good_job/log_subscriber.rb
# frozen_string_literal: true module GoodJob # # Listens to GoodJob notifications and logs them. # # Each method corresponds to the name of a notification. For example, when # the {Scheduler} shuts down, it sends a notification named # +"scheduler_shutdown.good_job"+ and the {#scheduler_shutdown} method wi...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/lib/good_job/daemon.rb
lib/good_job/daemon.rb
# frozen_string_literal: true module GoodJob # # Manages daemonization of the current process. # class Daemon # The path of the generated pidfile. # @return [Pathname,String] attr_reader :pidfile # @param pidfile [Pathname,String] Pidfile path def initialize(pidfile:) @pidfile = pidf...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/lib/good_job/capsule.rb
lib/good_job/capsule.rb
# frozen_string_literal: true module GoodJob # A GoodJob::Capsule contains the resources necessary to execute jobs, including # a {GoodJob::Scheduler}, {GoodJob::Poller}, {GoodJob::Notifier}, and {GoodJob::CronManager}. # GoodJob creates a default capsule on initialization. class Capsule # @!attribute [r] ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/lib/good_job/poller.rb
lib/good_job/poller.rb
# frozen_string_literal: true require 'concurrent/atomic/atomic_boolean' module GoodJob # :nodoc: # # Pollers regularly wake up execution threads to check for new work. # class Poller # Defaults for instance of Concurrent::TimerTask. # The timer controls how and when sleeping threads check for new wor...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/lib/good_job/thread_status.rb
lib/good_job/thread_status.rb
# frozen_string_literal: true module GoodJob # Provides methods for determining the status of the # current job execution thread. This is useful for determining # whether to continue processing a job or to shut down gracefully. module ThreadStatus extend ActiveSupport::Concern class_methods do #...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/lib/good_job/callable.rb
lib/good_job/callable.rb
# frozen_string_literal: true module GoodJob # An object that has case-equality to a Proc or Lambda by responding to #call. # This can be used to duck-type match in a case statement. module Callable # Whether the object responds to #call def self.===(other) other.respond_to?(:call) end end en...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/lib/good_job/capsule_tracker.rb
lib/good_job/capsule_tracker.rb
# frozen_string_literal: true module GoodJob # :nodoc: # CapsuleTracker save a record in the database and periodically refreshes it. The intention is to # create a heartbeat that can be used to determine whether a capsule/process is still active # and use that to lock (or unlock) jobs. class CapsuleTracker ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/lib/good_job/probe_server.rb
lib/good_job/probe_server.rb
# frozen_string_literal: true module GoodJob class ProbeServer def self.task_observer(time, output, thread_error) # rubocop:disable Lint/UnusedMethodArgument return if thread_error.is_a? Concurrent::CancelledOperationError GoodJob._on_thread_error(thread_error) if thread_error end def self....
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/lib/good_job/cleanup_tracker.rb
lib/good_job/cleanup_tracker.rb
# frozen_string_literal: true module GoodJob # :nodoc: # Tracks thresholds for cleaning up old jobs. class CleanupTracker attr_accessor :cleanup_interval_seconds, :cleanup_interval_jobs, :job_count, :last_at def initialize(cleanup_interval_seconds: fal...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/lib/good_job/sd_notify.rb
lib/good_job/sd_notify.rb
# frozen_string_literal: true # This is a copy of https://github.com/agis/ruby-sdnotify as of v0.1.1 # (commit 21240f1) # Any changes have been marked with "FORK:" comments. # # It is included here because it is a very small gem, and doing so reduces # the number of dependencies and the supply chain risks they pose. ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/lib/good_job/scheduler.rb
lib/good_job/scheduler.rb
# frozen_string_literal: true require "concurrent/executor/thread_pool_executor" require "concurrent/executor/timer_set" require "concurrent/scheduled_task" require "concurrent/utility/processor_counter" module GoodJob # :nodoc: # # Schedulers are generic thread pools that are responsible for # periodically che...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/lib/good_job/adapter.rb
lib/good_job/adapter.rb
# frozen_string_literal: true module GoodJob # # ActiveJob Adapter. # class Adapter # @!attribute [r] instances # @!scope class # List of all instantiated Adapters in the current process. # @return [Array<GoodJob::Adapter>, nil] cattr_reader :instances, default: Concurrent::Array.new,...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/lib/good_job/job_performer.rb
lib/good_job/job_performer.rb
# frozen_string_literal: true require 'concurrent/delay' module GoodJob # # JobPerformer queries the database for jobs and performs them on behalf of a # {Scheduler}. It mainly functions as glue between a {Scheduler} and the jobs # it should be executing. # # The JobPerformer must be safe to execute acros...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/lib/good_job/current_thread.rb
lib/good_job/current_thread.rb
# frozen_string_literal: true require 'active_support/core_ext/module/attribute_accessors_per_thread' module GoodJob # Thread-local attributes for passing values from Instrumentation. # (Cannot use ActiveSupport::CurrentAttributes because ActiveJob resets it) module CurrentThread # Resettable accessors for ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/lib/good_job/shared_executor.rb
lib/good_job/shared_executor.rb
# frozen_string_literal: true require 'concurrent/executor/executor_service' module GoodJob class SharedExecutor # Allow posting tasks directly to instances include Concurrent::ExecutorService MAX_THREADS = 2 # @!attribute [r] instances # @!scope class # List of all instantiated Shared...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/lib/good_job/configuration.rb
lib/good_job/configuration.rb
# frozen_string_literal: true require "active_support/core_ext/numeric/time" module GoodJob # # +GoodJob::Configuration+ provides normalized configuration information to # the rest of GoodJob. It combines environment information with explicitly # set options to get the final values for each option. # clas...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/lib/good_job/interrupt_error.rb
lib/good_job/interrupt_error.rb
# frozen_string_literal: true module GoodJob # Exception raised when a job is interrupted by a SIGKILL or power failure. class InterruptError < StandardError end end
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false