put spec location into a variable

This commit is contained in:
John Bintz 2011-05-24 06:37:18 -04:00
parent 48e060ad1b
commit 74f8cba33e
1 changed files with 9 additions and 3 deletions

View File

@ -1,9 +1,15 @@
# Run JS and CoffeeScript files in a typical Rails 3.1 fashion, placing Underscore templates in app/views/*.jst
# Your spec files end with _spec.{js,coffee}.
spec_location = "spec/javascripts/%s_spec"
# uncomment if you use NerdCapsSpec.js
# spec_location = "spec/javascripts/%sSpec"
guard 'jasmine-headless-webkit' do
watch(%r{^app/views/.*\.jst})
watch(%r{^public/javascripts/(.*)\.js}) { |m| newest_js_file("spec/javascripts/#{m[1]}") }
watch(%r{^app/assets/javascripts/(.*)\.(js|coffee)}) { |m| newest_js_file("spec/javascripts/#{m[1]}") }
watch(%r{^spec/javascripts/(.*)_spec\..*}) { |m| newest_js_file("spec/javascripts/#{m[1]}") }
watch(%r{^public/javascripts/(.*)\.js}) { |m| newest_js_file(spec_location % m[1]) }
watch(%r{^app/assets/javascripts/(.*)\.(js|coffee)}) { |m| newest_js_file(spec_location % m[1]) }
watch(%r{^spec/javascripts/(.*)_spec\..*}) { |m| newest_js_file(spec_location % m[1]) }
end