summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2024-12-08 04:58:05 +0000
committerGo MAEDA <maeda@farend.jp>2024-12-08 04:58:05 +0000
commitc6bee228bb649f7e598fc9ed5e908d422e792c8d (patch)
tree89a10bb9a1e6e8dbfa6f858b5adf94989c657390
parent66d0b7beba0c4912d0d284aa7ce1bc908b8d3d1f (diff)
downloadredmine-c6bee228bb649f7e598fc9ed5e908d422e792c8d.tar.gz
redmine-c6bee228bb649f7e598fc9ed5e908d422e792c8d.zip
Merged r23350 from trunk to 5.1-stable (#41931).
git-svn-id: https://svn.redmine.org/redmine/branches/5.1-stable@23356 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--test/unit/issue_relation_test.rb34
1 files changed, 18 insertions, 16 deletions
diff --git a/test/unit/issue_relation_test.rb b/test/unit/issue_relation_test.rb
index a223fe42c..198dd94ad 100644
--- a/test/unit/issue_relation_test.rb
+++ b/test/unit/issue_relation_test.rb
@@ -202,25 +202,27 @@ class IssueRelationTest < ActiveSupport::TestCase
def test_create_with_initialized_journals_should_create_journals
from = Issue.find(1)
to = Issue.find(2)
- from_journals = from.journals.size
- to_journals = to.journals.size
relation = IssueRelation.new(:issue_from => from, :issue_to => to,
:relation_type => IssueRelation::TYPE_PRECEDES)
relation.init_journals User.find(1)
- assert relation.save
- from.reload
- to.reload
- relation.reload
- assert_equal from.journals.size, (from_journals + 1)
- assert_equal to.journals.size, (to_journals + 1)
- assert_equal 'relation', from.journals.last.details.last.property
- assert_equal 'precedes', from.journals.last.details.last.prop_key
- assert_equal '2', from.journals.last.details.last.value
- assert_nil from.journals.last.details.last.old_value
- assert_equal 'relation', to.journals.last.details.last.property
- assert_equal 'follows', to.journals.last.details.last.prop_key
- assert_equal '1', to.journals.last.details.last.value
- assert_nil to.journals.last.details.last.old_value
+
+ assert_difference(
+ ->{ from.reload.journals.size } => +1,
+ ->{ to.reload.journals.size } => +1
+ ) do
+ assert relation.save
+ end
+
+ from.journals.last.details.then do |details|
+ assert details.exists?(property: 'relation', prop_key: 'precedes', value: '2')
+ end
+
+ to.journals.last.details.then do |details|
+ assert_equal 3, details.count
+ assert details.exists?(property: 'relation', prop_key: 'follows', value: '1', old_value: nil)
+ assert details.exists?(property: 'attr', prop_key: 'due_date')
+ assert details.exists?(property: 'attr', prop_key: 'start_date')
+ end
end
def test_destroy_with_initialized_journals_should_create_journals