code layout clean up test_new_statuses_allowed_to of unit issue test

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10643 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2012-10-13 10:53:05 +00:00
parent 7a162b7255
commit f76de605a0
1 changed files with 22 additions and 9 deletions

View File

@ -410,26 +410,39 @@ class IssueTest < ActiveSupport::TestCase
def test_new_statuses_allowed_to
WorkflowTransition.delete_all
WorkflowTransition.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 2, :author => false, :assignee => false)
WorkflowTransition.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 3, :author => true, :assignee => false)
WorkflowTransition.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 4, :author => false, :assignee => true)
WorkflowTransition.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 5, :author => true, :assignee => true)
WorkflowTransition.create!(:role_id => 1, :tracker_id => 1,
:old_status_id => 1, :new_status_id => 2,
:author => false, :assignee => false)
WorkflowTransition.create!(:role_id => 1, :tracker_id => 1,
:old_status_id => 1, :new_status_id => 3,
:author => true, :assignee => false)
WorkflowTransition.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1,
:new_status_id => 4, :author => false,
:assignee => true)
WorkflowTransition.create!(:role_id => 1, :tracker_id => 1,
:old_status_id => 1, :new_status_id => 5,
:author => true, :assignee => true)
status = IssueStatus.find(1)
role = Role.find(1)
tracker = Tracker.find(1)
user = User.find(2)
issue = Issue.generate!(:tracker => tracker, :status => status, :project_id => 1, :author_id => 1)
issue = Issue.generate!(:tracker => tracker, :status => status,
:project_id => 1, :author_id => 1)
assert_equal [1, 2], issue.new_statuses_allowed_to(user).map(&:id)
issue = Issue.generate!(:tracker => tracker, :status => status, :project_id => 1, :author => user)
issue = Issue.generate!(:tracker => tracker, :status => status,
:project_id => 1, :author => user)
assert_equal [1, 2, 3, 5], issue.new_statuses_allowed_to(user).map(&:id)
issue = Issue.generate!(:tracker => tracker, :status => status, :project_id => 1, :author_id => 1, :assigned_to => user)
issue = Issue.generate!(:tracker => tracker, :status => status,
:project_id => 1, :author_id => 1,
:assigned_to => user)
assert_equal [1, 2, 4, 5], issue.new_statuses_allowed_to(user).map(&:id)
issue = Issue.generate!(:tracker => tracker, :status => status, :project_id => 1, :author => user, :assigned_to => user)
issue = Issue.generate!(:tracker => tracker, :status => status,
:project_id => 1, :author => user,
:assigned_to => user)
assert_equal [1, 2, 3, 4, 5], issue.new_statuses_allowed_to(user).map(&:id)
end