summaryrefslogtreecommitdiffstats
path: root/test/unit/changeset_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-04-12 09:16:54 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-04-12 09:16:54 +0000
commit78153cacdf3de97bc58bdc7fb57010a2d9874f34 (patch)
treee2b301afd3b716180b53eeb039f3c14d4bb9c72f /test/unit/changeset_test.rb
parentcb9d405db3ba4b2ec772a0c67dd8f45e192f01b0 (diff)
downloadredmine-78153cacdf3de97bc58bdc7fb57010a2d9874f34.tar.gz
redmine-78153cacdf3de97bc58bdc7fb57010a2d9874f34.zip
Keywords in commit messages: journal entries are created even if nothing was changed (#19538).
git-svn-id: http://svn.redmine.org/redmine/trunk@14164 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/changeset_test.rb')
-rw-r--r--test/unit/changeset_test.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/unit/changeset_test.rb b/test/unit/changeset_test.rb
index 7cbc33f11..8c0611e45 100644
--- a/test/unit/changeset_test.rb
+++ b/test/unit/changeset_test.rb
@@ -163,6 +163,30 @@ class ChangesetTest < ActiveSupport::TestCase
assert_equal [1,2,3], c.issue_ids.sort
end
+ def test_update_keywords_with_changes_should_create_journal
+ issue = Issue.generate!(:project_id => 1, :status_id => 1)
+
+ with_settings :commit_update_keywords => [{'keywords' => 'fixes', 'status_id' => '3'}] do
+ assert_difference 'Journal.count' do
+ c = Changeset.generate!(:repository => Project.find(1).repository,:comments => "Fixes ##{issue.id}")
+ assert_include c.id, issue.reload.changeset_ids
+ journal = Journal.order('id DESC').first
+ assert_equal 1, journal.details.count
+ end
+ end
+ end
+
+ def test_update_keywords_without_change_should_not_create_journal
+ issue = Issue.generate!(:project_id => 1, :status_id => 3)
+
+ with_settings :commit_update_keywords => [{'keywords' => 'fixes', 'status_id' => '3'}] do
+ assert_no_difference 'Journal.count' do
+ c = Changeset.generate!(:repository => Project.find(1).repository,:comments => "Fixes ##{issue.id}")
+ assert_include c.id, issue.reload.changeset_ids
+ end
+ end
+ end
+
def test_update_keywords_with_multiple_rules
with_settings :commit_update_keywords => [
{'keywords' => 'fixes, closes', 'status_id' => '5'},