= XPath & JavaScript Assertions
(aka YarWiki[http://www.oreilly.com/catalog/9780596510657/])
This plugin adds the following test features to a Rails project:
- assert_xpath - like assert_select or assert_tag for XML and XHTML
- assert_javascript - parses your JavaScript and asserts its features
- assert_ajax - a lite, optional Wiki that tests Rails Ajax in vivo
At press time, assert_xpath's source is not on
RubyForge[http://rubyforge.org/projects/assertxpath/].
Only its documentation is!
== To Install
Don't use svn:externals: script/plugin install -x
svn:externals is for sharing code between projects within your own shop. Use piston[http://piston.rubyforge.org/]:
piston import http://phlip.svnrepository.com/svn/yar_wiki/ vendor/plugins/yar_wiki
The AssertJavaScript methods require Javascript::PurePerl.
See {Javascript::PurePerl for Ruby Enthusiasts}[http://phlip.eblogs.com/2007/07/28/javascriptpureperl-for-ruby-enthusiasts/]
to learn to install it.
== To Use
Currently used with both Rails 1.1.6 and 1.2.3.
ERGO document
== To Test
Add the arts and form_test_helper plugins:
script/plugin install -x http://form-test-helper.googlecode.com/svn/form_test_helper/
script/plugin install -x http://thar.be/svn/projects/plugins/arts/
Some Railses also need the assert_select plugin first:
script/plugin install -x http://labnotes.org/svn/public/ruby/rails_plugins/assert_select
Then hit:
script/plugin install -x http://phlip.svnrepository.com/svn/yar_wiki/
That gives you assert_xml and assert_xpath, automatically.
If you install Perl and Javascript::PurePerl, you also get assert_javascript.
They are not required to activate the Wiki, or to run its private tests.
TO ACTIVATE
Generate a new controller,
script/generate controller my_wiki
and add this line:
class MyWikiController < ApplicationController
include YarWikiActions
end
Tip: Don't write Wiki pages named TestWiki or WikiTestPage. They are
reserved for the Wiki's private tests.
Tip: YarWiki permits any user to create any Ruby statement.
Do not allow untrusted environments (such as the open internet)
to access the YarWiki actions.
Then add the file wiki/FrontPage.yaml and put well-formed YAML in it.
TO TEST
Read "Test Driven Ajax", from XXX at O'Reilly, and install
FormTestHelper and ARTS like this:
script/plugin install -x http://form-test-helper.googlecode.com/svn/form_test_helper/
script/plugin install -x http://thar.be/svn/projects/plugins/arts/
Then get into the folder vendor/plugins/yar_wiki and enter 'rake'