diff test/unit/changeset_test.rb @ 909:cbb26bc654de redmine-1.3

Update to Redmine 1.3-stable branch (Redmine SVN rev 8964)
author Chris Cannam
date Fri, 24 Feb 2012 19:09:32 +0000
parents cbce1fd3b1b7
children 5f33065ddc4b
line wrap: on
line diff
--- a/test/unit/changeset_test.rb	Fri Feb 24 18:36:29 2012 +0000
+++ b/test/unit/changeset_test.rb	Fri Feb 24 19:09:32 2012 +0000
@@ -1,18 +1,18 @@
 # encoding: utf-8
 #
 # Redmine - project management software
-# Copyright (C) 2006-2010  Jean-Philippe Lang
+# Copyright (C) 2006-2011  Jean-Philippe Lang
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # as published by the Free Software Foundation; either version 2
 # of the License, or (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
@@ -22,7 +22,7 @@
 class ChangesetTest < ActiveSupport::TestCase
   fixtures :projects, :repositories,
            :issues, :issue_statuses, :issue_categories,
-           :changesets, :changes, 
+           :changesets, :changes,
            :enumerations,
            :custom_fields, :custom_values,
            :users, :members, :member_roles, :trackers,
@@ -41,9 +41,9 @@
 
     c = Changeset.new(:repository   => Project.find(1).repository,
                       :committed_on => Time.now,
-                      :comments     => 'New commit (#2). Fixes #1')
-    c.scan_comment_for_issue_ids
-
+                      :comments     => 'New commit (#2). Fixes #1',
+                      :revision     => '12345')
+    assert c.save
     assert_equal [1, 2], c.issue_ids.sort
     fixed = Issue.find(1)
     assert fixed.closed?
@@ -54,24 +54,22 @@
   def test_ref_keywords
     Setting.commit_ref_keywords = 'refs'
     Setting.commit_fix_keywords = ''
-
     c = Changeset.new(:repository   => Project.find(1).repository,
                       :committed_on => Time.now,
-                      :comments     => 'Ignores #2. Refs #1')
-    c.scan_comment_for_issue_ids
-    
+                      :comments     => 'Ignores #2. Refs #1',
+                      :revision     => '12345')
+    assert c.save
     assert_equal [1], c.issue_ids.sort
   end
 
   def test_ref_keywords_any_only
     Setting.commit_ref_keywords = '*'
     Setting.commit_fix_keywords = ''
-    
     c = Changeset.new(:repository   => Project.find(1).repository,
                       :committed_on => Time.now,
-                      :comments     => 'Ignores #2. Refs #1')
-    c.scan_comment_for_issue_ids
-
+                      :comments     => 'Ignores #2. Refs #1',
+                      :revision     => '12345')
+    assert c.save
     assert_equal [1, 2], c.issue_ids.sort
   end
 
@@ -123,7 +121,7 @@
     Setting.commit_ref_keywords = '*'
     Setting.commit_fix_keywords = 'fixes , closes'
     Setting.commit_logtime_enabled = '1'
-    
+
     c = Changeset.new(:repository   => Project.find(1).repository,
                       :committed_on => Time.now,
                       :comments     => 'This is a comment. Fixes #1 @4.5, #2 @1',
@@ -142,43 +140,40 @@
 
   def test_ref_keywords_any_line_start
     Setting.commit_ref_keywords = '*'
-
     c = Changeset.new(:repository   => Project.find(1).repository,
                       :committed_on => Time.now,
-                      :comments     => '#1 is the reason of this commit')
-    c.scan_comment_for_issue_ids
-
+                      :comments     => '#1 is the reason of this commit',
+                      :revision     => '12345')
+    assert c.save
     assert_equal [1], c.issue_ids.sort
   end
 
   def test_ref_keywords_allow_brackets_around_a_issue_number
     Setting.commit_ref_keywords = '*'
-
     c = Changeset.new(:repository   => Project.find(1).repository,
                       :committed_on => Time.now,
-                      :comments     => '[#1] Worked on this issue')
-    c.scan_comment_for_issue_ids
-
+                      :comments     => '[#1] Worked on this issue',
+                      :revision     => '12345')
+    assert c.save
     assert_equal [1], c.issue_ids.sort
   end
 
   def test_ref_keywords_allow_brackets_around_multiple_issue_numbers
     Setting.commit_ref_keywords = '*'
-
     c = Changeset.new(:repository   => Project.find(1).repository,
                       :committed_on => Time.now,
-                      :comments     => '[#1 #2, #3] Worked on these')
-    c.scan_comment_for_issue_ids
-
+                      :comments     => '[#1 #2, #3] Worked on these',
+                      :revision     => '12345')
+    assert c.save
     assert_equal [1,2,3], c.issue_ids.sort
   end
 
   def test_commit_referencing_a_subproject_issue
     c = Changeset.new(:repository   => Project.find(1).repository,
                       :committed_on => Time.now,
-                      :comments     => 'refs #5, a subproject issue')
-    c.scan_comment_for_issue_ids
-
+                      :comments     => 'refs #5, a subproject issue',
+                      :revision     => '12345')
+    assert c.save
     assert_equal [5], c.issue_ids.sort
     assert c.issues.first.project != c.project
   end
@@ -188,12 +183,11 @@
     r = Repository::Subversion.create!(
           :project => Project.find(3),
           :url     => 'svn://localhost/test')
-
     c = Changeset.new(:repository   => r,
                       :committed_on => Time.now,
-                      :comments     => 'refs #2, an issue of a parent project')
-    c.scan_comment_for_issue_ids
-
+                      :comments     => 'refs #2, an issue of a parent project',
+                      :revision     => '12345')
+    assert c.save
     assert_equal [2], c.issue_ids.sort
     assert c.issues.first.project != c.project
   end