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