Permalink
Browse files

Merge pull request #73 from johnbintz/symbols-for-group-names

Allow symbols for group names
  • Loading branch information...
2 parents 048ed9c + b0d3090 commit 53adfc9e944ac3497a58dff1147c7569dbb34c57 Rémy Coutable committed Jun 1, 2011
Showing with 13 additions and 3 deletions.
  1. +1 −1 lib/guard/dsl.rb
  2. +12 −2 spec/guard/dsl_spec.rb
View
@@ -90,7 +90,7 @@ def home_guardfile_path
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)
View
@@ -186,7 +186,11 @@
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 @@ def fake_guardfile(name, contents)
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

0 comments on commit 53adfc9

Please sign in to comment.