Joel Blum
Joel Blum

Reputation: 7878

Rails Guardfile Won't Watch Concerns Dir

My Guardfile mostly works except that I can't get it to watch a concerns dir. The problem must be with my regexp which I've written below.

My concerns dir is built like this :

/app/models/concerns/dir_for_concerns/some_concern.rb

And the specs dirs is what you'd expect:

 /spec/models/concerns/dir_for_concerns/some_concern.rb

Guardfile.rb

 watch(%r{^app/models/concerns/(\w)+/(\w)+\.rb$})     { |m| "spec/models/concerns/#{m[1]}/#{m[2]}_spec.rb" }

Upvotes: 1

Views: 264

Answers (1)

Cezary Baginski
Cezary Baginski

Reputation: 2095

This would be a good idea to support out of the box, so I created an issue here: https://github.com/guard/guard-rspec/issues/366

(You can comment/vote on it to encourage someone to implement it sooner).

I'd probably handle it with something simple like this:

watch(%r{^app/(models/concerns/.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }

Upvotes: 1

Related Questions