Run multiple tests with Guard when one file is modified?

13 views
Skip to first unread message

Dan Tappin

unread,
Apr 8, 2017, 1:37:24 PM4/8/17
to guard-dev
I am trying to do the following:

      watch(%r{^test/policies/(.+)_policy_test.rb$})        { |m| "test/policies/#{m[1]}_policy_test.rb" }
      watch(%r{^test/policies/(.+)_policy_test.rb$})        { |m| "test/controllers/#{m[1]}_controller_test.rb" }

If I modify a policy test I want to run that test AND the related controller test.  The Guard watch config above only runs the first one I want to run both (or possibly more than 2).  Can I do this?

Rémy Coutable

unread,
Apr 30, 2017, 2:17:50 PM4/30/17
to guar...@googlegroups.com
Hi Dan,

You can return an array of files:

watch(%r{^test/policies/(.+)_policy_test.rb$})        { |m| ["test/policies/#{m[1]}_policy_test.rb", "test/controllers/#{m[1]}_controller_test.rb"] }

Hope that helps!

Best,

– Rémy

--
You received this message because you are subscribed to the Google Groups "guard-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guard-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages