mirror of
https://github.com/redmine/redmine.git
synced 2025-12-23 00:40:27 +01:00
Ability to define commit keywords per tracker (#7590).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12208 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -31,7 +31,7 @@ class ChangesetTest < ActiveSupport::TestCase
|
||||
def test_ref_keywords_any
|
||||
ActionMailer::Base.deliveries.clear
|
||||
Setting.commit_ref_keywords = '*'
|
||||
Setting.commit_update_keywords = {'fixes , closes' => {'status_id' => '5', 'done_ratio' => '90'}}
|
||||
Setting.commit_update_keywords = [{'keywords' => 'fixes , closes', 'status_id' => '5', 'done_ratio' => '90'}]
|
||||
|
||||
c = Changeset.new(:repository => Project.find(1).repository,
|
||||
:committed_on => Time.now,
|
||||
@@ -111,11 +111,7 @@ class ChangesetTest < ActiveSupport::TestCase
|
||||
|
||||
def test_ref_keywords_closing_with_timelog
|
||||
Setting.commit_ref_keywords = '*'
|
||||
Setting.commit_update_keywords = {
|
||||
'fixes , closes' => {
|
||||
'status_id' => IssueStatus.where(:is_closed => true).first.id.to_s
|
||||
}
|
||||
}
|
||||
Setting.commit_update_keywords = [{'keywords' => 'fixes , closes', 'status_id' => IssueStatus.where(:is_closed => true).first.id.to_s}]
|
||||
Setting.commit_logtime_enabled = '1'
|
||||
|
||||
c = Changeset.new(:repository => Project.find(1).repository,
|
||||
@@ -165,20 +161,45 @@ class ChangesetTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
def test_update_keywords_with_multiple_rules
|
||||
Setting.commit_update_keywords = {
|
||||
'fixes, closes' => {'status_id' => '5'},
|
||||
'resolves' => {'status_id' => '3'}
|
||||
}
|
||||
issue1 = Issue.generate!
|
||||
issue2 = Issue.generate!
|
||||
with_settings :commit_update_keywords => [
|
||||
{'keywords' => 'fixes, closes', 'status_id' => '5'},
|
||||
{'keywords' => 'resolves', 'status_id' => '3'}
|
||||
] do
|
||||
|
||||
c = Changeset.new(:repository => Project.find(1).repository,
|
||||
:committed_on => Time.now,
|
||||
:comments => "Closes ##{issue1.id}\nResolves ##{issue2.id}",
|
||||
:revision => '12345')
|
||||
assert c.save
|
||||
assert_equal 5, issue1.reload.status_id
|
||||
assert_equal 3, issue2.reload.status_id
|
||||
issue1 = Issue.generate!
|
||||
issue2 = Issue.generate!
|
||||
Changeset.generate!(:comments => "Closes ##{issue1.id}\nResolves ##{issue2.id}")
|
||||
assert_equal 5, issue1.reload.status_id
|
||||
assert_equal 3, issue2.reload.status_id
|
||||
end
|
||||
end
|
||||
|
||||
def test_update_keywords_with_multiple_rules_should_match_tracker
|
||||
with_settings :commit_update_keywords => [
|
||||
{'keywords' => 'fixes', 'status_id' => '5', 'if_tracker_id' => '2'},
|
||||
{'keywords' => 'fixes', 'status_id' => '3', 'if_tracker_id' => ''}
|
||||
] do
|
||||
|
||||
issue1 = Issue.generate!(:tracker_id => 2)
|
||||
issue2 = Issue.generate!
|
||||
Changeset.generate!(:comments => "Fixes ##{issue1.id}, ##{issue2.id}")
|
||||
assert_equal 5, issue1.reload.status_id
|
||||
assert_equal 3, issue2.reload.status_id
|
||||
end
|
||||
end
|
||||
|
||||
def test_update_keywords_with_multiple_rules_and_no_match
|
||||
with_settings :commit_update_keywords => [
|
||||
{'keywords' => 'fixes', 'status_id' => '5', 'if_tracker_id' => '2'},
|
||||
{'keywords' => 'fixes', 'status_id' => '3', 'if_tracker_id' => '3'}
|
||||
] do
|
||||
|
||||
issue1 = Issue.generate!(:tracker_id => 2)
|
||||
issue2 = Issue.generate!
|
||||
Changeset.generate!(:comments => "Fixes ##{issue1.id}, ##{issue2.id}")
|
||||
assert_equal 5, issue1.reload.status_id
|
||||
assert_equal 1, issue2.reload.status_id # no updates
|
||||
end
|
||||
end
|
||||
|
||||
def test_commit_referencing_a_subproject_issue
|
||||
@@ -192,7 +213,7 @@ class ChangesetTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
def test_commit_closing_a_subproject_issue
|
||||
with_settings :commit_update_keywords => {'closes' => {'status_id' => '5'}},
|
||||
with_settings :commit_update_keywords => [{'keywords' => 'closes', 'status_id' => '5'}],
|
||||
:default_language => 'en' do
|
||||
issue = Issue.find(5)
|
||||
assert !issue.closed?
|
||||
|
||||
Reference in New Issue
Block a user