Skip to content

Instantly share code, notes, and snippets.

@fgrehm fgrehm/gist:3841631
Created Oct 5, 2012

Embed
What would you like to do?
guard-rspec with acceptance and unit tests split up
guard 'rspec', :version => 2, :spec_paths => ["spec/models", 'spec/controllers'] do
watch(%r{^spec/(models|controllers).+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { ["spec/controllers", 'spec/models'] }
watch('spec/factories/*.rb') { ["spec/controllers", 'spec/models'] }
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{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/models", 'spec/controllers'] }
watch('app/controllers/application_controller.rb') { "spec/controllers" }
# TODO: Find a way to trigger acceptance specs from here only when specs are all green
# callback(:run_all_end) { `find spec/acceptance/ -iname *_spec.rb | xargs -n1 touch` }
end
guard 'rspec', :version => 2, :spec_paths => "spec/acceptance", :all_after_pass => false do
watch(%r{^spec/acceptance/(.+)_spec\.rb$}) { |m| "spec/acceptance/#{m[1]}_spec.rb" }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.