From 087f51085f850fcd43a38b2f96248b9745ff28af Mon Sep 17 00:00:00 2001 From: John Bintz Date: Wed, 1 Jun 2011 14:12:59 -0400 Subject: [PATCH 1/2] allow symbols for group names --- lib/guard/dsl.rb | 2 +- spec/guard/dsl_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/guard/dsl.rb b/lib/guard/dsl.rb index 454729d..68b9f8f 100644 --- a/lib/guard/dsl.rb +++ b/lib/guard/dsl.rb @@ -90,7 +90,7 @@ module Guard end def group(name, &guard_definition) - guard_definition.call if guard_definition && (@@options[:group].empty? || @@options[:group].include?(name)) + guard_definition.call if guard_definition && (@@options[:group].empty? || @@options[:group].include?(name.to_s)) end def guard(name, options = {}, &watch_definition) diff --git a/spec/guard/dsl_spec.rb b/spec/guard/dsl_spec.rb index 26ef5ef..59186d2 100644 --- a/spec/guard/dsl_spec.rb +++ b/spec/guard/dsl_spec.rb @@ -251,7 +251,7 @@ private end def valid_guardfile_string - "group 'x' do + "group :x do guard 'test' do watch('c') end From b0d30900fbc0ab7c0236cff6d4f53df298e55200 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Wed, 1 Jun 2011 15:00:01 -0400 Subject: [PATCH 2/2] add additional spec to test string-only guard group names --- spec/guard/dsl_spec.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/spec/guard/dsl_spec.rb b/spec/guard/dsl_spec.rb index 59186d2..5312226 100644 --- a/spec/guard/dsl_spec.rb +++ b/spec/guard/dsl_spec.rb @@ -186,7 +186,11 @@ describe Guard::Dsl do end describe "#group" do - it "should evaluates only the specified group" do + it "should evaluates only the specified string group" do + ::Guard.should_receive(:add_guard).with('test', anything, {}) + lambda { subject.evaluate_guardfile(:guardfile_contents => valid_guardfile_string, :group => ['w']) }.should_not raise_error + end + it "should evaluates only the specified symbol group" do ::Guard.should_receive(:add_guard).with('test', anything, {}) lambda { subject.evaluate_guardfile(:guardfile_contents => valid_guardfile_string, :group => ['x']) }.should_not raise_error end @@ -251,7 +255,13 @@ private end def valid_guardfile_string - "group :x do + "group 'w' do + guard 'test' do + watch('c') + end + end + + group :x do guard 'test' do watch('c') end