diff test/unit/changeset_test.rb @ 929:5f33065ddc4b redmine-1.3

Update to Redmine SVN rev 9414 on 1.3-stable branch
author Chris Cannam
date Wed, 27 Jun 2012 14:54:18 +0100
parents cbb26bc654de
children 433d4f72a19b
line wrap: on
line diff
--- a/test/unit/changeset_test.rb	Fri Feb 24 19:09:32 2012 +0000
+++ b/test/unit/changeset_test.rb	Wed Jun 27 14:54:18 2012 +0100
@@ -178,6 +178,24 @@
     assert c.issues.first.project != c.project
   end
 
+  def test_commit_closing_a_subproject_issue
+    with_settings :commit_fix_status_id => 5, :commit_fix_keywords => 'closes' do
+      issue = Issue.find(5)
+      assert !issue.closed?
+      assert_difference 'Journal.count' do
+        c = Changeset.new(:repository   => Project.find(1).repository,
+                          :committed_on => Time.now,
+                          :comments     => 'closes #5, a subproject issue',
+                          :revision     => '12345')
+        assert c.save
+      end
+      assert issue.reload.closed?
+      journal = Journal.first(:order => 'id DESC')
+      assert_equal issue, journal.issue
+      assert_include "Applied in changeset ecookbook:r12345.", journal.notes
+    end
+  end
+
   def test_commit_referencing_a_parent_project_issue
     # repository of child project
     r = Repository::Subversion.create!(
@@ -197,6 +215,16 @@
     assert_equal 'r520', c.text_tag
   end
 
+  def test_text_tag_revision_with_same_project
+    c = Changeset.new(:revision => '520', :repository => Project.find(1).repository)
+    assert_equal 'r520', c.text_tag(Project.find(1))
+  end
+
+  def test_text_tag_revision_with_different_project
+    c = Changeset.new(:revision => '520', :repository => Project.find(1).repository)
+    assert_equal 'ecookbook:r520', c.text_tag(Project.find(2))
+  end
+
   def test_text_tag_hash
     c = Changeset.new(
           :scmid    => '7234cb2750b63f47bff735edc50a1c0a433c2518',
@@ -204,6 +232,16 @@
     assert_equal 'commit:7234cb2750b63f47bff735edc50a1c0a433c2518', c.text_tag
   end
 
+  def test_text_tag_hash_with_same_project
+    c = Changeset.new(:revision => '7234cb27', :scmid => '7234cb27', :repository => Project.find(1).repository)
+    assert_equal 'commit:7234cb27', c.text_tag(Project.find(1))
+  end
+
+  def test_text_tag_hash_with_different_project
+    c = Changeset.new(:revision => '7234cb27', :scmid => '7234cb27', :repository => Project.find(1).repository)
+    assert_equal 'ecookbook:commit:7234cb27', c.text_tag(Project.find(2))
+  end
+
   def test_text_tag_hash_all_number
     c = Changeset.new(:scmid => '0123456789', :revision => '0123456789')
     assert_equal 'commit:0123456789', c.text_tag