I am happy to announce the release of ARID 0.4.
ARID stands for Active Resource Integration DSL. It provides a means
for easily writing Integration tests for conventional RESTful Rails
applications.
For instance, this test…
new_session_as(‘bob’,‘bobs_password’) do |bob|
bob.edits_article(1,:params => {:subject => ‘Hello World’, :body =>
‘Testing 123’})
end
… will
* Login to the application as 'bob'
* GET edit_article_path(1)
* Check that the response includes a form will POST to
article_path(1)
* Check that the form contains a hidden field named ‘_method’ with a
value of ‘put’
* Check that the form contains appropriate fields for the user to
input ‘article[subject]’ and ‘article[body]’
* Submit the form and assert a redirect
* Follow the redirect and assert a success
All methods take blocks to provide your own custom assertions, and
options to modify behavior.
One major assumption ARID makes is that your users login through a
SessionsController that accepts :username and :password params. This
can be easily changed by overriding new_session_as with your own method
to get users logged in. (I’m actually doing this on one application.)
I’ve been using ARID on several production Rails apps, one of which is
on Rails2.0 PR.
Complete documentation is available at http://arid.rubyforge.org/
Two major goals for future versions are…
* Convert it to a gem instead of a plugin. From what I've read, this
doesn't look to difficult, but if anybody has any suggestions or
pitfall warnings, I'm listening.
* Add appropriate tests to test ARID itself. I assume this will
require some mocking which I've done very little of. Any advice
would be greatly appreciated. Even better would be a patch that
includes the first couple passing tests to get me moving in the
right direction.
Of course, all feedback is welcome and encouraged.
Enjoy!