Skip to content

Properly implement prepending for Concern

Lin Jen-Shin requested to merge ee-50824-fix-prepend-concern into master

What does this MR do?

Properly implement prepending for Concern

We want to patch ActiveSupport::Concern for two reasons:

  1. Allow defining class methods via: class_methods method
  2. Allow prepended do; end work like included do; end

If we don't need anything above, we don't need this patch nor the concern!

NOTE: Don't care too much about the implementation. It's all black magic based on ActiveSupport::Concern. I personally think this is a very bad magic, but we're coupling with it too deeply right now to withdraw from it.

What we should focus on is the tests in spec/lib/gitlab/patch/prependable_spec.rb. Is it what we're expecting? If not, add tests meet our expectation. We should have a bunch of use cases listed there to catch edge cases.

What are the relevant issue numbers?

CE at: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21444

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/50824

Does this MR meet the acceptance criteria?

Edited by Lin Jen-Shin

Merge request reports