From 3aea946e7f590319ff7b85dbbd4eedfc20569deb Mon Sep 17 00:00:00 2001 From: Brett Walker Date: Tue, 4 Sep 2018 13:34:37 -0500 Subject: add 'default_enabled' to feature flags This allows you to default a feature flag to 'on' when checking whether it's enabled/disabled. --- spec/lib/feature_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'spec/lib/feature_spec.rb') diff --git a/spec/lib/feature_spec.rb b/spec/lib/feature_spec.rb index 8bb5a843484..48c0ba8a653 100644 --- a/spec/lib/feature_spec.rb +++ b/spec/lib/feature_spec.rb @@ -119,6 +119,10 @@ describe Feature do expect(described_class.enabled?(:some_random_feature_flag)).to be_falsey end + it 'returns true for undefined feature with default_enabled' do + expect(described_class.enabled?(:some_random_feature_flag, default_enabled: true)).to be_truthy + end + it 'returns false for existing disabled feature in the database' do described_class.disable(:disabled_feature_flag) @@ -160,6 +164,10 @@ describe Feature do expect(described_class.disabled?(:some_random_feature_flag)).to be_truthy end + it 'returns false for undefined feature with default_enabled' do + expect(described_class.disabled?(:some_random_feature_flag, default_enabled: true)).to be_falsey + end + it 'returns true for existing disabled feature in the database' do described_class.disable(:disabled_feature_flag) -- cgit v1.2.1