Skip to content

Commit

Permalink
Fix private performs marking on immediate version too
Browse files Browse the repository at this point in the history
`private performs :some_method` should make both `:some_method` and `:some_method_later` private.
But that only works if we return an array with both method names.
  • Loading branch information
kaspth committed Nov 4, 2023
1 parent a08afc7 commit 4b8b2ab
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/active_job/performs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ def #{method}_later#{suffix}(*arguments, **options)
#{job}.scoped_by_wait(self).perform_later(self, *arguments, **options)
end
RUBY

[method, :"#{method}_later#{suffix}"] # Ensure `private performs :some_method` privates both names.
end
end

Expand Down
1 change: 1 addition & 0 deletions test/active_job/test_performs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class ActiveJob::TestPerforms < ActiveSupport::TestCase
end

test "supports private methods" do
assert_includes Post::Publisher.private_instance_methods, :private_method
assert_includes Post::Publisher.private_instance_methods, :private_method_later

assert_output "private_method\n" do
Expand Down

0 comments on commit 4b8b2ab

Please sign in to comment.