Commit bc4a8443 authored by Alexandru Croitor's avatar Alexandru Croitor

Add no-op license helper to CE

Add no-op license helper to CE to make it compatible with EE codebase.
Helper will be overwritten in EE to allow for CE specs to be run under
EE codebase.

https://gitlab.com/gitlab-org/gitlab-ee/issues/6539
parent 4c16e437
module EE module EE
module LicenseHelpers module LicenseHelpers
extend ActiveSupport::Concern
# Enable/Disable a feature on the License for a spec. # Enable/Disable a feature on the License for a spec.
# #
# Example: # Example:
...@@ -8,6 +10,8 @@ module EE ...@@ -8,6 +10,8 @@ module EE
# #
# This enables `geo` and disables `deploy_board` features for a spec. # This enables `geo` and disables `deploy_board` features for a spec.
# Other features are still enabled/disabled as defined in the license. # Other features are still enabled/disabled as defined in the license.
prepended do
def stub_licensed_features(features) def stub_licensed_features(features)
existing_features = License::FEATURES_BY_PLAN.values.flatten.map(&:to_sym) existing_features = License::FEATURES_BY_PLAN.values.flatten.map(&:to_sym)
missing_features = features.keys.map(&:to_sym) - existing_features missing_features = features.keys.map(&:to_sym) - existing_features
...@@ -30,4 +34,5 @@ module EE ...@@ -30,4 +34,5 @@ module EE
::Gitlab::CurrentSettings.update!(check_namespace_plan: true) ::Gitlab::CurrentSettings.update!(check_namespace_plan: true)
end end
end end
end
end end
...@@ -16,7 +16,6 @@ describe QuickActions::InterpretService do ...@@ -16,7 +16,6 @@ describe QuickActions::InterpretService do
before do before do
stub_licensed_features(multiple_issue_assignees: false) stub_licensed_features(multiple_issue_assignees: false)
project.add_developer(developer) project.add_developer(developer)
end end
......
...@@ -68,6 +68,7 @@ RSpec.configure do |config| ...@@ -68,6 +68,7 @@ RSpec.configure do |config|
metadata[:type] = match[1].singularize.to_sym if match metadata[:type] = match[1].singularize.to_sym if match
end end
config.include LicenseHelpers
config.include ActiveJob::TestHelper config.include ActiveJob::TestHelper
config.include ActiveSupport::Testing::TimeHelpers config.include ActiveSupport::Testing::TimeHelpers
config.include CycleAnalyticsHelpers config.include CycleAnalyticsHelpers
......
# frozen_string_literal: true
# Placeholder module for EE implementation needed for CE specs to be run in EE codebase
module LicenseHelpers
def stub_licensed_features(features)
# do nothing
end
end
LicenseHelpers.prepend(EE::LicenseHelpers)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment