diff test/unit/changeset_test.rb @ 1115:433d4f72a19b redmine-2.2

Update to Redmine SVN revision 11137 on 2.2-stable branch
author Chris Cannam
date Mon, 07 Jan 2013 12:01:42 +0000
parents 5f33065ddc4b
children 622f24f53b42 261b3d9a4903
line wrap: on
line diff
--- a/test/unit/changeset_test.rb	Wed Jun 27 14:54:18 2012 +0100
+++ b/test/unit/changeset_test.rb	Mon Jan 07 12:01:42 2013 +0000
@@ -1,7 +1,7 @@
 # encoding: utf-8
 #
 # Redmine - project management software
-# Copyright (C) 2006-2011  Jean-Philippe Lang
+# Copyright (C) 2006-2012  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
@@ -28,9 +28,6 @@
            :users, :members, :member_roles, :trackers,
            :enabled_modules, :roles
 
-  def setup
-  end
-
   def test_ref_keywords_any
     ActionMailer::Base.deliveries.clear
     Setting.commit_fix_status_id = IssueStatus.find(
@@ -179,7 +176,8 @@
   end
 
   def test_commit_closing_a_subproject_issue
-    with_settings :commit_fix_status_id => 5, :commit_fix_keywords => 'closes' do
+    with_settings :commit_fix_status_id => 5, :commit_fix_keywords => 'closes',
+                  :default_language => 'en' do
       issue = Issue.find(5)
       assert !issue.closed?
       assert_difference 'Journal.count' do
@@ -210,6 +208,36 @@
     assert c.issues.first.project != c.project
   end
 
+  def test_commit_referencing_a_project_with_commit_cross_project_ref_disabled
+    r = Repository::Subversion.create!(
+          :project => Project.find(3),
+          :url     => 'svn://localhost/test')
+          
+    with_settings :commit_cross_project_ref => '0' do
+      c = Changeset.new(:repository   => r,
+                        :committed_on => Time.now,
+                        :comments     => 'refs #4, an issue of a different project',
+                        :revision     => '12345')
+      assert c.save
+      assert_equal [], c.issue_ids
+    end
+  end
+
+  def test_commit_referencing_a_project_with_commit_cross_project_ref_enabled
+    r = Repository::Subversion.create!(
+          :project => Project.find(3),
+          :url     => 'svn://localhost/test')
+          
+    with_settings :commit_cross_project_ref => '1' do
+      c = Changeset.new(:repository   => r,
+                        :committed_on => Time.now,
+                        :comments     => 'refs #4, an issue of a different project',
+                        :revision     => '12345')
+      assert c.save
+      assert_equal [4], c.issue_ids
+    end
+  end
+
   def test_text_tag_revision
     c = Changeset.new(:revision => '520')
     assert_equal 'r520', c.text_tag
@@ -225,6 +253,17 @@
     assert_equal 'ecookbook:r520', c.text_tag(Project.find(2))
   end
 
+  def test_text_tag_revision_with_repository_identifier
+    r = Repository::Subversion.create!(
+          :project_id => 1,
+          :url     => 'svn://localhost/test',
+          :identifier => 'documents')
+    
+    c = Changeset.new(:revision => '520', :repository => r)
+    assert_equal 'documents|r520', c.text_tag
+    assert_equal 'ecookbook:documents|r520', c.text_tag(Project.find(2))
+  end
+
   def test_text_tag_hash
     c = Changeset.new(
           :scmid    => '7234cb2750b63f47bff735edc50a1c0a433c2518',