Use Guard with jasmine-headless-webkit
Go to file
2011-05-24 06:37:18 -04:00
lib/guard put spec location into a variable 2011-05-24 06:37:18 -04:00
spec yeah, it's working 2011-05-23 21:28:01 -04:00
.gitignore initial commit 2011-05-23 18:37:19 -04:00
Gemfile yeah, it's working 2011-05-23 21:28:01 -04:00
guard-jasmine-headless-webkit.gemspec tweak gemspec 2011-05-23 21:38:29 -04:00
Guardfile yeah, it's working 2011-05-23 21:28:01 -04:00
Rakefile initial commit 2011-05-23 18:37:19 -04:00
README.md update readme 2011-05-24 06:31:37 -04:00

Guard support for jasmine-headless-webkit

Add running your Jasmine specs to your Guardfile via jasmine-headless-webkit. Nice!

guard 'jasmine-headless-webkit' do
  watch(%r{^app/assets/javascripts/(.*)\..*}) { |m| newest_js_file("spec/javascripts/#{m[1]}") }
end

gem install guard-jasmine-headless-webkit and then guard init jasmine-headless-webkit in your project directory to get started.

guard options

  • :all_on_start => false to not run everything when starting, just like guard-rspec

What's the deal with newest_js_file?

Since one could, theoretically, have a CoffeeScript app file and a JavaScript spec file (or vice versa), the search for the correct matching file is a little more complicated. newest_js_file extends the Guard DSL to search the given path for the newest .js or .coffee file:

newest_js_file('spec/javascripts/models/my_model')
  #=> search for Dir['spec/javascripts/models/my_model*.{js,coffee}'] and return the newest file found

If you 100% know you won't need that support, modify your Guardfile as appropriate.

I use Backbone.js a lot, and I put my view templates in app/views/*.jst and mash them all together with Jammit for use in my apps. Feel free to change that, it's your Guardfile after all.