1 require File.dirname(__FILE__) + '/../test_helper'
2 require 'gamegenre_controller'
4 # Re-raise errors caught by the controller.
5 class GamegenreController; def rescue_action(e) raise e end; end
7 class GamegenreControllerTest < Test::Unit::TestCase
11 @controller = GamegenreController.new
12 @request = ActionController::TestRequest.new
13 @response = ActionController::TestResponse.new
15 @first_id = gamegenres(:first).id
20 assert_response :success
21 assert_template 'list'
27 assert_response :success
28 assert_template 'list'
30 assert_not_nil assigns(:gamegenres)
34 get :show, :id => @first_id
36 assert_response :success
37 assert_template 'show'
39 assert_not_nil assigns(:gamegenre)
40 assert assigns(:gamegenre).valid?
46 assert_response :success
49 assert_not_nil assigns(:gamegenre)
53 num_gamegenres = Gamegenre.count
55 post :create, :gamegenre => {}
57 assert_response :redirect
58 assert_redirected_to :action => 'list'
60 assert_equal num_gamegenres + 1, Gamegenre.count
64 get :edit, :id => @first_id
66 assert_response :success
67 assert_template 'edit'
69 assert_not_nil assigns(:gamegenre)
70 assert assigns(:gamegenre).valid?
74 post :update, :id => @first_id
75 assert_response :redirect
76 assert_redirected_to :action => 'show', :id => @first_id
80 assert_nothing_raised {
81 Gamegenre.find(@first_id)
84 post :destroy, :id => @first_id
85 assert_response :redirect
86 assert_redirected_to :action => 'list'
88 assert_raise(ActiveRecord::RecordNotFound) {
89 Gamegenre.find(@first_id)