
https://svn.lrde.epita.fr/svn/ranch/trunk Index: ChangeLog from Nicolas Despr�s <nicolas.despres@gmail.com> Test systems controller requests. * web/ranch/test/functional/systems_controller_test.rb: Test index and list request. * web/ranch/app/controllers/systems_controller.rb: Redirect to list rather than to call list and render using its template. app/controllers/systems_controller.rb | 3 +-- test/functional/systems_controller_test.rb | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) Index: web/ranch/test/functional/systems_controller_test.rb --- web/ranch/test/functional/systems_controller_test.rb (revision 55) +++ web/ranch/test/functional/systems_controller_test.rb (working copy) @@ -5,14 +5,26 @@ class SystemsController; def rescue_action(e) raise e end; end class SystemsControllerTest < Test::Unit::TestCase + fixtures :systems + def setup @controller = SystemsController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new end - # Replace this with your real tests. - def test_truth - assert true + def test_index + get :index + assert_response :redirect + assert_redirected_to(:action => 'list') end + + def test_list + get :list + assert_response :success + assert_template 'list' + + assert_not_nil assigns(:systems) + end + end Index: web/ranch/app/controllers/systems_controller.rb --- web/ranch/app/controllers/systems_controller.rb (revision 55) +++ web/ranch/app/controllers/systems_controller.rb (working copy) @@ -3,8 +3,7 @@ layout 'systems' def index - list - render :action => 'list' + redirect_to :action => 'list' end def list