summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorBrett Walker <bwalker@gitlab.com>2018-09-04 13:34:37 -0500
committerBrett Walker <bwalker@gitlab.com>2018-09-05 09:19:16 -0500
commit3aea946e7f590319ff7b85dbbd4eedfc20569deb (patch)
tree22fd1a021eece3b982b0dfd1f8fe7cce6b5c3df8 /doc
parent589776fc2e421df12c2526f9cf8cd7f3f239a21f (diff)
downloadgitlab-ce-3aea946e7f590319ff7b85dbbd4eedfc20569deb.tar.gz
add 'default_enabled' to feature flags
This allows you to default a feature flag to 'on' when checking whether it's enabled/disabled.
Diffstat (limited to 'doc')
-rw-r--r--doc/development/feature_flags.md11
1 files changed, 9 insertions, 2 deletions
diff --git a/doc/development/feature_flags.md b/doc/development/feature_flags.md
index 702caacc74f..6f757f1ce7b 100644
--- a/doc/development/feature_flags.md
+++ b/doc/development/feature_flags.md
@@ -58,13 +58,20 @@ Features that are developed and are intended to be merged behind a feature flag
should not include a changelog entry. The entry should be added in the merge
request removing the feature flags.
+In the rare case that you need the feature flag to be on automatically, use
+`default_enabled: true` when checking:
+
+```ruby
+Feature.enabled?(:feature_flag, project, default_enabled: true)
+```
+
### Specs
In the test environment `Feature.enabled?` is stubbed to always respond to `true`,
so we make sure behavior under feature flag doesn't go untested in some non-specific
contexts.
-
-If you need to test the feature flag in a different state, you need to stub it with:
+
+If you need to test the feature flag in a different state, you need to stub it with:
```ruby
stub_feature_flags(my_feature_flag: false)