Extract the EE specific codes in spec/factories/notes.rb
The following discussion from !8772 (merged) should be addressed:
-
@godfat started a discussion: (+2 comments) I see that we don't really have a way to extend EE factories for now, but could we please maybe try it out here, so we can pass https://gitlab.com/gitlab-org/gitlab-ee/-/jobs/141109286 ?
I am thinking that we can start adding
ee/spec/factories/notes.rb
, and maybe add a module like:module EE module Factory module Note extend ActiveSupport::Concern prepended do factory :note_on_epic, traits: [:on_epic] trait :on_epic do noteable { create(:epic) } project nil end end end end end
And we
prepend
in this file:FactoryBot.define do factory :note do # ... prepend EE::Factory::Note end end
Of course, we'll need to solve the constant loading issue. What do you think?