Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jobs Generator: Remove obsolete configuration #1197

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions lib/generators/suspenders/jobs_generator.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module Suspenders
module Generators
class JobsGenerator < Rails::Generators::Base
source_root File.expand_path("../../templates/active_job", __FILE__)
desc <<~MARKDOWN
Installs Sidekiq for background job processing.
MARKDOWN
Expand All @@ -11,17 +10,8 @@ def add_sidekiq_gem
Bundler.with_unbundled_env { run "bundle install" }
end

def initialize_active_job
copy_file "active_job.rb", "config/initializers/active_job.rb"
end

def configure_active_job
environment "config.active_job.queue_adapter = :sidekiq"
environment "config.action_mailer.deliver_later_queue_name = nil"
environment "config.action_mailbox.queues.routing = nil"
environment "config.active_storage.queues.analysis = nil"
environment "config.active_storage.queues.purge = nil"
environment "config.active_storage.queues.mirror = nil"
environment "config.active_job.queue_adapter = :inline", env: "test"
end

Expand Down
14 changes: 0 additions & 14 deletions lib/generators/templates/active_job/active_job.rb

This file was deleted.

14 changes: 0 additions & 14 deletions test/fixtures/files/active_job.rb

This file was deleted.

15 changes: 0 additions & 15 deletions test/generators/suspenders/jobs_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,11 @@ class JobsGeneratorTest < Rails::Generators::TestCase
assert_match(/bundle install/, output)
end

test "configures ActiveJob logging" do
expected_configuration = file_fixture("active_job.rb").read

run_generator

assert_file app_root("config/initializers/active_job.rb") do |file|
assert_equal(expected_configuration, file)
end
end

test "adds ActiveJob configuration to the application file" do
run_generator

assert_file app_root("config/application.rb") do |file|
assert_match(/config.active_job.queue_adapter = :sidekiq/, file)
assert_match(/config.action_mailer.deliver_later_queue_name = nil/, file)
assert_match(/config.action_mailbox.queues.routing = nil/, file)
assert_match(/config.active_storage.queues.analysis = nil/, file)
assert_match(/config.active_storage.queues.purge = nil/, file)
assert_match(/config.active_storage.queues.mirror = nil/, file)
end
end

Expand Down