I think I have a handle on Unit testing and have set up tests for approximately 20 of my models. I'm now fooling with Controller testing and still following the AWDWR book with some success.
I have a Role Based Access Control system...pretty much conceived from Chad Fowler's Rails Recipes that I've been using for some time now and I can login and pass the following assertions...
assert_redirected_to :controller => 'main_tabnav' # the redirect from a successful login assert_not_nil(session[:user_id]) user = User.find(session[:user_id]) assert_equal 'Low Level User', user.name
So I've created 3 Users in users.yml which will give me 3 levels of RBAC testing and created the roles_users.yml One of my main purposes for doing integrated testing is to test out my users/rights/roles mechanics since I now have over 1500 'rights' and 60 'roles'
My question is one of practical design...
If I want to set up controller tests for which I can plug in 3 different users and obviously anticipate different results for each user, how can I accomplish this without creating 3 different test sets for each controller?
Craig