Active Test plugin
Plugin details
Documentation
Install the plugin:
ruby script/plugin install http://mabs29.googlecode.com/svn/trunk/plugins/active_test
The following test case is a real example from ActiveTest's self-tests.
class ArticlesControllerTest < ActiveTest::Controller fixtures :articles # Each Subject has a setup class method, some of which take options setup # Most dynamic methods default to a convention succeeds_on :index assigns_records_on :index succeeds_on :new assigns_records_on :new # Options may be given. succeeds_on :show, :parameters => { :id => 1 } assigns_records_on :show, :parameters => { :id => 1 } fails_on :show, :parameters => { :id => 19361 } # Many options are flexible. Here, you can set parameters to a method or proc which is # evaluated in the instance scope (Note: it is defined in the class scope). succeeds_on :create, :parameters => :a_good_article creates_record_on :create, :parameters => :a_good_article fails_on :create, :parameters => proc { a_good_article[:article].merge(:body => nil) } succeeds_on :edit, :parameters => proc {{ :id => articles(:nice_article).id }} fails_on :edit, :parameters => { :id => 19361 } # shortcutting a proc which is reused @update_proc = proc {{ :id => articles(:nice_article).id, :article => { :body => "splat" } }} succeeds_on :update, :parameters => @update_proc updates_record_on :update, :parameters => @update_proc fails_on :update, :parameters => { :id => 19361 } record_unchanged_on :update, :parameters => { :id => 19361 } succeeds_on :destroy, :parameters => proc {{ :id => articles(:nice_article).id }} deletes_record_on :destroy, :parameters => proc {{ :id => articles(:nice_article).id }} fails_on :destroy, { :id => 19361 } succeeds_on :empty_collector assigns_empty_on :empty_collector protected # return a hash for parameters def a_good_article {:article => { :title => "And now...", :body => "for something completely different" }} end end
Further Documentation
There is currently no advanced documentation for this plugin.
New documentationEdit plugin | (0 older versions) | Last edited by: hardway, about 1 year ago

