Permalink
Browse files

evaluate_guardfile uses all groups if none specified. Fixes #118

  • Loading branch information...
ches committed Aug 14, 2011
1 parent 2c81e5b commit 87375c7a1ffdfcab1b10015ca6bb7706c41368ae
Showing with 7 additions and 1 deletion.
  1. +2 −1 lib/guard/dsl.rb
  2. +5 −0 spec/guard/dsl_spec.rb
View
@@ -104,7 +104,8 @@ def home_guardfile_path
end
def group(name, &guard_definition)
- guard_definition.call if guard_definition && (@@options[:group].empty? || @@options[:group].include?(name.to_s))
+ @groups = @@options[:group] || []
+ guard_definition.call if guard_definition && (@groups.empty? || @groups.include?(name.to_s))
end
def guard(name, options = {}, &watch_definition)
View
@@ -213,6 +213,11 @@
::Guard.should_receive(:add_guard).with('another', anything, {})
lambda { subject.evaluate_guardfile(:guardfile_contents => valid_guardfile_string, :group => ['x','y']) }.should_not raise_error
end
+ it "should evaluate all groups when no group option is specified" do
+ ::Guard.should_receive(:add_guard).with('test', anything, {}).twice
+ ::Guard.should_receive(:add_guard).with('another', anything, {}).twice
+ lambda { subject.evaluate_guardfile(:guardfile_contents => valid_guardfile_string) }.should_not raise_error
+ end
end
# TODO: not sure if each seperate quoting/call type needs its own test

0 comments on commit 87375c7

Please sign in to comment.