From ea848ae821800612eaadec8d2b711a5c1135afd2 Mon Sep 17 00:00:00 2001 From: Gleb Pomykalov Date: Tue, 4 Oct 2011 01:46:10 +0400 Subject: [PATCH] Fixed DslError bug --- lib/daemonizer/dsl.rb | 4 ++-- spec/settings/options_spec.rb | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/daemonizer/dsl.rb b/lib/daemonizer/dsl.rb index 612eac0..6fa2270 100644 --- a/lib/daemonizer/dsl.rb +++ b/lib/daemonizer/dsl.rb @@ -1,6 +1,6 @@ -class Daemonizer::DslError < StandardError; end - class Daemonizer::Dsl + class DslError < StandardError; end + def self.evaluate(daemonfile, daemonfile_name = 'Daemonfile') builder = new builder.instance_eval(daemonfile, daemonfile_name.to_s, 1) diff --git a/spec/settings/options_spec.rb b/spec/settings/options_spec.rb index 2f17c22..5641275 100644 --- a/spec/settings/options_spec.rb +++ b/spec/settings/options_spec.rb @@ -34,6 +34,16 @@ class OptionsSpecHandler < SpecHandler; end @eval.configs[:test][:handler_options].should be_kind_of(Hash) @eval.configs[:test][:handler_options].size.should == 3 end + + it "should raise DslError if nothing provided to set_option" do + lambda { + Daemonizer::Dsl.evaluate(<<-G) + pool :test do + set_option :option1, nil + end + G + }.should raise_error Daemonizer::Dsl::DslError + end end describe "pool options in Daemonizer::Config" do