I'm looking for the easiest possible Javascript unit-testing system for Rails 3.1 that is specifically capable of working with the asset pipeline out of the box.
I've tried various incarnations of the jasmine gem, including jasmine-rice, headless-jasmine-webkit. Jasmine gem does not appear to work with rails 3.1 out of the box, requiring tweaking of various config files. Jasmine-rice and headless-jasmine-webkit both have complicated dependencies and require more tweaking of the config file.
Any suggestions? Ideally I would need to include HTML/HAML fixtures, and be headless, but at this point I would be happy with anything that allows me to test my javascript with minimal configuration.
Jasmine is the best solution. We're using this to test all our JS code. It works beautifully with CoffeeScript as well.
But don't install the version of RubyGems.org (it's not been updated in a while), just get the latest from github, e.g. add to your Gemfile
:
group :test do
gem 'jasmine', :git => 'https://github.com/pivotal/jasmine-gem.git'
end
Then you can run rake jasmine
and go to http://localhost:8888
to run your tests. Headless webkit also works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With