3aea946e7f
This allows you to default a feature flag to 'on' when checking whether it's enabled/disabled.
11 lines
448 B
Ruby
11 lines
448 B
Ruby
module StubFeatureFlags
|
|
# Stub Feature flags with `flag_name: true/false`
|
|
#
|
|
# @param [Hash] features where key is feature name and value is boolean whether enabled or not
|
|
def stub_feature_flags(features)
|
|
features.each do |feature_name, enabled|
|
|
allow(Feature).to receive(:enabled?).with(feature_name, any_args) { enabled }
|
|
allow(Feature).to receive(:enabled?).with(feature_name.to_s, any_args) { enabled }
|
|
end
|
|
end
|
|
end
|