blob: d0aa7108a6a266652409cf244cf882fecd079062 (
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
|