Skip to content
This repository

Allow symbols for group names #73

Merged
merged 2 commits into from about 3 years ago

2 participants

John Bintz Rémy Coutable
John Bintz

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

Rémy Coutable
Owner
rymai commented

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

John Bintz

Will that work?

Rémy Coutable
Owner
rymai commented

Perfect! Does the specs pass? ;)

John Bintz

All 130 of them.

Rémy Coutable rymai merged commit 53adfc9 into from
Rémy Coutable rymai closed this
Rémy Coutable
Owner
rymai commented

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

Thanks! :)

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 2 changed files with 13 additions and 3 deletions. Show diff stats Hide diff stats

  1. +1 1  lib/guard/dsl.rb
  2. +12 2 spec/guard/dsl_spec.rb
2  lib/guard/dsl.rb
@@ -90,7 +90,7 @@ def home_guardfile_path
90 90 end
91 91
92 92 def group(name, &guard_definition)
93   - guard_definition.call if guard_definition && (@@options[:group].empty? || @@options[:group].include?(name))
  93 + guard_definition.call if guard_definition && (@@options[:group].empty? || @@options[:group].include?(name.to_s))
94 94 end
95 95
96 96 def guard(name, options = {}, &watch_definition)
14 spec/guard/dsl_spec.rb
@@ -186,7 +186,11 @@
186 186 end
187 187
188 188 describe "#group" do
189   - it "should evaluates only the specified group" do
  189 + it "should evaluates only the specified string group" do
  190 + ::Guard.should_receive(:add_guard).with('test', anything, {})
  191 + lambda { subject.evaluate_guardfile(:guardfile_contents => valid_guardfile_string, :group => ['w']) }.should_not raise_error
  192 + end
  193 + it "should evaluates only the specified symbol group" do
190 194 ::Guard.should_receive(:add_guard).with('test', anything, {})
191 195 lambda { subject.evaluate_guardfile(:guardfile_contents => valid_guardfile_string, :group => ['x']) }.should_not raise_error
192 196 end
@@ -251,7 +255,13 @@ def fake_guardfile(name, contents)
251 255 end
252 256
253 257 def valid_guardfile_string
254   - "group 'x' do
  258 + "group 'w' do
  259 + guard 'test' do
  260 + watch('c')
  261 + end
  262 + end
  263 +
  264 + group :x do
255 265 guard 'test' do
256 266 watch('c')
257 267 end

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.