##// END OF EJS Templates
scm: mercurial: code clean up functional test....
Toshi MARUYAMA -
r5566:ab6b848304c8
parent child
Show More
@@ -25,11 +25,13 class RepositoriesMercurialControllerTest < ActionController::TestCase
25 25 fixtures :projects, :users, :roles, :members, :member_roles, :repositories, :enabled_modules
26 26
27 27 # No '..' in the repository path
28 REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/mercurial_repository'
28 REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') +
29 '/tmp/test/mercurial_repository'
29 30 CHAR_1_HEX = "\xc3\x9c"
30 PRJ_ID = 3
31 PRJ_ID = 3
31 32
32 ruby19_non_utf8_pass = (RUBY_VERSION >= '1.9' && Encoding.default_external.to_s != 'UTF-8')
33 ruby19_non_utf8_pass =
34 (RUBY_VERSION >= '1.9' && Encoding.default_external.to_s != 'UTF-8')
33 35
34 36 def setup
35 37 @controller = RepositoriesController.new
@@ -110,12 +112,14 class RepositoriesMercurialControllerTest < ActionController::TestCase
110 112 @repository.fetch_changesets
111 113 @repository.reload
112 114 [13, '13', '3a330eb32958'].each do |r1|
113 get :show, :id => PRJ_ID, :path => ['sql_escape', 'percent%dir'], :rev => r1
115 get :show, :id => PRJ_ID, :path => ['sql_escape', 'percent%dir'],
116 :rev => r1
114 117 assert_response :success
115 118 assert_template 'show'
116 119
117 120 assert_not_nil assigns(:entries)
118 assert_equal ['percent%file1.txt', 'percentfile1.txt'], assigns(:entries).collect(&:name)
121 assert_equal ['percent%file1.txt', 'percentfile1.txt'],
122 assigns(:entries).collect(&:name)
119 123 changesets = assigns(:changesets)
120 124 assert_not_nil changesets
121 125 assigns(:changesets).size > 0
@@ -214,7 +218,8 class RepositoriesMercurialControllerTest < ActionController::TestCase
214 218 end
215 219
216 220 def test_entry_download
217 get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb'], :format => 'raw'
221 get :entry, :id => PRJ_ID,
222 :path => ['sources', 'watchers_controller.rb'], :format => 'raw'
218 223 assert_response :success
219 224 # File content
220 225 assert @response.body.include?('WITHOUT ANY WARRANTY')
@@ -317,7 +322,8 class RepositoriesMercurialControllerTest < ActionController::TestCase
317 322 @repository.fetch_changesets
318 323 @repository.reload
319 324 [2, '400bb8672109', '400', 400].each do |r1|
320 get :annotate, :id => PRJ_ID, :rev => r1, :path => ['sources', 'watchers_controller.rb']
325 get :annotate, :id => PRJ_ID, :rev => r1,
326 :path => ['sources', 'watchers_controller.rb']
321 327 assert_response :success
322 328 assert_template 'annotate'
323 329 assert_tag :tag => 'h2', :content => /@ 2:400bb8672109/
General Comments 0
You need to be logged in to leave comments. Login now