Skip to content

Loading…

Allow symbols for group names #73

Merged
merged 2 commits into from

2 participants

@johnbintz
Guard member

I tried treating Guardfile groups like Gemfile groups by using symbols and that failed. This patch allows the use of symbols in the Guardfile.

@rymai
Guard member

Can you leave a spec with the guard name set as a String? Thanks, I'll merge after that!

@johnbintz
Guard member

Will that work?

@rymai
Guard member

Perfect! Does the specs pass? ;)

@johnbintz
Guard member

All 130 of them.

@rymai rymai merged commit 53adfc9 into guard:master
@rymai
Guard member

In that case, let see what Travis-CI has to say! :D

Thanks! :)

@rymai rymai pushed a commit that referenced this pull request
Rémy Coutable Added last pull-request #73 to the Changelog, thanks to @johnbintz! 3d52d51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 3 deletions.
  1. +1 −1 lib/guard/dsl.rb
  2. +12 −2 spec/guard/dsl_spec.rb
View
2 lib/guard/dsl.rb
@@ -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
14 spec/guard/dsl_spec.rb
@@ -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
Something went wrong with that request. Please try again.