Adds functional tests.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8947 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-02-23 14:26:30 +00:00
parent 95811c8e4c
commit e6a64aa00b
2 changed files with 15 additions and 0 deletions

View File

@ -39,6 +39,11 @@ class EnumerationsControllerTest < ActionController::TestCase
assert_tag 'input', :attributes => {:name => 'enumeration[name]'} assert_tag 'input', :attributes => {:name => 'enumeration[name]'}
end end
def test_new_with_invalid_type_should_respond_with_404
get :new, :type => 'UnknownType'
assert_response 404
end
def test_create def test_create
assert_difference 'IssuePriority.count' do assert_difference 'IssuePriority.count' do
post :create, :enumeration => {:type => 'IssuePriority', :name => 'Lowest'} post :create, :enumeration => {:type => 'IssuePriority', :name => 'Lowest'}
@ -63,6 +68,11 @@ class EnumerationsControllerTest < ActionController::TestCase
assert_tag 'input', :attributes => {:name => 'enumeration[name]', :value => 'High'} assert_tag 'input', :attributes => {:name => 'enumeration[name]', :value => 'High'}
end end
def test_edit_invalid_should_respond_with_404
get :edit, :id => 999
assert_response 404
end
def test_update def test_update
assert_no_difference 'IssuePriority.count' do assert_no_difference 'IssuePriority.count' do
put :update, :id => 6, :enumeration => {:type => 'IssuePriority', :name => 'New name'} put :update, :id => 6, :enumeration => {:type => 'IssuePriority', :name => 'New name'}

View File

@ -84,6 +84,11 @@ class RolesControllerTest < ActionController::TestCase
assert_equal Role.find(1), assigns(:role) assert_equal Role.find(1), assigns(:role)
end end
def test_edit_invalid_should_respond_with_404
get :edit, :id => 999
assert_response 404
end
def test_update def test_update
put :update, :id => 1, put :update, :id => 1,
:role => {:name => 'Manager', :role => {:name => 'Manager',