##// END OF EJS Templates
Merged r6073 from trunk....
Jean-Philippe Lang -
r6042:30255b8054d5
parent child
Show More
@@ -208,7 +208,7 class RepositoriesController < ApplicationController
208 User.current.preference.save
208 User.current.preference.save
209 end
209 end
210 @cache_key = "repositories/diff/#{@repository.id}/" +
210 @cache_key = "repositories/diff/#{@repository.id}/" +
211 Digest::MD5.hexdigest("#{@path}-#{@rev}-#{@rev_to}-#{@diff_type}")
211 Digest::MD5.hexdigest("#{@path}-#{@rev}-#{@rev_to}-#{@diff_type}-#{current_language}")
212 unless read_fragment(@cache_key)
212 unless read_fragment(@cache_key)
213 @diff = @repository.diff(@path, @rev, @rev_to)
213 @diff = @repository.diff(@path, @rev, @rev_to)
214 show_error_not_found unless @diff
214 show_error_not_found unless @diff
@@ -48,6 +48,8 class RepositoriesGitControllerTest < ActionController::TestCase
48 if @char_1.respond_to?(:force_encoding)
48 if @char_1.respond_to?(:force_encoding)
49 @char_1.force_encoding('UTF-8')
49 @char_1.force_encoding('UTF-8')
50 end
50 end
51
52 Setting.default_language = 'en'
51 end
53 end
52
54
53 if File.directory?(REPOSITORY_PATH)
55 if File.directory?(REPOSITORY_PATH)
@@ -204,6 +206,27 class RepositoriesGitControllerTest < ActionController::TestCase
204 assert_tag :tag => 'h2', :content => /2f9c0091/
206 assert_tag :tag => 'h2', :content => /2f9c0091/
205 end
207 end
206
208
209 def test_diff_truncated
210 @repository.fetch_changesets
211 @repository.reload
212 Setting.diff_max_lines_displayed = 5
213
214 # Truncated diff of changeset 2f9c0091
215 with_cache do
216 get :diff, :id => PRJ_ID, :type => 'inline',
217 :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
218 assert_response :success
219 assert @response.body.include?("... This diff was truncated")
220
221 Setting.default_language = 'fr'
222 get :diff, :id => PRJ_ID, :type => 'inline',
223 :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
224 assert_response :success
225 assert ! @response.body.include?("... This diff was truncated")
226 assert @response.body.include?("... Ce diff")
227 end
228 end
229
207 def test_diff_two_revs
230 def test_diff_two_revs
208 @repository.fetch_changesets
231 @repository.fetch_changesets
209 @repository.reload
232 @repository.reload
@@ -336,4 +359,12 class RepositoriesGitControllerTest < ActionController::TestCase
336 puts "Git test repository NOT FOUND. Skipping functional tests !!!"
359 puts "Git test repository NOT FOUND. Skipping functional tests !!!"
337 def test_fake; assert true end
360 def test_fake; assert true end
338 end
361 end
362
363 private
364 def with_cache(&block)
365 before = ActionController::Base.perform_caching
366 ActionController::Base.perform_caching = true
367 block.call
368 ActionController::Base.perform_caching = before
369 end
339 end
370 end
General Comments 0
You need to be logged in to leave comments. Login now