diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-02-28 09:21:12 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-02-28 09:21:12 +0000 |
commit | 02cc0efdd7b9d10e12a9a335befdab4d4458d4a3 (patch) | |
tree | 1dd72ba63a715d75f0441270a3fe796544edd091 /test | |
parent | 26e9a0d919122a2bbf150c96fe68b697011f808a (diff) | |
download | redmine-02cc0efdd7b9d10e12a9a335befdab4d4458d4a3.tar.gz redmine-02cc0efdd7b9d10e12a9a335befdab4d4458d4a3.zip |
Fixed: journal details duplicated when an issue is saved twice (#3690).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3499 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/issue_test.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb index 86d3e2455..8df0d1e2a 100644 --- a/test/unit/issue_test.rb +++ b/test/unit/issue_test.rb @@ -529,6 +529,32 @@ class IssueTest < ActiveSupport::TestCase end assert ActionMailer::Base.deliveries.empty? end + + def test_saving_twice_should_not_duplicate_journal_details + i = Issue.find(:first) + i.init_journal(User.find(2), 'Some notes') + # 2 changes + i.subject = 'New subject' + i.done_ratio = i.done_ratio + 10 + assert_difference 'Journal.count' do + assert_difference 'JournalDetail.count', 2 do + assert i.save + end + end + # 1 more change + i.priority = IssuePriority.find(:first, :conditions => ["id <> ?", i.priority_id]) + assert_no_difference 'Journal.count' do + assert_difference 'JournalDetail.count', 1 do + i.save + end + end + # no more change + assert_no_difference 'Journal.count' do + assert_no_difference 'JournalDetail.count' do + i.save + end + end + end context "#done_ratio" do setup do |