Last week I wrote a post about using the Asset Pipeline outside of Rails because we needed to test answers for Code School’s upcoming Zombies 2 course. But we also need a way to test javascript (that uses jQuery) that manipulates a DOM, and all from inside of Ruby.
ExecJS to the rescue
ExecJS is a ruby gem that lets you run JavaScript code from Ruby. It does this by using the best javascript runtime available to evaluate Javascript and returning the result in Ruby! For example:
ExecJS.eval "'red yellow blue'.split(' ')"
# => ["red", "yellow", "blue"]
Rad! Or you can use it to compile a block of javascript and then call it later, like this:
context = ExecJS.compile "var run = function(foo) { return foo + foo }"
context.call 'run', 'bar'
# => 'barbar'





Ruby on Rails recently added a built-in 
