comparison test/unit/repository_test.rb @ 1464:261b3d9a4903 redmine-2.4

Update to Redmine 2.4 branch rev 12663
author Chris Cannam
date Tue, 14 Jan 2014 14:37:42 +0000
parents 433d4f72a19b
children e248c7af89ec
comparison
equal deleted inserted replaced
1296:038ba2d95de8 1464:261b3d9a4903
1 # Redmine - project management software 1 # Redmine - project management software
2 # Copyright (C) 2006-2012 Jean-Philippe Lang 2 # Copyright (C) 2006-2013 Jean-Philippe Lang
3 # 3 #
4 # This program is free software; you can redistribute it and/or 4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License 5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2 6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version. 7 # of the License, or (at your option) any later version.
180 end 180 end
181 181
182 def test_scan_changesets_for_issue_ids 182 def test_scan_changesets_for_issue_ids
183 Setting.default_language = 'en' 183 Setting.default_language = 'en'
184 184
185 # choosing a status to apply to fix issues
186 Setting.commit_fix_status_id = IssueStatus.find(
187 :first,
188 :conditions => ["is_closed = ?", true]).id
189 Setting.commit_fix_done_ratio = "90"
190 Setting.commit_ref_keywords = 'refs , references, IssueID' 185 Setting.commit_ref_keywords = 'refs , references, IssueID'
191 Setting.commit_fix_keywords = 'fixes , closes' 186 Setting.commit_update_keywords = [
187 {'keywords' => 'fixes , closes', 'status_id' => IssueStatus.where(:is_closed => true).first.id, 'done_ratio' => '90'}
188 ]
192 Setting.default_language = 'en' 189 Setting.default_language = 'en'
193 ActionMailer::Base.deliveries.clear 190 ActionMailer::Base.deliveries.clear
194 191
195 # make sure issue 1 is not already closed 192 # make sure issue 1 is not already closed
196 fixed_issue = Issue.find(1) 193 fixed_issue = Issue.find(1)
207 assert fixed_issue.status.is_closed? 204 assert fixed_issue.status.is_closed?
208 assert_equal 90, fixed_issue.done_ratio 205 assert_equal 90, fixed_issue.done_ratio
209 assert_equal [101], fixed_issue.changeset_ids 206 assert_equal [101], fixed_issue.changeset_ids
210 207
211 # issue change 208 # issue change
212 journal = fixed_issue.journals.find(:first, :order => 'created_on desc') 209 journal = fixed_issue.journals.reorder('created_on desc').first
213 assert_equal User.find_by_login('dlopper'), journal.user 210 assert_equal User.find_by_login('dlopper'), journal.user
214 assert_equal 'Applied in changeset r2.', journal.notes 211 assert_equal 'Applied in changeset r2.', journal.notes
215 212
216 # 2 email notifications 213 # 2 email notifications
217 assert_equal 2, ActionMailer::Base.deliveries.size 214 assert_equal 2, ActionMailer::Base.deliveries.size
276 repository.reload 273 repository.reload
277 assert_equal 'c:\dummy', repository.url 274 assert_equal 'c:\dummy', repository.url
278 end 275 end
279 276
280 def test_manual_user_mapping 277 def test_manual_user_mapping
281 assert_no_difference "Changeset.count(:conditions => 'user_id <> 2')" do 278 assert_no_difference "Changeset.where('user_id <> 2').count" do
282 c = Changeset.create!( 279 c = Changeset.create!(
283 :repository => @repository, 280 :repository => @repository,
284 :committer => 'foo', 281 :committer => 'foo',
285 :committed_on => Time.now, 282 :committed_on => Time.now,
286 :revision => 100, 283 :revision => 100,