##// END OF EJS Templates
scm: git: replace RAILS_ROOT to Rails.root in functional test....
Toshi MARUYAMA -
r5923:2ab0bdf695bb
parent child
Show More
@@ -1,364 +1,364
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2011 Jean-Philippe Lang
2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 require File.expand_path('../../test_helper', __FILE__)
18 require File.expand_path('../../test_helper', __FILE__)
19 require 'repositories_controller'
19 require 'repositories_controller'
20
20
21 # Re-raise errors caught by the controller.
21 # Re-raise errors caught by the controller.
22 class RepositoriesController; def rescue_action(e) raise e end; end
22 class RepositoriesController; def rescue_action(e) raise e end; end
23
23
24 class RepositoriesGitControllerTest < ActionController::TestCase
24 class RepositoriesGitControllerTest < ActionController::TestCase
25 fixtures :projects, :users, :roles, :members, :member_roles, :repositories, :enabled_modules
25 fixtures :projects, :users, :roles, :members, :member_roles,
26 :repositories, :enabled_modules
26
27
27 # No '..' in the repository path
28 REPOSITORY_PATH = Rails.root.join('tmp/test/git_repository').to_s
28 REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/git_repository'
29 REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin?
29 REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin?
30 PRJ_ID = 3
30 PRJ_ID = 3
31 CHAR_1_HEX = "\xc3\x9c"
31 CHAR_1_HEX = "\xc3\x9c"
32
32
33 ## Git, Mercurial and CVS path encodings are binary.
33 ## Git, Mercurial and CVS path encodings are binary.
34 ## Subversion supports URL encoding for path.
34 ## Subversion supports URL encoding for path.
35 ## Redmine Mercurial adapter and extension use URL encoding.
35 ## Redmine Mercurial adapter and extension use URL encoding.
36 ## Git accepts only binary path in command line parameter.
36 ## Git accepts only binary path in command line parameter.
37 ## So, there is no way to use binary command line parameter in JRuby.
37 ## So, there is no way to use binary command line parameter in JRuby.
38 JRUBY_SKIP = (RUBY_PLATFORM == 'java')
38 JRUBY_SKIP = (RUBY_PLATFORM == 'java')
39 JRUBY_SKIP_STR = "TODO: This test fails in JRuby"
39 JRUBY_SKIP_STR = "TODO: This test fails in JRuby"
40
40
41 def setup
41 def setup
42 @ruby19_non_utf8_pass =
42 @ruby19_non_utf8_pass =
43 (RUBY_VERSION >= '1.9' && Encoding.default_external.to_s != 'UTF-8')
43 (RUBY_VERSION >= '1.9' && Encoding.default_external.to_s != 'UTF-8')
44
44
45 @controller = RepositoriesController.new
45 @controller = RepositoriesController.new
46 @request = ActionController::TestRequest.new
46 @request = ActionController::TestRequest.new
47 @response = ActionController::TestResponse.new
47 @response = ActionController::TestResponse.new
48 User.current = nil
48 User.current = nil
49 @repository = Repository::Git.create(
49 @repository = Repository::Git.create(
50 :project => Project.find(3),
50 :project => Project.find(3),
51 :url => REPOSITORY_PATH,
51 :url => REPOSITORY_PATH,
52 :path_encoding => 'ISO-8859-1'
52 :path_encoding => 'ISO-8859-1'
53 )
53 )
54 assert @repository
54 assert @repository
55 @char_1 = CHAR_1_HEX.dup
55 @char_1 = CHAR_1_HEX.dup
56 if @char_1.respond_to?(:force_encoding)
56 if @char_1.respond_to?(:force_encoding)
57 @char_1.force_encoding('UTF-8')
57 @char_1.force_encoding('UTF-8')
58 end
58 end
59 end
59 end
60
60
61 if File.directory?(REPOSITORY_PATH)
61 if File.directory?(REPOSITORY_PATH)
62 def test_browse_root
62 def test_browse_root
63 @repository.fetch_changesets
63 @repository.fetch_changesets
64 @repository.reload
64 @repository.reload
65 get :show, :id => PRJ_ID
65 get :show, :id => PRJ_ID
66 assert_response :success
66 assert_response :success
67 assert_template 'show'
67 assert_template 'show'
68 assert_not_nil assigns(:entries)
68 assert_not_nil assigns(:entries)
69 assert_equal 9, assigns(:entries).size
69 assert_equal 9, assigns(:entries).size
70 assert assigns(:entries).detect {|e| e.name == 'images' && e.kind == 'dir'}
70 assert assigns(:entries).detect {|e| e.name == 'images' && e.kind == 'dir'}
71 assert assigns(:entries).detect {|e| e.name == 'this_is_a_really_long_and_verbose_directory_name' && e.kind == 'dir'}
71 assert assigns(:entries).detect {|e| e.name == 'this_is_a_really_long_and_verbose_directory_name' && e.kind == 'dir'}
72 assert assigns(:entries).detect {|e| e.name == 'sources' && e.kind == 'dir'}
72 assert assigns(:entries).detect {|e| e.name == 'sources' && e.kind == 'dir'}
73 assert assigns(:entries).detect {|e| e.name == 'README' && e.kind == 'file'}
73 assert assigns(:entries).detect {|e| e.name == 'README' && e.kind == 'file'}
74 assert assigns(:entries).detect {|e| e.name == 'copied_README' && e.kind == 'file'}
74 assert assigns(:entries).detect {|e| e.name == 'copied_README' && e.kind == 'file'}
75 assert assigns(:entries).detect {|e| e.name == 'new_file.txt' && e.kind == 'file'}
75 assert assigns(:entries).detect {|e| e.name == 'new_file.txt' && e.kind == 'file'}
76 assert assigns(:entries).detect {|e| e.name == 'renamed_test.txt' && e.kind == 'file'}
76 assert assigns(:entries).detect {|e| e.name == 'renamed_test.txt' && e.kind == 'file'}
77 assert assigns(:entries).detect {|e| e.name == 'filemane with spaces.txt' && e.kind == 'file'}
77 assert assigns(:entries).detect {|e| e.name == 'filemane with spaces.txt' && e.kind == 'file'}
78 assert assigns(:entries).detect {|e| e.name == ' filename with a leading space.txt ' && e.kind == 'file'}
78 assert assigns(:entries).detect {|e| e.name == ' filename with a leading space.txt ' && e.kind == 'file'}
79 assert_not_nil assigns(:changesets)
79 assert_not_nil assigns(:changesets)
80 assigns(:changesets).size > 0
80 assigns(:changesets).size > 0
81 end
81 end
82
82
83 def test_browse_branch
83 def test_browse_branch
84 @repository.fetch_changesets
84 @repository.fetch_changesets
85 @repository.reload
85 @repository.reload
86 get :show, :id => PRJ_ID, :rev => 'test_branch'
86 get :show, :id => PRJ_ID, :rev => 'test_branch'
87 assert_response :success
87 assert_response :success
88 assert_template 'show'
88 assert_template 'show'
89 assert_not_nil assigns(:entries)
89 assert_not_nil assigns(:entries)
90 assert_equal 4, assigns(:entries).size
90 assert_equal 4, assigns(:entries).size
91 assert assigns(:entries).detect {|e| e.name == 'images' && e.kind == 'dir'}
91 assert assigns(:entries).detect {|e| e.name == 'images' && e.kind == 'dir'}
92 assert assigns(:entries).detect {|e| e.name == 'sources' && e.kind == 'dir'}
92 assert assigns(:entries).detect {|e| e.name == 'sources' && e.kind == 'dir'}
93 assert assigns(:entries).detect {|e| e.name == 'README' && e.kind == 'file'}
93 assert assigns(:entries).detect {|e| e.name == 'README' && e.kind == 'file'}
94 assert assigns(:entries).detect {|e| e.name == 'test.txt' && e.kind == 'file'}
94 assert assigns(:entries).detect {|e| e.name == 'test.txt' && e.kind == 'file'}
95 assert_not_nil assigns(:changesets)
95 assert_not_nil assigns(:changesets)
96 assigns(:changesets).size > 0
96 assigns(:changesets).size > 0
97 end
97 end
98
98
99 def test_browse_tag
99 def test_browse_tag
100 @repository.fetch_changesets
100 @repository.fetch_changesets
101 @repository.reload
101 @repository.reload
102 [
102 [
103 "tag00.lightweight",
103 "tag00.lightweight",
104 "tag01.annotated",
104 "tag01.annotated",
105 ].each do |t1|
105 ].each do |t1|
106 get :show, :id => PRJ_ID, :rev => t1
106 get :show, :id => PRJ_ID, :rev => t1
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 assigns(:entries).size > 0
110 assigns(:entries).size > 0
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_browse_directory
116 def test_browse_directory
117 @repository.fetch_changesets
117 @repository.fetch_changesets
118 @repository.reload
118 @repository.reload
119 get :show, :id => PRJ_ID, :path => ['images']
119 get :show, :id => PRJ_ID, :path => ['images']
120 assert_response :success
120 assert_response :success
121 assert_template 'show'
121 assert_template 'show'
122 assert_not_nil assigns(:entries)
122 assert_not_nil assigns(:entries)
123 assert_equal ['edit.png'], assigns(:entries).collect(&:name)
123 assert_equal ['edit.png'], assigns(:entries).collect(&:name)
124 entry = assigns(:entries).detect {|e| e.name == 'edit.png'}
124 entry = assigns(:entries).detect {|e| e.name == 'edit.png'}
125 assert_not_nil entry
125 assert_not_nil entry
126 assert_equal 'file', entry.kind
126 assert_equal 'file', entry.kind
127 assert_equal 'images/edit.png', entry.path
127 assert_equal 'images/edit.png', entry.path
128 assert_not_nil assigns(:changesets)
128 assert_not_nil assigns(:changesets)
129 assigns(:changesets).size > 0
129 assigns(:changesets).size > 0
130 end
130 end
131
131
132 def test_browse_at_given_revision
132 def test_browse_at_given_revision
133 @repository.fetch_changesets
133 @repository.fetch_changesets
134 @repository.reload
134 @repository.reload
135 get :show, :id => PRJ_ID, :path => ['images'],
135 get :show, :id => PRJ_ID, :path => ['images'],
136 :rev => '7234cb2750b63f47bff735edc50a1c0a433c2518'
136 :rev => '7234cb2750b63f47bff735edc50a1c0a433c2518'
137 assert_response :success
137 assert_response :success
138 assert_template 'show'
138 assert_template 'show'
139 assert_not_nil assigns(:entries)
139 assert_not_nil assigns(:entries)
140 assert_equal ['delete.png'], assigns(:entries).collect(&:name)
140 assert_equal ['delete.png'], assigns(:entries).collect(&:name)
141 assert_not_nil assigns(:changesets)
141 assert_not_nil assigns(:changesets)
142 assigns(:changesets).size > 0
142 assigns(:changesets).size > 0
143 end
143 end
144
144
145 def test_changes
145 def test_changes
146 get :changes, :id => PRJ_ID, :path => ['images', 'edit.png']
146 get :changes, :id => PRJ_ID, :path => ['images', 'edit.png']
147 assert_response :success
147 assert_response :success
148 assert_template 'changes'
148 assert_template 'changes'
149 assert_tag :tag => 'h2', :content => 'edit.png'
149 assert_tag :tag => 'h2', :content => 'edit.png'
150 end
150 end
151
151
152 def test_entry_show
152 def test_entry_show
153 get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb']
153 get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb']
154 assert_response :success
154 assert_response :success
155 assert_template 'entry'
155 assert_template 'entry'
156 # Line 19
156 # Line 19
157 assert_tag :tag => 'th',
157 assert_tag :tag => 'th',
158 :content => '11',
158 :content => '11',
159 :attributes => { :class => 'line-num' },
159 :attributes => { :class => 'line-num' },
160 :sibling => { :tag => 'td', :content => /WITHOUT ANY WARRANTY/ }
160 :sibling => { :tag => 'td', :content => /WITHOUT ANY WARRANTY/ }
161 end
161 end
162
162
163 def test_entry_show_latin_1
163 def test_entry_show_latin_1
164 if @ruby19_non_utf8_pass
164 if @ruby19_non_utf8_pass
165 puts_ruby19_non_utf8_pass()
165 puts_ruby19_non_utf8_pass()
166 elsif JRUBY_SKIP
166 elsif JRUBY_SKIP
167 puts JRUBY_SKIP_STR
167 puts JRUBY_SKIP_STR
168 else
168 else
169 with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
169 with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
170 ['57ca437c', '57ca437c0acbbcb749821fdf3726a1367056d364'].each do |r1|
170 ['57ca437c', '57ca437c0acbbcb749821fdf3726a1367056d364'].each do |r1|
171 get :entry, :id => PRJ_ID,
171 get :entry, :id => PRJ_ID,
172 :path => ['latin-1-dir', "test-#{@char_1}.txt"], :rev => r1
172 :path => ['latin-1-dir', "test-#{@char_1}.txt"], :rev => r1
173 assert_response :success
173 assert_response :success
174 assert_template 'entry'
174 assert_template 'entry'
175 assert_tag :tag => 'th',
175 assert_tag :tag => 'th',
176 :content => '1',
176 :content => '1',
177 :attributes => { :class => 'line-num' },
177 :attributes => { :class => 'line-num' },
178 :sibling => { :tag => 'td',
178 :sibling => { :tag => 'td',
179 :content => /test-#{@char_1}.txt/ }
179 :content => /test-#{@char_1}.txt/ }
180 end
180 end
181 end
181 end
182 end
182 end
183 end
183 end
184
184
185 def test_entry_download
185 def test_entry_download
186 get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb'],
186 get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb'],
187 :format => 'raw'
187 :format => 'raw'
188 assert_response :success
188 assert_response :success
189 # File content
189 # File content
190 assert @response.body.include?('WITHOUT ANY WARRANTY')
190 assert @response.body.include?('WITHOUT ANY WARRANTY')
191 end
191 end
192
192
193 def test_directory_entry
193 def test_directory_entry
194 get :entry, :id => PRJ_ID, :path => ['sources']
194 get :entry, :id => PRJ_ID, :path => ['sources']
195 assert_response :success
195 assert_response :success
196 assert_template 'show'
196 assert_template 'show'
197 assert_not_nil assigns(:entry)
197 assert_not_nil assigns(:entry)
198 assert_equal 'sources', assigns(:entry).name
198 assert_equal 'sources', assigns(:entry).name
199 end
199 end
200
200
201 def test_diff
201 def test_diff
202 @repository.fetch_changesets
202 @repository.fetch_changesets
203 @repository.reload
203 @repository.reload
204 # Full diff of changeset 2f9c0091
204 # Full diff of changeset 2f9c0091
205 ['inline', 'sbs'].each do |dt|
205 ['inline', 'sbs'].each do |dt|
206 get :diff,
206 get :diff,
207 :id => PRJ_ID,
207 :id => PRJ_ID,
208 :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7',
208 :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7',
209 :type => dt
209 :type => dt
210 assert_response :success
210 assert_response :success
211 assert_template 'diff'
211 assert_template 'diff'
212 # Line 22 removed
212 # Line 22 removed
213 assert_tag :tag => 'th',
213 assert_tag :tag => 'th',
214 :content => /22/,
214 :content => /22/,
215 :sibling => { :tag => 'td',
215 :sibling => { :tag => 'td',
216 :attributes => { :class => /diff_out/ },
216 :attributes => { :class => /diff_out/ },
217 :content => /def remove/ }
217 :content => /def remove/ }
218 assert_tag :tag => 'h2', :content => /2f9c0091/
218 assert_tag :tag => 'h2', :content => /2f9c0091/
219 end
219 end
220 end
220 end
221
221
222 def test_diff_two_revs
222 def test_diff_two_revs
223 @repository.fetch_changesets
223 @repository.fetch_changesets
224 @repository.reload
224 @repository.reload
225 ['inline', 'sbs'].each do |dt|
225 ['inline', 'sbs'].each do |dt|
226 get :diff,
226 get :diff,
227 :id => PRJ_ID,
227 :id => PRJ_ID,
228 :rev => '61b685fbe55ab05b5ac68402d5720c1a6ac973d1',
228 :rev => '61b685fbe55ab05b5ac68402d5720c1a6ac973d1',
229 :rev_to => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7',
229 :rev_to => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7',
230 :type => dt
230 :type => dt
231 assert_response :success
231 assert_response :success
232 assert_template 'diff'
232 assert_template 'diff'
233 diff = assigns(:diff)
233 diff = assigns(:diff)
234 assert_not_nil diff
234 assert_not_nil diff
235 assert_tag :tag => 'h2', :content => /2f9c0091:61b685fb/
235 assert_tag :tag => 'h2', :content => /2f9c0091:61b685fb/
236 end
236 end
237 end
237 end
238
238
239 def test_diff_latin_1
239 def test_diff_latin_1
240 if @ruby19_non_utf8_pass
240 if @ruby19_non_utf8_pass
241 puts_ruby19_non_utf8_pass()
241 puts_ruby19_non_utf8_pass()
242 else
242 else
243 with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
243 with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
244 ['57ca437c', '57ca437c0acbbcb749821fdf3726a1367056d364'].each do |r1|
244 ['57ca437c', '57ca437c0acbbcb749821fdf3726a1367056d364'].each do |r1|
245 ['inline', 'sbs'].each do |dt|
245 ['inline', 'sbs'].each do |dt|
246 get :diff, :id => PRJ_ID, :rev => r1, :type => dt
246 get :diff, :id => PRJ_ID, :rev => r1, :type => dt
247 assert_response :success
247 assert_response :success
248 assert_template 'diff'
248 assert_template 'diff'
249 assert_tag :tag => 'thead',
249 assert_tag :tag => 'thead',
250 :descendant => {
250 :descendant => {
251 :tag => 'th',
251 :tag => 'th',
252 :attributes => { :class => 'filename' } ,
252 :attributes => { :class => 'filename' } ,
253 :content => /latin-1-dir\/test-#{@char_1}.txt/ ,
253 :content => /latin-1-dir\/test-#{@char_1}.txt/ ,
254 },
254 },
255 :sibling => {
255 :sibling => {
256 :tag => 'tbody',
256 :tag => 'tbody',
257 :descendant => {
257 :descendant => {
258 :tag => 'td',
258 :tag => 'td',
259 :attributes => { :class => /diff_in/ },
259 :attributes => { :class => /diff_in/ },
260 :content => /test-#{@char_1}.txt/
260 :content => /test-#{@char_1}.txt/
261 }
261 }
262 }
262 }
263 end
263 end
264 end
264 end
265 end
265 end
266 end
266 end
267 end
267 end
268
268
269 def test_annotate
269 def test_annotate
270 get :annotate, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb']
270 get :annotate, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb']
271 assert_response :success
271 assert_response :success
272 assert_template 'annotate'
272 assert_template 'annotate'
273 # Line 24, changeset 2f9c0091
273 # Line 24, changeset 2f9c0091
274 assert_tag :tag => 'th', :content => '24',
274 assert_tag :tag => 'th', :content => '24',
275 :sibling => {
275 :sibling => {
276 :tag => 'td',
276 :tag => 'td',
277 :child => {
277 :child => {
278 :tag => 'a',
278 :tag => 'a',
279 :content => /2f9c0091/
279 :content => /2f9c0091/
280 }
280 }
281 }
281 }
282 assert_tag :tag => 'th', :content => '24',
282 assert_tag :tag => 'th', :content => '24',
283 :sibling => { :tag => 'td', :content => /jsmith/ }
283 :sibling => { :tag => 'td', :content => /jsmith/ }
284 assert_tag :tag => 'th', :content => '24',
284 assert_tag :tag => 'th', :content => '24',
285 :sibling => {
285 :sibling => {
286 :tag => 'td',
286 :tag => 'td',
287 :child => {
287 :child => {
288 :tag => 'a',
288 :tag => 'a',
289 :content => /2f9c0091/
289 :content => /2f9c0091/
290 }
290 }
291 }
291 }
292 assert_tag :tag => 'th', :content => '24',
292 assert_tag :tag => 'th', :content => '24',
293 :sibling => { :tag => 'td', :content => /watcher =/ }
293 :sibling => { :tag => 'td', :content => /watcher =/ }
294 end
294 end
295
295
296 def test_annotate_at_given_revision
296 def test_annotate_at_given_revision
297 @repository.fetch_changesets
297 @repository.fetch_changesets
298 @repository.reload
298 @repository.reload
299 get :annotate, :id => PRJ_ID, :rev => 'deff7',
299 get :annotate, :id => PRJ_ID, :rev => 'deff7',
300 :path => ['sources', 'watchers_controller.rb']
300 :path => ['sources', 'watchers_controller.rb']
301 assert_response :success
301 assert_response :success
302 assert_template 'annotate'
302 assert_template 'annotate'
303 assert_tag :tag => 'h2', :content => /@ deff712f/
303 assert_tag :tag => 'h2', :content => /@ deff712f/
304 end
304 end
305
305
306 def test_annotate_binary_file
306 def test_annotate_binary_file
307 get :annotate, :id => PRJ_ID, :path => ['images', 'edit.png']
307 get :annotate, :id => PRJ_ID, :path => ['images', 'edit.png']
308 assert_response 500
308 assert_response 500
309 assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
309 assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
310 :content => /cannot be annotated/
310 :content => /cannot be annotated/
311 end
311 end
312
312
313 def test_annotate_latin_1
313 def test_annotate_latin_1
314 if @ruby19_non_utf8_pass
314 if @ruby19_non_utf8_pass
315 puts_ruby19_non_utf8_pass()
315 puts_ruby19_non_utf8_pass()
316 elsif JRUBY_SKIP
316 elsif JRUBY_SKIP
317 puts JRUBY_SKIP_STR
317 puts JRUBY_SKIP_STR
318 else
318 else
319 with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
319 with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
320 ['57ca437c', '57ca437c0acbbcb749821fdf3726a1367056d364'].each do |r1|
320 ['57ca437c', '57ca437c0acbbcb749821fdf3726a1367056d364'].each do |r1|
321 get :annotate, :id => PRJ_ID,
321 get :annotate, :id => PRJ_ID,
322 :path => ['latin-1-dir', "test-#{@char_1}.txt"], :rev => r1
322 :path => ['latin-1-dir', "test-#{@char_1}.txt"], :rev => r1
323 assert_tag :tag => 'th',
323 assert_tag :tag => 'th',
324 :content => '1',
324 :content => '1',
325 :attributes => { :class => 'line-num' },
325 :attributes => { :class => 'line-num' },
326 :sibling => { :tag => 'td',
326 :sibling => { :tag => 'td',
327 :content => /test-#{@char_1}.txt/ }
327 :content => /test-#{@char_1}.txt/ }
328 end
328 end
329 end
329 end
330 end
330 end
331 end
331 end
332
332
333 def test_revision
333 def test_revision
334 @repository.fetch_changesets
334 @repository.fetch_changesets
335 @repository.reload
335 @repository.reload
336 ['61b685fbe55ab05b5ac68402d5720c1a6ac973d1', '61b685f'].each do |r|
336 ['61b685fbe55ab05b5ac68402d5720c1a6ac973d1', '61b685f'].each do |r|
337 get :revision, :id => PRJ_ID, :rev => r
337 get :revision, :id => PRJ_ID, :rev => r
338 assert_response :success
338 assert_response :success
339 assert_template 'revision'
339 assert_template 'revision'
340 end
340 end
341 end
341 end
342
342
343 def test_empty_revision
343 def test_empty_revision
344 @repository.fetch_changesets
344 @repository.fetch_changesets
345 @repository.reload
345 @repository.reload
346 ['', ' ', nil].each do |r|
346 ['', ' ', nil].each do |r|
347 get :revision, :id => PRJ_ID, :rev => r
347 get :revision, :id => PRJ_ID, :rev => r
348 assert_response 404
348 assert_response 404
349 assert_error_tag :content => /was not found/
349 assert_error_tag :content => /was not found/
350 end
350 end
351 end
351 end
352
352
353 private
353 private
354
354
355 def puts_ruby19_non_utf8_pass
355 def puts_ruby19_non_utf8_pass
356 puts "TODO: This test fails in Ruby 1.9 " +
356 puts "TODO: This test fails in Ruby 1.9 " +
357 "and Encoding.default_external is not UTF-8. " +
357 "and Encoding.default_external is not UTF-8. " +
358 "Current value is '#{Encoding.default_external.to_s}'"
358 "Current value is '#{Encoding.default_external.to_s}'"
359 end
359 end
360 else
360 else
361 puts "Git test repository NOT FOUND. Skipping functional tests !!!"
361 puts "Git test repository NOT FOUND. Skipping functional tests !!!"
362 def test_fake; assert true end
362 def test_fake; assert true end
363 end
363 end
364 end
364 end
General Comments 0
You need to be logged in to leave comments. Login now