diff test/unit/changeset_test.rb @ 1517:dffacf8a6908 redmine-2.5

Update to Redmine SVN revision 13367 on 2.5-stable branch
author Chris Cannam
date Tue, 09 Sep 2014 09:29:00 +0100
parents e248c7af89ec
children
line wrap: on
line diff
--- a/test/unit/changeset_test.rb	Tue Sep 09 09:28:31 2014 +0100
+++ b/test/unit/changeset_test.rb	Tue Sep 09 09:29:00 2014 +0100
@@ -96,7 +96,7 @@
       end
       assert_equal [1], c.issue_ids.sort
 
-      time = TimeEntry.first(:order => 'id desc')
+      time = TimeEntry.order('id desc').first
       assert_equal 1, time.issue_id
       assert_equal 1, time.project_id
       assert_equal 2, time.user_id
@@ -111,7 +111,8 @@
 
   def test_ref_keywords_closing_with_timelog
     Setting.commit_ref_keywords = '*'
-    Setting.commit_update_keywords = [{'keywords' => 'fixes , closes', 'status_id' => IssueStatus.where(:is_closed => true).first.id.to_s}]
+    Setting.commit_update_keywords = [{'keywords' => 'fixes , closes',
+                                       'status_id' => IssueStatus.where(:is_closed => true).first.id.to_s}]
     Setting.commit_logtime_enabled = '1'
 
     c = Changeset.new(:repository   => Project.find(1).repository,
@@ -126,7 +127,7 @@
     assert Issue.find(1).closed?
     assert Issue.find(2).closed?
 
-    times = TimeEntry.all(:order => 'id desc', :limit => 2)
+    times = TimeEntry.order('id desc').limit(2)
     assert_equal [1, 2], times.collect(&:issue_id).sort
   end
 
@@ -225,7 +226,7 @@
         assert c.save
       end
       assert issue.reload.closed?
-      journal = Journal.first(:order => 'id DESC')
+      journal = Journal.order('id DESC').first
       assert_equal issue, journal.issue
       assert_include "Applied in changeset ecookbook:r12345.", journal.notes
     end
@@ -249,7 +250,6 @@
     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,
@@ -264,7 +264,6 @@
     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,
@@ -317,7 +316,6 @@
           :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))
@@ -538,6 +536,17 @@
     end
   end
 
+  def test_comments_should_accept_more_than_64k
+    c = Changeset.new(:repository   => Repository.first,
+                      :committed_on => Time.now,
+                      :revision     => '123',
+                      :scmid        => '12345',
+                      :comments     => "a" * 500.kilobyte)
+    assert c.save
+    c.reload
+    assert_equal 500.kilobyte, c.comments.size
+  end
+
   def test_identifier
     c = Changeset.find_by_revision('1')
     assert_equal c.revision, c.identifier