From 7419680e3c8d7313cba196083f827d798ec038bc Mon Sep 17 00:00:00 2001 From: Gustavo Bazan Date: Sun, 23 Aug 2015 10:51:44 -0500 Subject: [PATCH] Add test for unreadable predicates file --- spec/fuzzy_where/config_spec.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spec/fuzzy_where/config_spec.rb b/spec/fuzzy_where/config_spec.rb index 8016c77..8df87fa 100644 --- a/spec/fuzzy_where/config_spec.rb +++ b/spec/fuzzy_where/config_spec.rb @@ -83,5 +83,17 @@ FuzzyWhere.configure { |c| c.predicates_file = nil } end end + context 'with forbidden predicates_file' do + let(:path) { FIXTURES_PATH.join('forbidden_predicates.yml') } + before do + FuzzyWhere.configure { |c| c.predicates_file = path } + end + it 'should raise FuzzyWhere::ConfigError' do + expect { config.fuzzy_predicate(:some_key) }.to raise_error(FuzzyWhere::ConfigError) + end + after do + FuzzyWhere.configure { |c| c.predicates_file = nil } + end + end end end