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