Commit d3447d6c authored by Bob Van Landuyt's avatar Bob Van Landuyt

Fix crash when checking external authorization

Only check the global feature directly on `License` otherwise we would
also perform the check on the namespace which would cause a crash.
parent 0f8e3362
......@@ -489,7 +489,7 @@ module EE
end
def external_authorization_classification_label
return nil unless feature_available?(:external_authorization_service)
return nil unless License.feature_available?(:external_authorization_service)
super || ::Gitlab::CurrentSettings.current_application_settings
.external_authorization_service_default_label
......
......@@ -1292,6 +1292,14 @@ describe Project do
expect(project.external_authorization_classification_label)
.to eq('hello')
end
it 'does not break when not stubbing the license check' do
enable_external_authorization_service
enable_namespace_license_check!
project = build(:project)
expect { project.external_authorization_classification_label }.not_to raise_error
end
end
describe '#user_can_push_to_empty_repo?' do
......
......@@ -7,7 +7,7 @@ module EE
# stub_licensed_features(geo: true, deploy_board: false)
#
# This enables `geo` and disables `deploy_board` features for a spec.
# Other features are still enabled/disabled as defined in the licence.
# Other features are still enabled/disabled as defined in the license.
def stub_licensed_features(features)
allow(License).to receive(:feature_available?).and_call_original
......
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