debian-mirror-gitlab/spec/support/helpers/stub_feature_flags.rb

12 lines
448 B
Ruby
Raw Normal View History

2017-09-10 17:25:29 +05:30
module StubFeatureFlags
2018-11-20 20:47:30 +05:30
# Stub Feature flags with `flag_name: true/false`
#
# @param [Hash] features where key is feature name and value is boolean whether enabled or not
2017-09-10 17:25:29 +05:30
def stub_feature_flags(features)
features.each do |feature_name, enabled|
2018-11-20 20:47:30 +05:30
allow(Feature).to receive(:enabled?).with(feature_name, any_args) { enabled }
allow(Feature).to receive(:enabled?).with(feature_name.to_s, any_args) { enabled }
2017-09-10 17:25:29 +05:30
end
end
end