Alternate specs folder with guard-rspec

139 views
Skip to first unread message

Felipe Coury

unread,
Feb 16, 2012, 11:04:40 PM2/16/12
to guar...@googlegroups.com
Hi guys,

I always used guard-rspec with the default spec folder, but I have now two sets of tests: spec and spec_no_rails (my "fast" tests). I would like to make Guard watch the spec_no_rails folder, instead (or on top of) my spec folder.

Does anyone have a recipe or tips for achieving that? 

Thanks in advance!

Best,

-- Felipe.

Thibaud Guillaume-Gentil

unread,
Feb 17, 2012, 2:51:35 AM2/17/12
to guar...@googlegroups.com
Hi Felipe,

This is not something supported by guard-rspec yet, feel free to submit a pull request to guard-rspec for supporting custom (and multiple) specs folders.

Thanks!
Thibaud

Diwa Laksh

unread,
Mar 20, 2012, 1:24:41 AM3/20/12
to guar...@googlegroups.com
Hello,
   I have been successfully using guard-rspec for both my "spec" and "fast" folders. Here is the config I use

  guard :rspec, spec_paths: %w[spec fast] do
    watch(%r{^spec/.+_spec\.rb$})
    watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
    watch('spec/spec_helper.rb') { "spec" }

    #Fast specs
    watch(%r{^fast/.+_spec\.rb$})
    watch('fast/fast_spec_helper.rb') { "fast" }

    watch(%r{^app/(.+)\.rb$}) { |m| ["spec/#{m[1]}_spec.rb", "fast/#{m[1]}_spec.rb"] }
    watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
    watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
    watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
    watch('config/routes.rb') { "spec/routing" }
    watch('app/controllers/application_controller.rb') { "spec/controllers" }
    # Capybara request specs
    watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
  end

Regards
Diwa
Reply all
Reply to author
Forward
0 new messages