##// END OF EJS Templates
Merged r14164 (#19538)....
Jean-Philippe Lang -
r13818:fea9353152f4
parent child
Show More
@@ -240,8 +240,11 class Changeset < ActiveRecord::Base
240 end
240 end
241 Redmine::Hook.call_hook(:model_changeset_scan_commit_for_issue_ids_pre_issue_update,
241 Redmine::Hook.call_hook(:model_changeset_scan_commit_for_issue_ids_pre_issue_update,
242 { :changeset => self, :issue => issue, :action => action })
242 { :changeset => self, :issue => issue, :action => action })
243 unless issue.save
243
244 logger.warn("Issue ##{issue.id} could not be saved by changeset #{id}: #{issue.errors.full_messages}") if logger
244 if issue.changes.any?
245 unless issue.save
246 logger.warn("Issue ##{issue.id} could not be saved by changeset #{id}: #{issue.errors.full_messages}") if logger
247 end
245 end
248 end
246 issue
249 issue
247 end
250 end
@@ -162,6 +162,30 class ChangesetTest < ActiveSupport::TestCase
162 assert_equal [1,2,3], c.issue_ids.sort
162 assert_equal [1,2,3], c.issue_ids.sort
163 end
163 end
164
164
165 def test_update_keywords_with_changes_should_create_journal
166 issue = Issue.generate!(:project_id => 1, :status_id => 1)
167
168 with_settings :commit_update_keywords => [{'keywords' => 'fixes', 'status_id' => '3'}] do
169 assert_difference 'Journal.count' do
170 c = Changeset.generate!(:repository => Project.find(1).repository,:comments => "Fixes ##{issue.id}")
171 assert_include c.id, issue.reload.changeset_ids
172 journal = Journal.order('id DESC').first
173 assert_equal 1, journal.details.count
174 end
175 end
176 end
177
178 def test_update_keywords_without_change_should_not_create_journal
179 issue = Issue.generate!(:project_id => 1, :status_id => 3)
180
181 with_settings :commit_update_keywords => [{'keywords' => 'fixes', 'status_id' => '3'}] do
182 assert_no_difference 'Journal.count' do
183 c = Changeset.generate!(:repository => Project.find(1).repository,:comments => "Fixes ##{issue.id}")
184 assert_include c.id, issue.reload.changeset_ids
185 end
186 end
187 end
188
165 def test_update_keywords_with_multiple_rules
189 def test_update_keywords_with_multiple_rules
166 with_settings :commit_update_keywords => [
190 with_settings :commit_update_keywords => [
167 {'keywords' => 'fixes, closes', 'status_id' => '5'},
191 {'keywords' => 'fixes, closes', 'status_id' => '5'},
General Comments 0
You need to be logged in to leave comments. Login now