Mercurial > hg > soundsoftware-site
comparison 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 |
comparison
equal
deleted
inserted
replaced
441:cbce1fd3b1b7 | 507:0c939c159af4 |
---|---|
46 assert @repository | 46 assert @repository |
47 @char_1 = CHAR_1_HEX.dup | 47 @char_1 = CHAR_1_HEX.dup |
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) |
54 def test_browse_root | 56 def test_browse_root |
55 @repository.fetch_changesets | 57 @repository.fetch_changesets |
200 :content => /22/, | 202 :content => /22/, |
201 :sibling => { :tag => 'td', | 203 :sibling => { :tag => 'td', |
202 :attributes => { :class => /diff_out/ }, | 204 :attributes => { :class => /diff_out/ }, |
203 :content => /def remove/ } | 205 :content => /def remove/ } |
204 assert_tag :tag => 'h2', :content => /2f9c0091/ | 206 assert_tag :tag => 'h2', :content => /2f9c0091/ |
207 end | |
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 | |
205 end | 228 end |
206 | 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 |
334 end | 357 end |
335 else | 358 else |
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 |