diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-09-03 17:04:28 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-09-03 17:04:28 +0000 |
commit | ca7498c2d6cc31176690b597dba10f7c853a8b57 (patch) | |
tree | be7b1c5e21e0b72b064373cda73557ef4f8ab8ba /test/functional/roles_controller_test.rb | |
parent | 1b64e4be5ea81389da7f10c5e76dfb3a504688a7 (diff) | |
download | redmine-ca7498c2d6cc31176690b597dba10f7c853a8b57.tar.gz redmine-ca7498c2d6cc31176690b597dba10f7c853a8b57.zip |
Create role by copy (#9258).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10285 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/roles_controller_test.rb')
-rw-r--r-- | test/functional/roles_controller_test.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/functional/roles_controller_test.rb b/test/functional/roles_controller_test.rb index 327fad512..868c987a6 100644 --- a/test/functional/roles_controller_test.rb +++ b/test/functional/roles_controller_test.rb @@ -46,6 +46,31 @@ class RolesControllerTest < ActionController::TestCase assert_template 'new' end + def test_new_with_copy + copy_from = Role.find(2) + + get :new, :copy => copy_from.id.to_s + assert_response :success + assert_template 'new' + + role = assigns(:role) + assert_equal copy_from.permissions, role.permissions + + assert_select 'form' do + # blank name + assert_select 'input[name=?][value=]', 'role[name]' + # edit_project permission checked + assert_select 'input[type=checkbox][name=?][value=edit_project][checked=checked]', 'role[permissions][]' + # add_project permission not checked + assert_select 'input[type=checkbox][name=?][value=add_project]', 'role[permissions][]' + assert_select 'input[type=checkbox][name=?][value=add_project][checked=checked]', 'role[permissions][]', 0 + # workflow copy selected + assert_select 'select[name=?]', 'copy_workflow_from' do + assert_select 'option[value=2][selected=selected]' + end + end + end + def test_create_with_validaton_failure post :create, :role => {:name => '', :permissions => ['add_issues', 'edit_issues', 'log_time', ''], |