IntroductionRails and RCor can play together as of RCor 0.9.5. Just use "include ConcordionTestMethods" and subclass one of the rails base test classes. Here's an example that shows how to drive ActionController::IntegrationTest. example_integration.html<html xmlns:concordion="http://www.concordion.org/2007/concordion">
<body>
<H1>Goodspeed IT Site Spec</H1>
The site should <span concordion:execute="display_page">display</span> these links on each page:
<table>
<tr>
<th concordion:assertTrue="has_link_to(#TEXT)">Link Name</th>
</tr>
<tr><td>About</td></tr>
<tr><td>Services</td></tr>
<tr><td>Portfolio</td></tr>
<tr><td>Offers</td></tr>
<tr><td>Contact</td></tr>
</table>
There should be <span concordion:assertEquals="count_links">6</span> links total.<br/>
<br/>
</body>
</html>example_integration_test.rbrequire 'test_helper'
require 'rcor'
require 'concordion_test_methods'
class GoodspeedRcorTest < ActionController::IntegrationTest
include ConcordionTestMethods
def display_page
get "/goodspeed"
end
def count_links
html_document.find_all(:tag => "a").size
end
def has_link_to(what)
links = html_document.find_all(:tag => "a", :content => what)
links.size > 0
end
endIntegration into BuildThis is a matter of style and personal preference. One DRY way to do it is create a directory under "test/" such as "rcor_specs/" to contain the RCor HTML specs, and place the fixtures in the appropriate rails directory for the level of behavior they describe. That is: in "functional/", "unit/" or "integration/". $ mkdir test/rcor_specs
$ <create the spec. e.g. test/rcor_specs/foo_integration.html >
$ <create the fixture. e.g. test/integration/foo_integration_test.rb > Then make sure all your tests can find the specs (that is: put the "rcor_specs" directory on the load path). I chose to add it to "test/test_helper.rb" as such: $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "/rcor_specs")) Then you can run your specs with your build as usual by invoking rake, and your test output will be created in the RCOR_OUTPUT_DIRECTORY (defaults to the current directory). $ rake
$ <examine the report output, e.g. ./foo_integration_test_output.html > Hope this helps!
|