I was wondering if any one can share some samples of test code that
tests ActiveScaffold?
Thanks
You beat me to it, but I would also like to see some example of
functional testing please (just to get a leg up to understand how to get
started)
Cheers
Ed W
{{{
def test_create
group_role_count = GroupRole.find(:all).length
post :create, {"commit" => "Create", :record =>
{"role"=>{"id"=>"3"}, "group"=>{ "id"=>"3"}} }
assert_not_nil assigns("record")
assert_response :redirect
assert_equal group_role_count + 1, GroupRole.find(:all).length,
"Expected an additional GroupRole"
end
}}}
Key was the "commit" setting (at least for me) , if not it returns the
form for creating a new record.
Easy way that I used to identify how to set the parameters is to do it
manually and look at the development.log
Not exactly related but this rake task greatly improved the debugging.
It allows running of a particular test in the specified controller
test suite
http://nubyonrails.com/articles/2006/07/28/foscon-and-living-dangerously-with-rake
ActiveScaffold / Rails / Ruby rocks!