diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2018-07-20 03:05:24 +0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2018-07-20 03:05:24 +0300 |
commit | 06e03f6e4d3d60e30b38fe218a27c3907a3911cc (patch) | |
tree | 9593de27a0dfc13519827d6efff1dbe656f98f81 /spec | |
parent | b60364c0f377f4afdf5e96e84aba11988f4ae526 (diff) |
Allow feature flag names to be a symbol
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/feature_spec.rb | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/spec/lib/feature_spec.rb b/spec/lib/feature_spec.rb index 6eb10497428..f313e675654 100644 --- a/spec/lib/feature_spec.rb +++ b/spec/lib/feature_spec.rb @@ -39,18 +39,36 @@ describe Feature do end describe '.persisted?' do - it 'returns true for a persisted feature' do - Feature::FlipperFeature.create!(key: 'foo') + context 'when the feature is persisted' do + it 'returns true when feature name is a string' do + Feature::FlipperFeature.create!(key: 'foo') + + feature = double(:feature, name: 'foo') + + expect(described_class.persisted?(feature)).to eq(true) + end + + it 'returns true when feature name is a symbol' do + Feature::FlipperFeature.create!(key: 'foo') - feature = double(:feature, name: 'foo') + feature = double(:feature, name: :foo) - expect(described_class.persisted?(feature)).to eq(true) + expect(described_class.persisted?(feature)).to eq(true) + end end - it 'returns false for a feature that is not persisted' do - feature = double(:feature, name: 'foo') + context 'when the feature is not persisted' do + it 'returns false when feature name is a string' do + feature = double(:feature, name: 'foo') + + expect(described_class.persisted?(feature)).to eq(false) + end - expect(described_class.persisted?(feature)).to eq(false) + it 'returns false when feature name is a symbol' do + feature = double(:feature, name: :bar) + + expect(described_class.persisted?(feature)).to eq(false) + end end end |