##// END OF EJS Templates
scm: mercurial: add test of diff non ASCII path name in functional test....
Toshi MARUYAMA -
r5569:ff6a86364e99
parent child
Show More
@@ -1,379 +1,390
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2011 Jean-Philippe Lang
2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 require File.expand_path('../../test_helper', __FILE__)
18 require File.expand_path('../../test_helper', __FILE__)
19 require 'repositories_controller'
19 require 'repositories_controller'
20
20
21 # Re-raise errors caught by the controller.
21 # Re-raise errors caught by the controller.
22 class RepositoriesController; def rescue_action(e) raise e end; end
22 class RepositoriesController; def rescue_action(e) raise e end; end
23
23
24 class RepositoriesMercurialControllerTest < ActionController::TestCase
24 class RepositoriesMercurialControllerTest < ActionController::TestCase
25 fixtures :projects, :users, :roles, :members, :member_roles, :repositories, :enabled_modules
25 fixtures :projects, :users, :roles, :members, :member_roles, :repositories, :enabled_modules
26
26
27 # No '..' in the repository path
27 # No '..' in the repository path
28 REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') +
28 REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') +
29 '/tmp/test/mercurial_repository'
29 '/tmp/test/mercurial_repository'
30 CHAR_1_HEX = "\xc3\x9c"
30 CHAR_1_HEX = "\xc3\x9c"
31 PRJ_ID = 3
31 PRJ_ID = 3
32
32
33 ruby19_non_utf8_pass =
33 ruby19_non_utf8_pass =
34 (RUBY_VERSION >= '1.9' && Encoding.default_external.to_s != 'UTF-8')
34 (RUBY_VERSION >= '1.9' && Encoding.default_external.to_s != 'UTF-8')
35
35
36 def setup
36 def setup
37 @controller = RepositoriesController.new
37 @controller = RepositoriesController.new
38 @request = ActionController::TestRequest.new
38 @request = ActionController::TestRequest.new
39 @response = ActionController::TestResponse.new
39 @response = ActionController::TestResponse.new
40 User.current = nil
40 User.current = nil
41 @repository = Repository::Mercurial.create(
41 @repository = Repository::Mercurial.create(
42 :project => Project.find(PRJ_ID),
42 :project => Project.find(PRJ_ID),
43 :url => REPOSITORY_PATH,
43 :url => REPOSITORY_PATH,
44 :path_encoding => 'ISO-8859-1'
44 :path_encoding => 'ISO-8859-1'
45 )
45 )
46 assert @repository
46 assert @repository
47 @diff_c_support = true
47 @diff_c_support = true
48 @char_1 = CHAR_1_HEX.dup
48 @char_1 = CHAR_1_HEX.dup
49 @tag_char_1 = "tag-#{CHAR_1_HEX}-00"
49 @tag_char_1 = "tag-#{CHAR_1_HEX}-00"
50 @branch_char_0 = "branch-#{CHAR_1_HEX}-00"
50 @branch_char_0 = "branch-#{CHAR_1_HEX}-00"
51 @branch_char_1 = "branch-#{CHAR_1_HEX}-01"
51 @branch_char_1 = "branch-#{CHAR_1_HEX}-01"
52 if @char_1.respond_to?(:force_encoding)
52 if @char_1.respond_to?(:force_encoding)
53 @char_1.force_encoding('UTF-8')
53 @char_1.force_encoding('UTF-8')
54 @tag_char_1.force_encoding('UTF-8')
54 @tag_char_1.force_encoding('UTF-8')
55 @branch_char_0.force_encoding('UTF-8')
55 @branch_char_0.force_encoding('UTF-8')
56 @branch_char_1.force_encoding('UTF-8')
56 @branch_char_1.force_encoding('UTF-8')
57 end
57 end
58 end
58 end
59
59
60 if ruby19_non_utf8_pass
60 if ruby19_non_utf8_pass
61 puts "TODO: Mercurial functional test fails in Ruby 1.9 " +
61 puts "TODO: Mercurial functional test fails in Ruby 1.9 " +
62 "and Encoding.default_external is not UTF-8. " +
62 "and Encoding.default_external is not UTF-8. " +
63 "Current value is '#{Encoding.default_external.to_s}'"
63 "Current value is '#{Encoding.default_external.to_s}'"
64 def test_fake; assert true end
64 def test_fake; assert true end
65 elsif File.directory?(REPOSITORY_PATH)
65 elsif File.directory?(REPOSITORY_PATH)
66 def test_show_root
66 def test_show_root
67 @repository.fetch_changesets
67 @repository.fetch_changesets
68 @repository.reload
68 @repository.reload
69 get :show, :id => PRJ_ID
69 get :show, :id => PRJ_ID
70 assert_response :success
70 assert_response :success
71 assert_template 'show'
71 assert_template 'show'
72 assert_not_nil assigns(:entries)
72 assert_not_nil assigns(:entries)
73 assert_equal 4, assigns(:entries).size
73 assert_equal 4, assigns(:entries).size
74 assert assigns(:entries).detect {|e| e.name == 'images' && e.kind == 'dir'}
74 assert assigns(:entries).detect {|e| e.name == 'images' && e.kind == 'dir'}
75 assert assigns(:entries).detect {|e| e.name == 'sources' && e.kind == 'dir'}
75 assert assigns(:entries).detect {|e| e.name == 'sources' && e.kind == 'dir'}
76 assert assigns(:entries).detect {|e| e.name == 'README' && e.kind == 'file'}
76 assert assigns(:entries).detect {|e| e.name == 'README' && e.kind == 'file'}
77 assert_not_nil assigns(:changesets)
77 assert_not_nil assigns(:changesets)
78 assigns(:changesets).size > 0
78 assigns(:changesets).size > 0
79 end
79 end
80
80
81 def test_show_directory
81 def test_show_directory
82 @repository.fetch_changesets
82 @repository.fetch_changesets
83 @repository.reload
83 @repository.reload
84 get :show, :id => PRJ_ID, :path => ['images']
84 get :show, :id => PRJ_ID, :path => ['images']
85 assert_response :success
85 assert_response :success
86 assert_template 'show'
86 assert_template 'show'
87 assert_not_nil assigns(:entries)
87 assert_not_nil assigns(:entries)
88 assert_equal ['delete.png', 'edit.png'], assigns(:entries).collect(&:name)
88 assert_equal ['delete.png', 'edit.png'], assigns(:entries).collect(&:name)
89 entry = assigns(:entries).detect {|e| e.name == 'edit.png'}
89 entry = assigns(:entries).detect {|e| e.name == 'edit.png'}
90 assert_not_nil entry
90 assert_not_nil entry
91 assert_equal 'file', entry.kind
91 assert_equal 'file', entry.kind
92 assert_equal 'images/edit.png', entry.path
92 assert_equal 'images/edit.png', entry.path
93 assert_not_nil assigns(:changesets)
93 assert_not_nil assigns(:changesets)
94 assigns(:changesets).size > 0
94 assigns(:changesets).size > 0
95 end
95 end
96
96
97 def test_show_at_given_revision
97 def test_show_at_given_revision
98 @repository.fetch_changesets
98 @repository.fetch_changesets
99 @repository.reload
99 @repository.reload
100 [0, '0', '0885933ad4f6'].each do |r1|
100 [0, '0', '0885933ad4f6'].each do |r1|
101 get :show, :id => PRJ_ID, :path => ['images'], :rev => r1
101 get :show, :id => PRJ_ID, :path => ['images'], :rev => r1
102 assert_response :success
102 assert_response :success
103 assert_template 'show'
103 assert_template 'show'
104 assert_not_nil assigns(:entries)
104 assert_not_nil assigns(:entries)
105 assert_equal ['delete.png'], assigns(:entries).collect(&:name)
105 assert_equal ['delete.png'], assigns(:entries).collect(&:name)
106 assert_not_nil assigns(:changesets)
106 assert_not_nil assigns(:changesets)
107 assigns(:changesets).size > 0
107 assigns(:changesets).size > 0
108 end
108 end
109 end
109 end
110
110
111 def test_show_directory_sql_escape_percent
111 def test_show_directory_sql_escape_percent
112 @repository.fetch_changesets
112 @repository.fetch_changesets
113 @repository.reload
113 @repository.reload
114 [13, '13', '3a330eb32958'].each do |r1|
114 [13, '13', '3a330eb32958'].each do |r1|
115 get :show, :id => PRJ_ID, :path => ['sql_escape', 'percent%dir'],
115 get :show, :id => PRJ_ID, :path => ['sql_escape', 'percent%dir'],
116 :rev => r1
116 :rev => r1
117 assert_response :success
117 assert_response :success
118 assert_template 'show'
118 assert_template 'show'
119
119
120 assert_not_nil assigns(:entries)
120 assert_not_nil assigns(:entries)
121 assert_equal ['percent%file1.txt', 'percentfile1.txt'],
121 assert_equal ['percent%file1.txt', 'percentfile1.txt'],
122 assigns(:entries).collect(&:name)
122 assigns(:entries).collect(&:name)
123 changesets = assigns(:changesets)
123 changesets = assigns(:changesets)
124 assert_not_nil changesets
124 assert_not_nil changesets
125 assigns(:changesets).size > 0
125 assigns(:changesets).size > 0
126 assert_equal %w(13 11 10 9), changesets.collect(&:revision)
126 assert_equal %w(13 11 10 9), changesets.collect(&:revision)
127 end
127 end
128 end
128 end
129
129
130 def test_show_directory_latin_1_path
130 def test_show_directory_latin_1_path
131 @repository.fetch_changesets
131 @repository.fetch_changesets
132 @repository.reload
132 @repository.reload
133 [21, '21', 'adf805632193'].each do |r1|
133 [21, '21', 'adf805632193'].each do |r1|
134 get :show, :id => PRJ_ID, :path => ['latin-1-dir'], :rev => r1
134 get :show, :id => PRJ_ID, :path => ['latin-1-dir'], :rev => r1
135 assert_response :success
135 assert_response :success
136 assert_template 'show'
136 assert_template 'show'
137
137
138 assert_not_nil assigns(:entries)
138 assert_not_nil assigns(:entries)
139 assert_equal ["make-latin-1-file.rb",
139 assert_equal ["make-latin-1-file.rb",
140 "test-#{@char_1}-1.txt",
140 "test-#{@char_1}-1.txt",
141 "test-#{@char_1}-2.txt",
141 "test-#{@char_1}-2.txt",
142 "test-#{@char_1}.txt"], assigns(:entries).collect(&:name)
142 "test-#{@char_1}.txt"], assigns(:entries).collect(&:name)
143 changesets = assigns(:changesets)
143 changesets = assigns(:changesets)
144 assert_not_nil changesets
144 assert_not_nil changesets
145 assert_equal %w(21 20 19 18 17), changesets.collect(&:revision)
145 assert_equal %w(21 20 19 18 17), changesets.collect(&:revision)
146 end
146 end
147 end
147 end
148
148
149 def test_show_branch
149 def test_show_branch
150 @repository.fetch_changesets
150 @repository.fetch_changesets
151 @repository.reload
151 @repository.reload
152 [
152 [
153 'default',
153 'default',
154 @branch_char_1,
154 @branch_char_1,
155 'branch (1)[2]&,%.-3_4',
155 'branch (1)[2]&,%.-3_4',
156 @branch_char_0,
156 @branch_char_0,
157 'test_branch.latin-1',
157 'test_branch.latin-1',
158 'test-branch-00',
158 'test-branch-00',
159 ].each do |bra|
159 ].each do |bra|
160 get :show, :id => PRJ_ID, :rev => bra
160 get :show, :id => PRJ_ID, :rev => bra
161 assert_response :success
161 assert_response :success
162 assert_template 'show'
162 assert_template 'show'
163 assert_not_nil assigns(:entries)
163 assert_not_nil assigns(:entries)
164 assert assigns(:entries).size > 0
164 assert assigns(:entries).size > 0
165 assert_not_nil assigns(:changesets)
165 assert_not_nil assigns(:changesets)
166 assigns(:changesets).size > 0
166 assigns(:changesets).size > 0
167 end
167 end
168 end
168 end
169
169
170 def test_show_tag
170 def test_show_tag
171 @repository.fetch_changesets
171 @repository.fetch_changesets
172 @repository.reload
172 @repository.reload
173 [
173 [
174 @tag_char_1,
174 @tag_char_1,
175 'tag_test.00',
175 'tag_test.00',
176 'tag-init-revision'
176 'tag-init-revision'
177 ].each do |tag|
177 ].each do |tag|
178 get :show, :id => PRJ_ID, :rev => tag
178 get :show, :id => PRJ_ID, :rev => tag
179 assert_response :success
179 assert_response :success
180 assert_template 'show'
180 assert_template 'show'
181 assert_not_nil assigns(:entries)
181 assert_not_nil assigns(:entries)
182 assert assigns(:entries).size > 0
182 assert assigns(:entries).size > 0
183 assert_not_nil assigns(:changesets)
183 assert_not_nil assigns(:changesets)
184 assigns(:changesets).size > 0
184 assigns(:changesets).size > 0
185 end
185 end
186 end
186 end
187
187
188 def test_changes
188 def test_changes
189 get :changes, :id => PRJ_ID, :path => ['images', 'edit.png']
189 get :changes, :id => PRJ_ID, :path => ['images', 'edit.png']
190 assert_response :success
190 assert_response :success
191 assert_template 'changes'
191 assert_template 'changes'
192 assert_tag :tag => 'h2', :content => 'edit.png'
192 assert_tag :tag => 'h2', :content => 'edit.png'
193 end
193 end
194
194
195 def test_entry_show
195 def test_entry_show
196 get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb']
196 get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb']
197 assert_response :success
197 assert_response :success
198 assert_template 'entry'
198 assert_template 'entry'
199 # Line 10
199 # Line 10
200 assert_tag :tag => 'th',
200 assert_tag :tag => 'th',
201 :content => '10',
201 :content => '10',
202 :attributes => { :class => 'line-num' },
202 :attributes => { :class => 'line-num' },
203 :sibling => { :tag => 'td', :content => /WITHOUT ANY WARRANTY/ }
203 :sibling => { :tag => 'td', :content => /WITHOUT ANY WARRANTY/ }
204 end
204 end
205
205
206 def test_entry_show_latin_1_path
206 def test_entry_show_latin_1_path
207 [21, '21', 'adf805632193'].each do |r1|
207 [21, '21', 'adf805632193'].each do |r1|
208 get :entry, :id => PRJ_ID,
208 get :entry, :id => PRJ_ID,
209 :path => ['latin-1-dir', "test-#{@char_1}-2.txt"], :rev => r1
209 :path => ['latin-1-dir', "test-#{@char_1}-2.txt"], :rev => r1
210 assert_response :success
210 assert_response :success
211 assert_template 'entry'
211 assert_template 'entry'
212 assert_tag :tag => 'th',
212 assert_tag :tag => 'th',
213 :content => '1',
213 :content => '1',
214 :attributes => { :class => 'line-num' },
214 :attributes => { :class => 'line-num' },
215 :sibling => { :tag => 'td',
215 :sibling => { :tag => 'td',
216 :content => /Mercurial is a distributed version control system/ }
216 :content => /Mercurial is a distributed version control system/ }
217 end
217 end
218 end
218 end
219
219
220 def test_entry_download
220 def test_entry_download
221 get :entry, :id => PRJ_ID,
221 get :entry, :id => PRJ_ID,
222 :path => ['sources', 'watchers_controller.rb'], :format => 'raw'
222 :path => ['sources', 'watchers_controller.rb'], :format => 'raw'
223 assert_response :success
223 assert_response :success
224 # File content
224 # File content
225 assert @response.body.include?('WITHOUT ANY WARRANTY')
225 assert @response.body.include?('WITHOUT ANY WARRANTY')
226 end
226 end
227
227
228 def test_entry_binary_force_download
228 def test_entry_binary_force_download
229 get :entry, :id => PRJ_ID, :rev => 1, :path => ['images', 'edit.png']
229 get :entry, :id => PRJ_ID, :rev => 1, :path => ['images', 'edit.png']
230 assert_response :success
230 assert_response :success
231 assert_equal 'image/png', @response.content_type
231 assert_equal 'image/png', @response.content_type
232 end
232 end
233
233
234 def test_directory_entry
234 def test_directory_entry
235 get :entry, :id => PRJ_ID, :path => ['sources']
235 get :entry, :id => PRJ_ID, :path => ['sources']
236 assert_response :success
236 assert_response :success
237 assert_template 'show'
237 assert_template 'show'
238 assert_not_nil assigns(:entry)
238 assert_not_nil assigns(:entry)
239 assert_equal 'sources', assigns(:entry).name
239 assert_equal 'sources', assigns(:entry).name
240 end
240 end
241
241
242 def test_diff
242 def test_diff
243 @repository.fetch_changesets
243 @repository.fetch_changesets
244 @repository.reload
244 @repository.reload
245 [4, '4', 'def6d2f1254a'].each do |r1|
245 [4, '4', 'def6d2f1254a'].each do |r1|
246 # Full diff of changeset 4
246 # Full diff of changeset 4
247 get :diff, :id => PRJ_ID, :rev => r1
247 get :diff, :id => PRJ_ID, :rev => r1
248 assert_response :success
248 assert_response :success
249 assert_template 'diff'
249 assert_template 'diff'
250 if @diff_c_support
250 if @diff_c_support
251 # Line 22 removed
251 # Line 22 removed
252 assert_tag :tag => 'th',
252 assert_tag :tag => 'th',
253 :content => '22',
253 :content => '22',
254 :sibling => { :tag => 'td',
254 :sibling => { :tag => 'td',
255 :attributes => { :class => /diff_out/ },
255 :attributes => { :class => /diff_out/ },
256 :content => /def remove/ }
256 :content => /def remove/ }
257 assert_tag :tag => 'h2', :content => /4:def6d2f1254a/
257 assert_tag :tag => 'h2', :content => /4:def6d2f1254a/
258 end
258 end
259 end
259 end
260 end
260 end
261
261
262 def test_diff_two_revs
262 def test_diff_two_revs
263 @repository.fetch_changesets
263 @repository.fetch_changesets
264 @repository.reload
264 @repository.reload
265 [2, '400bb8672109', '400', 400].each do |r1|
265 [2, '400bb8672109', '400', 400].each do |r1|
266 [4, 'def6d2f1254a'].each do |r2|
266 [4, 'def6d2f1254a'].each do |r2|
267 get :diff, :id => PRJ_ID, :rev => r1,
267 get :diff, :id => PRJ_ID, :rev => r1,
268 :rev_to => r2
268 :rev_to => r2
269 assert_response :success
269 assert_response :success
270 assert_template 'diff'
270 assert_template 'diff'
271
271
272 diff = assigns(:diff)
272 diff = assigns(:diff)
273 assert_not_nil diff
273 assert_not_nil diff
274 assert_tag :tag => 'h2', :content => /4:def6d2f1254a 2:400bb8672109/
274 assert_tag :tag => 'h2', :content => /4:def6d2f1254a 2:400bb8672109/
275 end
275 end
276 end
276 end
277 end
277 end
278
278
279 def test_diff_latin_1_path
279 def test_diff_latin_1_path
280 [21, 'adf805632193'].each do |r1|
280 with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
281 get :diff, :id => PRJ_ID, :rev => r1
281 [21, 'adf805632193'].each do |r1|
282 assert_response :success
282 get :diff, :id => PRJ_ID, :rev => r1
283 assert_template 'diff'
283 assert_response :success
284 assert_tag :tag => 'th',
284 assert_template 'diff'
285 :content => '2',
285 assert_tag :tag => 'thead',
286 :sibling => {:tag => 'td',
286 :descendant => {
287 :attributes => { :class => /diff_in/ },
287 :tag => 'th',
288 :content => /It is written in Python/ }
288 :attributes => { :class => 'filename' } ,
289 :content => /latin-1-dir\/test-#{@char_1}-2.txt/ ,
290 },
291 :sibling => {
292 :tag => 'tbody',
293 :descendant => {
294 :tag => 'td',
295 :attributes => { :class => /diff_in/ },
296 :content => /It is written in Python/
297 }
298 }
299 end
289 end
300 end
290 end
301 end
291
302
292 def test_annotate
303 def test_annotate
293 get :annotate, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb']
304 get :annotate, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb']
294 assert_response :success
305 assert_response :success
295 assert_template 'annotate'
306 assert_template 'annotate'
296 # Line 23, revision 4:def6d2f1254a
307 # Line 23, revision 4:def6d2f1254a
297 assert_tag :tag => 'th',
308 assert_tag :tag => 'th',
298 :content => '23',
309 :content => '23',
299 :attributes => { :class => 'line-num' },
310 :attributes => { :class => 'line-num' },
300 :sibling =>
311 :sibling =>
301 {
312 {
302 :tag => 'td',
313 :tag => 'td',
303 :attributes => { :class => 'revision' },
314 :attributes => { :class => 'revision' },
304 :child => { :tag => 'a', :content => '4:def6d2f1254a' }
315 :child => { :tag => 'a', :content => '4:def6d2f1254a' }
305 }
316 }
306 assert_tag :tag => 'th',
317 assert_tag :tag => 'th',
307 :content => '23',
318 :content => '23',
308 :attributes => { :class => 'line-num' },
319 :attributes => { :class => 'line-num' },
309 :sibling =>
320 :sibling =>
310 {
321 {
311 :tag => 'td' ,
322 :tag => 'td' ,
312 :content => 'jsmith' ,
323 :content => 'jsmith' ,
313 :attributes => { :class => 'author' },
324 :attributes => { :class => 'author' },
314 }
325 }
315 assert_tag :tag => 'th',
326 assert_tag :tag => 'th',
316 :content => '23',
327 :content => '23',
317 :attributes => { :class => 'line-num' },
328 :attributes => { :class => 'line-num' },
318 :sibling => { :tag => 'td', :content => /watcher =/ }
329 :sibling => { :tag => 'td', :content => /watcher =/ }
319 end
330 end
320
331
321 def test_annotate_at_given_revision
332 def test_annotate_at_given_revision
322 @repository.fetch_changesets
333 @repository.fetch_changesets
323 @repository.reload
334 @repository.reload
324 [2, '400bb8672109', '400', 400].each do |r1|
335 [2, '400bb8672109', '400', 400].each do |r1|
325 get :annotate, :id => PRJ_ID, :rev => r1,
336 get :annotate, :id => PRJ_ID, :rev => r1,
326 :path => ['sources', 'watchers_controller.rb']
337 :path => ['sources', 'watchers_controller.rb']
327 assert_response :success
338 assert_response :success
328 assert_template 'annotate'
339 assert_template 'annotate'
329 assert_tag :tag => 'h2', :content => /@ 2:400bb8672109/
340 assert_tag :tag => 'h2', :content => /@ 2:400bb8672109/
330 end
341 end
331 end
342 end
332
343
333 def test_annotate_latin_1_path
344 def test_annotate_latin_1_path
334 [21, '21', 'adf805632193'].each do |r1|
345 [21, '21', 'adf805632193'].each do |r1|
335 get :annotate, :id => PRJ_ID,
346 get :annotate, :id => PRJ_ID,
336 :path => ['latin-1-dir', "test-#{@char_1}-2.txt"], :rev => r1
347 :path => ['latin-1-dir', "test-#{@char_1}-2.txt"], :rev => r1
337 assert_response :success
348 assert_response :success
338 assert_template 'annotate'
349 assert_template 'annotate'
339 assert_tag :tag => 'th',
350 assert_tag :tag => 'th',
340 :content => '1',
351 :content => '1',
341 :attributes => { :class => 'line-num' },
352 :attributes => { :class => 'line-num' },
342 :sibling =>
353 :sibling =>
343 {
354 {
344 :tag => 'td',
355 :tag => 'td',
345 :attributes => { :class => 'revision' },
356 :attributes => { :class => 'revision' },
346 :child => { :tag => 'a', :content => '20:709858aafd1b' }
357 :child => { :tag => 'a', :content => '20:709858aafd1b' }
347 }
358 }
348 assert_tag :tag => 'th',
359 assert_tag :tag => 'th',
349 :content => '1',
360 :content => '1',
350 :attributes => { :class => 'line-num' },
361 :attributes => { :class => 'line-num' },
351 :sibling =>
362 :sibling =>
352 {
363 {
353 :tag => 'td' ,
364 :tag => 'td' ,
354 :content => 'jsmith' ,
365 :content => 'jsmith' ,
355 :attributes => { :class => 'author' },
366 :attributes => { :class => 'author' },
356 }
367 }
357 assert_tag :tag => 'th',
368 assert_tag :tag => 'th',
358 :content => '1',
369 :content => '1',
359 :attributes => { :class => 'line-num' },
370 :attributes => { :class => 'line-num' },
360 :sibling => { :tag => 'td',
371 :sibling => { :tag => 'td',
361 :content => /Mercurial is a distributed version control system/ }
372 :content => /Mercurial is a distributed version control system/ }
362
373
363 end
374 end
364 end
375 end
365
376
366 def test_empty_revision
377 def test_empty_revision
367 @repository.fetch_changesets
378 @repository.fetch_changesets
368 @repository.reload
379 @repository.reload
369 ['', ' ', nil].each do |r|
380 ['', ' ', nil].each do |r|
370 get :revision, :id => PRJ_ID, :rev => r
381 get :revision, :id => PRJ_ID, :rev => r
371 assert_response 404
382 assert_response 404
372 assert_error_tag :content => /was not found/
383 assert_error_tag :content => /was not found/
373 end
384 end
374 end
385 end
375 else
386 else
376 puts "Mercurial test repository NOT FOUND. Skipping functional tests !!!"
387 puts "Mercurial test repository NOT FOUND. Skipping functional tests !!!"
377 def test_fake; assert true end
388 def test_fake; assert true end
378 end
389 end
379 end
390 end
General Comments 0
You need to be logged in to leave comments. Login now