diff options
author | Gabriel Mazetto <brodock@gmail.com> | 2018-08-20 20:52:56 +0200 |
---|---|---|
committer | Gabriel Mazetto <brodock@gmail.com> | 2018-08-22 05:41:15 +0200 |
commit | 61c35b6ca1840507f5da3aa4d951e4273e612d66 (patch) | |
tree | 7c248fec944fd3a4604086ec8ccfaf313c85f0a1 /spec/support/helpers/stub_feature_flags.rb | |
parent | a440c2be018e79ee671543c2c96cc1f741336fde (diff) | |
download | gitlab-ce-61c35b6ca1840507f5da3aa4d951e4273e612d66.tar.gz |
Fixed `stub_feature_flag behavior` for `disabled?` flags.
Previous code would not work with `disabled?` because that method would
send two parameters (second always `nil`) which we are not mocking.
Instead of mock yet another state, I decide to fix it where it belongs.
Diffstat (limited to 'spec/support/helpers/stub_feature_flags.rb')
-rw-r--r-- | spec/support/helpers/stub_feature_flags.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/spec/support/helpers/stub_feature_flags.rb b/spec/support/helpers/stub_feature_flags.rb index b96338bf548..c54a871b157 100644 --- a/spec/support/helpers/stub_feature_flags.rb +++ b/spec/support/helpers/stub_feature_flags.rb @@ -1,4 +1,7 @@ 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) { enabled } |