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