diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-03-20 17:37:04 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-03-20 17:37:04 +0000 |
commit | e584ae220da7fa15d089889d4db066b73e8f7da6 (patch) | |
tree | 08214309ab43953e1a0f28a38342691bd07e7002 /test/functional/issues_controller_test.rb | |
parent | 533590c29cf3d22cd95975ad6d61c2c1bf70235d (diff) | |
download | redmine-e584ae220da7fa15d089889d4db066b73e8f7da6.tar.gz redmine-e584ae220da7fa15d089889d4db066b73e8f7da6.zip |
Cleans up status assignment in IssuesController#new handled by Issue#safe_attributes= now.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3606 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/issues_controller_test.rb')
-rw-r--r-- | test/functional/issues_controller_test.rb | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 11d35f500..23d09152c 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -451,6 +451,7 @@ class IssuesControllerTest < ActionController::TestCase assert_difference 'Issue.count' do post :new, :project_id => 1, :issue => {:tracker_id => 3, + :status_id => 2, :subject => 'This is the test_new issue', :description => 'This is the description', :priority_id => 5, @@ -463,6 +464,7 @@ class IssuesControllerTest < ActionController::TestCase assert_not_nil issue assert_equal 2, issue.author_id assert_equal 3, issue.tracker_id + assert_equal 2, issue.status_id assert_nil issue.estimated_hours v = issue.custom_values.find(:first, :conditions => {:custom_field_id => 2}) assert_not_nil v @@ -598,6 +600,47 @@ class IssuesControllerTest < ActionController::TestCase end end + context "without workflow privilege" do + setup do + Workflow.delete_all(["role_id = ?", Role.anonymous.id]) + Role.anonymous.add_permission! :add_issues + end + + context "#new" do + should "propose default status only" do + get :new, :project_id => 1 + assert_response :success + assert_template 'new' + assert_tag :tag => 'select', + :attributes => {:name => 'issue[status_id]'}, + :children => {:count => 1}, + :child => {:tag => 'option', :attributes => {:value => IssueStatus.default.id.to_s}} + end + + should "accept default status" do + assert_difference 'Issue.count' do + post :new, :project_id => 1, + :issue => {:tracker_id => 1, + :subject => 'This is an issue', + :status_id => 1} + end + issue = Issue.last(:order => 'id') + assert_equal IssueStatus.default, issue.status + end + + should "ignore unauthorized status" do + assert_difference 'Issue.count' do + post :new, :project_id => 1, + :issue => {:tracker_id => 1, + :subject => 'This is an issue', + :status_id => 3} + end + issue = Issue.last(:order => 'id') + assert_equal IssueStatus.default, issue.status + end + end + end + def test_copy_issue @request.session[:user_id] = 2 get :new, :project_id => 1, :copy_from => 1 |