blob: e344888cb8c578c8e374bb45fc7056b5b94a9dc0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# frozen_string_literal: true
module StubSaasFeatures
# Stub SaaS feature with `feature_name: true/false`
#
# @param [Hash] features where key is feature name and value is boolean whether enabled or not.
#
# Examples
# - `stub_saas_features('onboarding' => false)` ... Disable `onboarding`
# SaaS feature globally.
# - `stub_saas_features('onboarding' => true)` ... Enable `onboarding`
# SaaS feature globally.
def stub_saas_features(features)
features.each do |feature_name, value|
raise ArgumentError, 'value must be boolean' unless value.in? [true, false]
allow(::Gitlab::Saas).to receive(:feature_available?).with(feature_name).and_return(value)
end
end
end
|