diff test/functional/repositories_git_controller_test.rb @ 507:0c939c159af4 redmine-1.2

Update to Redmine 1.2.1 on 1.2-stable branch (Redmine SVN rev 6270)
author Chris Cannam
date Thu, 14 Jul 2011 10:32:19 +0100
parents cbce1fd3b1b7
children cbb26bc654de
line wrap: on
line diff
--- a/test/functional/repositories_git_controller_test.rb	Mon Jun 06 14:24:13 2011 +0100
+++ b/test/functional/repositories_git_controller_test.rb	Thu Jul 14 10:32:19 2011 +0100
@@ -48,6 +48,8 @@
     if @char_1.respond_to?(:force_encoding)
       @char_1.force_encoding('UTF-8')
     end
+
+    Setting.default_language = 'en'
   end
 
   if File.directory?(REPOSITORY_PATH)
@@ -204,6 +206,27 @@
       assert_tag :tag => 'h2', :content => /2f9c0091/
     end
 
+    def test_diff_truncated
+      @repository.fetch_changesets
+      @repository.reload
+      Setting.diff_max_lines_displayed = 5
+
+      # Truncated diff of changeset 2f9c0091
+      with_cache do
+        get :diff, :id   => PRJ_ID, :type => 'inline',
+            :rev  => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
+        assert_response :success
+        assert @response.body.include?("... This diff was truncated")
+
+        Setting.default_language = 'fr'
+        get :diff, :id   => PRJ_ID, :type => 'inline',
+            :rev  => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
+        assert_response :success
+        assert ! @response.body.include?("... This diff was truncated")
+        assert @response.body.include?("... Ce diff")
+      end
+    end
+
     def test_diff_two_revs
       @repository.fetch_changesets
       @repository.reload
@@ -336,4 +359,12 @@
     puts "Git test repository NOT FOUND. Skipping functional tests !!!"
     def test_fake; assert true end
   end
+
+  private
+  def with_cache(&block)
+    before = ActionController::Base.perform_caching
+    ActionController::Base.perform_caching = true
+    block.call
+    ActionController::Base.perform_caching = before
+  end
 end