Add the has_many_polymorphs plugin
[cs356-p2-videostore.git] / vendor / plugins / has_many_polymorphs / test / integration / app / test / functional / states_controller_test.rb
1 require File.dirname(__FILE__) + '/../test_helper'
2 require 'states_controller'
3
4 # Re-raise errors caught by the controller.
5 class StatesController; def rescue_action(e) raise e end; end
6
7 class StatesControllerTest < Test::Unit::TestCase
8   fixtures :states
9
10   def setup
11     @controller = StatesController.new
12     @request    = ActionController::TestRequest.new
13     @response   = ActionController::TestResponse.new
14   end
15
16   def test_should_get_index
17     get :index
18     assert_response :success
19     assert assigns(:states)
20   end
21
22   def test_should_get_new
23     get :new
24     assert_response :success
25   end
26
27   def test_should_create_state
28     assert_difference('State.count') do
29       post :create, :state => { }
30     end
31
32     assert_redirected_to state_path(assigns(:state))
33   end
34
35   def test_should_show_state
36     get :show, :id => 1
37     assert_response :success
38   end
39
40   def test_should_get_edit
41     get :edit, :id => 1
42     assert_response :success
43   end
44
45   def test_should_update_state
46     put :update, :id => 1, :state => { }
47     assert_redirected_to state_path(assigns(:state))
48   end
49
50   def test_should_destroy_state
51     assert_difference('State.count', -1) do
52       delete :destroy, :id => 1
53     end
54
55     assert_redirected_to states_path
56   end
57 end