lib/holygrail.rb
def js(code)
      XhrProxy.context = self
      @__page ||= Harmony::Page.new(XHR_MOCK_SCRIPT + rewrite_script_paths(@response.body.to_s))
      Harmony::Page::Window::BASE_RUNTIME.wait
      @__page.execute_js(code)
    end
def js(code)
      XhrProxy.context = self
      @__page ||= Harmony::Page.new(XHR_MOCK_SCRIPT + rewrite_script_paths(@response.body.to_s))
      Harmony::Page::Window::BASE_RUNTIME.wait
      @__page.execute_js(code)
    end
def js ( code ) XhrProxy . context = self @__page ||= Harmony :: Page . new ( XHR_MOCK_SCRIPT + rewrite_script_paths ( @response . body . to_s ) ) Harmony :: Page :: Window :: BASE_RUNTIME . wait @__page . execute_js ( code ) end
Execute javascript within the context of a view.

 @example

     class PeopleControllerTest < ActionController::TestCase
       get :index
       assert_equal 'People: index', js('document.title')
     end

 @param [String]
   code javascript code to evaluate

 @return [Object]
   value of last javascript statement, cast to an equivalent ruby object

 @raise [Johnson::Error]
   javascript code exception
Execute javascript within the context of a view .