Skip to content

Stub license to fix JH integration factory spec

try to fix upstream MR !96270 (merged) break JH pipeline.

Hi, @splattael, after MR merged, JH pipeline is broken since some factory spec also need stub license, however only EE feature is stubed. In this MR, stub JH feature is also added here because JH stub feature is rarely changed, so put it here is fine.

related code is

    # load JH factory in appliation.rb
    if defined?(FactoryBotRails)
      config.factory_bot.definition_file_paths << 'ee/spec/factories' if Gitlab.ee?
      config.factory_bot.definition_file_paths << 'jh/spec/factories' if Gitlab.jh?
    end

    # spec/models/factories_spec.rb
    # stub some license for EE scenario, and also stub feature for JH scenario 
  shared_context 'with licensed features' do
    licensed_features = %i[
      board_milestone_lists
      board_assignee_lists
    ].index_with(true)

    if Gitlab.jh?
      licensed_features.merge! %i[
        dingtalk_integration
        feishu_bot_integration
      ].index_with(true)
   end

    before do
      stub_licensed_features(licensed_features)
    end
  end

  include_context 'with licensed features' if Gitlab.ee?

peer review @prajnamas

Edited by MAO Chao

Merge request reports