require File.dirname(__FILE__) + '/../test_helper' require 'navexample_controller' # Re-raise errors caught by the controller. class NavexampleController; def rescue_action(e) raise e end; end class NavexampleControllerTest < Test::Unit::TestCase def setup @controller = NavexampleController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new end def test_index get 'index' assert_redirected_to :action => 'home1' end def test_home1 get 'home1' assert_response :success assert_template 'home1' assert_equal :home1, nav_state[:homepage] end def test_home2 get 'home2' assert_response :success assert_template 'home2' assert_equal :home2, nav_state[:homepage] end def test_invalidate_home get 'invalidate_home' assert_redirected_to :action => 'page1' assert_nil nav_state[:homepage] end def test_page1 get 'page1' assert_response :success assert_template 'page1' end def test_page2 get 'page2' assert_response :success assert_template 'page2' end end