diff options
author | Go MAEDA <maeda@farend.jp> | 2024-12-04 01:47:46 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2024-12-04 01:47:46 +0000 |
commit | 2f5d5432342aa80b4bde06f965740df33dfc904d (patch) | |
tree | e9956c7fe2240fd676b6feda0cf14114c076a685 | |
parent | 12bc103ba1ba2ec6df26a92a901ee8f76fd28dca (diff) | |
download | redmine-2f5d5432342aa80b4bde06f965740df33dfc904d.tar.gz redmine-2f5d5432342aa80b4bde06f965740df33dfc904d.zip |
Fix random failures in IssueRelationTest#test_create_with_initialized_journals due to ambiguous conditions for retrieving the expected detail (#41931).
Patch by Katsuya HIDAKA (user:hidakatsuya).
git-svn-id: https://svn.redmine.org/redmine/trunk@23350 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | test/unit/issue_relation_test.rb | 34 |
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 |