58 lines
1.4 KiB
Ruby
58 lines
1.4 KiB
Ruby
require File.dirname(__FILE__) + '/../test_helper'
|
|
require 'utilisateurs_controller'
|
|
|
|
# Re-raise errors caught by the controller.
|
|
class UtilisateursController; def rescue_action(e) raise e end; end
|
|
|
|
class UtilisateursControllerTest < Test::Unit::TestCase
|
|
fixtures :utilisateurs
|
|
|
|
def setup
|
|
@controller = UtilisateursController.new
|
|
@request = ActionController::TestRequest.new
|
|
@response = ActionController::TestResponse.new
|
|
end
|
|
|
|
def test_should_get_index
|
|
get :index
|
|
assert_response :success
|
|
assert assigns(:utilisateurs)
|
|
end
|
|
|
|
def test_should_get_new
|
|
get :new
|
|
assert_response :success
|
|
end
|
|
|
|
def test_should_create_utilisateur
|
|
old_count = Utilisateur.count
|
|
post :create, :utilisateur => { }
|
|
assert_equal old_count+1, Utilisateur.count
|
|
|
|
assert_redirected_to utilisateur_path(assigns(:utilisateur))
|
|
end
|
|
|
|
def test_should_show_utilisateur
|
|
get :show, :id => 1
|
|
assert_response :success
|
|
end
|
|
|
|
def test_should_get_edit
|
|
get :edit, :id => 1
|
|
assert_response :success
|
|
end
|
|
|
|
def test_should_update_utilisateur
|
|
put :update, :id => 1, :utilisateur => { }
|
|
assert_redirected_to utilisateur_path(assigns(:utilisateur))
|
|
end
|
|
|
|
def test_should_destroy_utilisateur
|
|
old_count = Utilisateur.count
|
|
delete :destroy, :id => 1
|
|
assert_equal old_count-1, Utilisateur.count
|
|
|
|
assert_redirected_to utilisateurs_path
|
|
end
|
|
end
|