mirror of
https://github.com/redmine/redmine.git
synced 2025-11-02 11:25:55 +01:00
shorten long line of test/unit/workflow_transition_test.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@20556 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -28,7 +28,8 @@ class WorkflowTransitionTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
def test_replace_transitions_should_create_enabled_transitions
|
||||
w = WorkflowTransition.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 2)
|
||||
w = WorkflowTransition.create!(:role_id => 1, :tracker_id => 1,
|
||||
:old_status_id => 1, :new_status_id => 2)
|
||||
|
||||
transitions = {'1' => {
|
||||
'2' => {'always' => '1'},
|
||||
@@ -37,12 +38,16 @@ class WorkflowTransitionTest < ActiveSupport::TestCase
|
||||
assert_difference 'WorkflowTransition.count' do
|
||||
WorkflowTransition.replace_transitions(Tracker.find(1), Role.find(1), transitions)
|
||||
end
|
||||
assert WorkflowTransition.where(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 3).exists?
|
||||
assert WorkflowTransition.where(:role_id => 1, :tracker_id => 1,
|
||||
:old_status_id => 1,
|
||||
:new_status_id => 3).exists?
|
||||
end
|
||||
|
||||
def test_replace_transitions_should_delete_disabled_transitions
|
||||
w1 = WorkflowTransition.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 2)
|
||||
w2 = WorkflowTransition.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 3)
|
||||
w1 = WorkflowTransition.create!(:role_id => 1, :tracker_id => 1,
|
||||
:old_status_id => 1, :new_status_id => 2)
|
||||
w2 = WorkflowTransition.create!(:role_id => 1, :tracker_id => 1,
|
||||
:old_status_id => 1, :new_status_id => 3)
|
||||
|
||||
transitions = {'1' => {
|
||||
'2' => {'always' => '0'},
|
||||
@@ -61,14 +66,17 @@ class WorkflowTransitionTest < ActiveSupport::TestCase
|
||||
assert_difference 'WorkflowTransition.count' do
|
||||
WorkflowTransition.replace_transitions(Tracker.find(1), Role.find(1), transitions)
|
||||
end
|
||||
w = WorkflowTransition.where(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 2).first
|
||||
w = WorkflowTransition.where(:role_id => 1, :tracker_id => 1,
|
||||
:old_status_id => 1, :new_status_id => 2).first
|
||||
assert w
|
||||
assert_equal false, w.assignee
|
||||
assert_equal true, w.author
|
||||
end
|
||||
|
||||
def test_replace_transitions_should_delete_disabled_additional_transitions
|
||||
w = WorkflowTransition.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 2, :assignee => true)
|
||||
w = WorkflowTransition.create!(:role_id => 1, :tracker_id => 1,
|
||||
:old_status_id => 1, :new_status_id => 2,
|
||||
:assignee => true)
|
||||
|
||||
transitions = {'1' => {
|
||||
'2' => {'always' => '0', 'assignee' => '0', 'author' => '0'}
|
||||
@@ -80,7 +88,9 @@ class WorkflowTransitionTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
def test_replace_transitions_should_update_additional_transitions
|
||||
WorkflowTransition.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 2, :assignee => true)
|
||||
WorkflowTransition.create!(:role_id => 1, :tracker_id => 1,
|
||||
:old_status_id => 1, :new_status_id => 2,
|
||||
:assignee => true)
|
||||
|
||||
transitions = {'1' => {
|
||||
'2' => {'always' => '0', 'assignee' => '0', 'author' => '1'}
|
||||
@@ -88,7 +98,8 @@ class WorkflowTransitionTest < ActiveSupport::TestCase
|
||||
assert_no_difference 'WorkflowTransition.count' do
|
||||
WorkflowTransition.replace_transitions(Tracker.find(1), Role.find(1), transitions)
|
||||
end
|
||||
w = WorkflowTransition.where(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 2).first
|
||||
w = WorkflowTransition.where(:role_id => 1, :tracker_id => 1,
|
||||
:old_status_id => 1, :new_status_id => 2).first
|
||||
assert w
|
||||
assert_equal false, w.assignee
|
||||
assert_equal true, w.author
|
||||
|
||||
Reference in New Issue
Block a user