Warn on conf when an option is not recognized

This commit is contained in:
Andy Meneely
2015-10-26 16:14:13 -04:00
parent 47b5f569a4
commit 7126afbc9c
4 changed files with 22 additions and 3 deletions
+8 -3
View File
@@ -4,17 +4,17 @@ require 'spec_helper'
describe Squib::Conf do
it 'parses the project template file just fine' do
conf = Squib::Conf.load(project_template('config.yml'))
conf = Squib::Conf.load project_template('config.yml')
expect(conf.backend).to eq(Squib::Conf::DEFAULTS['backend'])
end
it 'parses an empty file' do
conf = Squib::Conf.load(conf('empty.yml'))
conf = Squib::Conf.load conf('empty.yml')
expect(conf.backend).to eq(Squib::Conf::DEFAULTS['backend'])
end
it 'parses the sample custom config' do
conf = Squib::Conf.load(sample_file('custom-config.yml'))
conf = Squib::Conf.load sample_file('custom-config.yml')
expect(conf.progress_bars).to be true
expect(conf.text_hint).to eq '#FF0000'
expect(conf.custom_colors).to eq({ 'foo' => '#ccc' })
@@ -26,4 +26,9 @@ describe Squib::Conf do
expect(Squib::Conf.new.antialias).to eq 'subpixel'
end
it 'warns when the yml has an unrecognized option' do
expect(Squib::logger).to receive(:warn).with('Unrecognized configuration option(s): unicorns')
Squib::Conf.load conf('unrecognized.yml')
end
end
+4
View File
@@ -0,0 +1,4 @@
# This is recognized, so it should be fine.
backend: svg
# This is not recognized.
unicorns: true