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