HolyGrail is a Harmony plugin for Ruby on Rails.
context of a view (the last response body).
js returns the value of the last
class PeopleControllerTest < ActionController::TestCase test "executes simple js" do assert_equal 2, js('1+1') end test "accesses the DOM" do get :foo assert_equal 'Foo', js("document.title") assert_equal 2, js("document.getElementsByTagName('div').length") end end
Install the gem
# There's a gem dependency bug in rubygems currently, so we'll have to # install some dependencies manually. This will be fixed soon. gem install stackdeck gem install johnson -v "2.0.0.pre3" #exact version matters gem install holygrail
and add it to your environment
HolyGrail is based on Harmony, which in turn is a thin DSL wrapper around three amazing libs, Johnson, env.js and Envjs . The authors of those libs have been doing a huge amount of great work for quite a while, so please go recommend them on WorkingWithRails right now and/or follow them on github:
- Support integration tests
- Support Rails3