diff options
Diffstat (limited to 'spec/lib/feature')
-rw-r--r-- | spec/lib/feature/definition_spec.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/spec/lib/feature/definition_spec.rb b/spec/lib/feature/definition_spec.rb index 49224cf4279..fa0207d829a 100644 --- a/spec/lib/feature/definition_spec.rb +++ b/spec/lib/feature/definition_spec.rb @@ -105,6 +105,7 @@ RSpec.describe Feature::Definition do describe '.load_all!' do let(:store1) { Dir.mktmpdir('path1') } let(:store2) { Dir.mktmpdir('path2') } + let(:definitions) { {} } before do allow(described_class).to receive(:paths).and_return( @@ -115,28 +116,30 @@ RSpec.describe Feature::Definition do ) end + subject { described_class.send(:load_all!) } + it "when there's no feature flags a list of definitions is empty" do - expect(described_class.load_all!).to be_empty + is_expected.to be_empty end it "when there's a single feature flag it properly loads them" do write_feature_flag(store1, path, yaml_content) - expect(described_class.load_all!).to be_one + is_expected.to be_one end it "when the same feature flag is stored multiple times raises exception" do write_feature_flag(store1, path, yaml_content) write_feature_flag(store2, path, yaml_content) - expect { described_class.load_all! } + expect { subject } .to raise_error(/Feature flag 'feature_flag' is already defined/) end it "when one of the YAMLs is invalid it does raise exception" do write_feature_flag(store1, path, '{}') - expect { described_class.load_all! } + expect { subject } .to raise_error(/Feature flag is missing name/) end |