Merged r4645 to r4651 from trunk.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.1-stable@4660 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2011-01-08 10:14:00 +00:00
parent e5b7c94cb4
commit 6e695a4d1a
12 changed files with 224 additions and 65 deletions
+29 -2
View File
@@ -154,7 +154,8 @@ class ProjectsControllerTest < ActionController::TestCase
:custom_field_values => { '3' => 'Beta' },
:tracker_ids => ['1', '3'],
# an issue custom field that is not for all project
:issue_custom_field_ids => ['9']
:issue_custom_field_ids => ['9'],
:enabled_module_names => ['issue_tracking', 'news', 'repository']
}
assert_redirected_to '/projects/blog/settings'
@@ -167,6 +168,7 @@ class ProjectsControllerTest < ActionController::TestCase
assert_nil project.parent
assert_equal 'Beta', project.custom_value_for(3).value
assert_equal [1, 3], project.trackers.map(&:id).sort
assert_equal ['issue_tracking', 'news', 'repository'], project.enabled_module_names.sort
assert project.issue_custom_fields.include?(IssueCustomField.find(9))
end
@@ -197,7 +199,9 @@ class ProjectsControllerTest < ActionController::TestCase
:description => "weblog",
:identifier => "blog",
:is_public => 1,
:custom_field_values => { '3' => 'Beta' }
:custom_field_values => { '3' => 'Beta' },
:tracker_ids => ['1', '3'],
:enabled_module_names => ['issue_tracking', 'news', 'repository']
}
assert_redirected_to '/projects/blog/settings'
@@ -206,6 +210,8 @@ class ProjectsControllerTest < ActionController::TestCase
assert_kind_of Project, project
assert_equal 'weblog', project.description
assert_equal true, project.is_public?
assert_equal [1, 3], project.trackers.map(&:id).sort
assert_equal ['issue_tracking', 'news', 'repository'], project.enabled_module_names.sort
# User should be added as a project member
assert User.find(9).member_of?(project)
@@ -282,6 +288,12 @@ class ProjectsControllerTest < ActionController::TestCase
end
end
def test_create_should_not_accept_get
@request.session[:user_id] = 1
get :create
assert_response :method_not_allowed
end
def test_show_by_id
get :show, :id => 1
assert_response :success
@@ -359,6 +371,21 @@ class ProjectsControllerTest < ActionController::TestCase
project = Project.find(1)
assert_equal 'Test changed name', project.name
end
def test_modules
@request.session[:user_id] = 2
Project.find(1).enabled_module_names = ['issue_tracking', 'news']
post :modules, :id => 1, :enabled_module_names => ['issue_tracking', 'repository', 'documents']
assert_redirected_to '/projects/ecookbook/settings/modules'
assert_equal ['documents', 'issue_tracking', 'repository'], Project.find(1).enabled_module_names.sort
end
def test_modules_should_not_allow_get
@request.session[:user_id] = 1
get :modules, :id => 1
assert_response :method_not_allowed
end
def test_get_destroy
@request.session[:user_id] = 1 # admin