Skip to content

Commit

Permalink
Fix NoMethodError in dev.rb when skip-active-job
Browse files Browse the repository at this point in the history
config.active_jobs.verbose_enqueue_logs was [added][1] to the
development.rb template, but it was put inside the skip-active-record
block. This means that it will be included in generated development.rb
even when Active Job is skipped.

This commit fixes this issue by moving it outside of the
skip-active-record check and into its own skip-active-job check.

[1]: f6d56fe
  • Loading branch information
skipkayhil committed Apr 15, 2023
1 parent ccb6462 commit 9a297fb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ Rails.application.configure do
# Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true

<%- end -%>
<%- unless options[:skip_active_job] -%>
# Highlight code that enqueued background job in logs.
config.active_job.verbose_enqueue_logs = true

Expand Down
10 changes: 10 additions & 0 deletions railties/test/generators/app_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,16 @@ def test_skip_active_record_option
end
end

def test_skip_active_job_option
run_generator [destination_root, "--skip-active-job"]

["production", "development", "test"].each do |env|
assert_file "config/environments/#{env}.rb" do |content|
assert_no_match(/active_job/, content)
end
end
end

def test_skip_javascript_option
generator([destination_root], skip_javascript: true)

Expand Down

0 comments on commit 9a297fb

Please sign in to comment.