1 require File.dirname(__FILE__) + '/../test_helper'
2 require 'states_controller'
4 # Re-raise errors caught by the controller.
5 class StatesController; def rescue_action(e) raise e end; end
7 class StatesControllerTest < Test::Unit::TestCase
11 @controller = StatesController.new
12 @request = ActionController::TestRequest.new
13 @response = ActionController::TestResponse.new
16 def test_should_get_index
18 assert_response :success
19 assert assigns(:states)
22 def test_should_get_new
24 assert_response :success
27 def test_should_create_state
28 assert_difference('State.count') do
29 post :create, :state => { }
32 assert_redirected_to state_path(assigns(:state))
35 def test_should_show_state
37 assert_response :success
40 def test_should_get_edit
42 assert_response :success
45 def test_should_update_state
46 put :update, :id => 1, :state => { }
47 assert_redirected_to state_path(assigns(:state))
50 def test_should_destroy_state
51 assert_difference('State.count', -1) do
52 delete :destroy, :id => 1
55 assert_redirected_to states_path