1 require File.dirname(__FILE__) + '/../test_helper'
2 require 'videogenre_controller'
4 # Re-raise errors caught by the controller.
5 class VideogenreController; def rescue_action(e) raise e end; end
7 class VideogenreControllerTest < Test::Unit::TestCase
11 @controller = VideogenreController.new
12 @request = ActionController::TestRequest.new
13 @response = ActionController::TestResponse.new
15 @first_id = videogenres(:first).id
20 assert_response :success
21 assert_template 'list'
27 assert_response :success
28 assert_template 'list'
30 assert_not_nil assigns(:videogenres)
34 get :show, :id => @first_id
36 assert_response :success
37 assert_template 'show'
39 assert_not_nil assigns(:videogenre)
40 assert assigns(:videogenre).valid?
46 assert_response :success
49 assert_not_nil assigns(:videogenre)
53 num_videogenres = Videogenre.count
55 post :create, :videogenre => {}
57 assert_response :redirect
58 assert_redirected_to :action => 'list'
60 assert_equal num_videogenres + 1, Videogenre.count
64 get :edit, :id => @first_id
66 assert_response :success
67 assert_template 'edit'
69 assert_not_nil assigns(:videogenre)
70 assert assigns(:videogenre).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 Videogenre.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 Videogenre.find(@first_id)