diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2013-05-19 02:09:39 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2013-05-19 02:09:39 +0000 |
commit | 1f9e1ca3181b77388e88456354c72b2d85c080a3 (patch) | |
tree | 4bb47d64b792759dfa553e8e5210c32c7f6943b4 /test/unit/issue_relation_test.rb | |
parent | e5e73a56a76d1da8cd5455f29e48ded7c0581e5f (diff) | |
download | redmine-1f9e1ca3181b77388e88456354c72b2d85c080a3.tar.gz redmine-1f9e1ca3181b77388e88456354c72b2d85c080a3.zip |
add journal after creating/deleting issue relation (#1005)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11885 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/issue_relation_test.rb')
-rw-r--r-- | test/unit/issue_relation_test.rb | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/test/unit/issue_relation_test.rb b/test/unit/issue_relation_test.rb index f0e74faf7..1b76056ee 100644 --- a/test/unit/issue_relation_test.rb +++ b/test/unit/issue_relation_test.rb @@ -167,4 +167,49 @@ class IssueRelationTest < ActiveSupport::TestCase assert !r.save assert_not_nil r.errors[:base] end + + def test_create_should_make_journal_entry + 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) + 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 'label_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 'label_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 + end + + def test_delete_should_make_journal_entry + relation = IssueRelation.find(1) + id = relation.id + from = relation.issue_from + to = relation.issue_to + from_journals = from.journals.size + to_journals = to.journals.size + assert relation.destroy + from.reload + to.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 'label_blocks', from.journals.last.details.last.prop_key + assert_equal '9', from.journals.last.details.last.old_value + assert_nil from.journals.last.details.last.value + assert_equal 'relation', to.journals.last.details.last.property + assert_equal 'label_blocked_by', to.journals.last.details.last.prop_key + assert_equal '10', to.journals.last.details.last.old_value + assert_nil to.journals.last.details.last.value + end end |