##// END OF EJS Templates
scm: git: run both "inline" and "side by side" diff in functional test_diff_latin_1 test....
Toshi MARUYAMA -
r5854:41a439d052b7
parent child
Show More
@@ -1,348 +1,350
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, :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/git_repository'
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 def setup
33 def setup
34 @ruby19_non_utf8_pass =
34 @ruby19_non_utf8_pass =
35 (RUBY_VERSION >= '1.9' && Encoding.default_external.to_s != 'UTF-8')
35 (RUBY_VERSION >= '1.9' && Encoding.default_external.to_s != 'UTF-8')
36
36
37 @controller = RepositoriesController.new
37 @controller = RepositoriesController.new
38 @request = ActionController::TestRequest.new
38 @request = ActionController::TestRequest.new
39 @response = ActionController::TestResponse.new
39 @response = ActionController::TestResponse.new
40 User.current = nil
40 User.current = nil
41 @repository = Repository::Git.create(
41 @repository = Repository::Git.create(
42 :project => Project.find(3),
42 :project => Project.find(3),
43 :url => REPOSITORY_PATH,
43 :url => REPOSITORY_PATH,
44 :path_encoding => 'ISO-8859-1'
44 :path_encoding => 'ISO-8859-1'
45 )
45 )
46 assert @repository
46 assert @repository
47 @char_1 = CHAR_1_HEX.dup
47 @char_1 = CHAR_1_HEX.dup
48 if @char_1.respond_to?(:force_encoding)
48 if @char_1.respond_to?(:force_encoding)
49 @char_1.force_encoding('UTF-8')
49 @char_1.force_encoding('UTF-8')
50 end
50 end
51 end
51 end
52
52
53 if File.directory?(REPOSITORY_PATH)
53 if File.directory?(REPOSITORY_PATH)
54 def test_browse_root
54 def test_browse_root
55 @repository.fetch_changesets
55 @repository.fetch_changesets
56 @repository.reload
56 @repository.reload
57 get :show, :id => PRJ_ID
57 get :show, :id => PRJ_ID
58 assert_response :success
58 assert_response :success
59 assert_template 'show'
59 assert_template 'show'
60 assert_not_nil assigns(:entries)
60 assert_not_nil assigns(:entries)
61 assert_equal 9, assigns(:entries).size
61 assert_equal 9, assigns(:entries).size
62 assert assigns(:entries).detect {|e| e.name == 'images' && e.kind == 'dir'}
62 assert assigns(:entries).detect {|e| e.name == 'images' && e.kind == 'dir'}
63 assert assigns(:entries).detect {|e| e.name == 'this_is_a_really_long_and_verbose_directory_name' && e.kind == 'dir'}
63 assert assigns(:entries).detect {|e| e.name == 'this_is_a_really_long_and_verbose_directory_name' && e.kind == 'dir'}
64 assert assigns(:entries).detect {|e| e.name == 'sources' && e.kind == 'dir'}
64 assert assigns(:entries).detect {|e| e.name == 'sources' && e.kind == 'dir'}
65 assert assigns(:entries).detect {|e| e.name == 'README' && e.kind == 'file'}
65 assert assigns(:entries).detect {|e| e.name == 'README' && e.kind == 'file'}
66 assert assigns(:entries).detect {|e| e.name == 'copied_README' && e.kind == 'file'}
66 assert assigns(:entries).detect {|e| e.name == 'copied_README' && e.kind == 'file'}
67 assert assigns(:entries).detect {|e| e.name == 'new_file.txt' && e.kind == 'file'}
67 assert assigns(:entries).detect {|e| e.name == 'new_file.txt' && e.kind == 'file'}
68 assert assigns(:entries).detect {|e| e.name == 'renamed_test.txt' && e.kind == 'file'}
68 assert assigns(:entries).detect {|e| e.name == 'renamed_test.txt' && e.kind == 'file'}
69 assert assigns(:entries).detect {|e| e.name == 'filemane with spaces.txt' && e.kind == 'file'}
69 assert assigns(:entries).detect {|e| e.name == 'filemane with spaces.txt' && e.kind == 'file'}
70 assert assigns(:entries).detect {|e| e.name == ' filename with a leading space.txt ' && e.kind == 'file'}
70 assert assigns(:entries).detect {|e| e.name == ' filename with a leading space.txt ' && e.kind == 'file'}
71 assert_not_nil assigns(:changesets)
71 assert_not_nil assigns(:changesets)
72 assigns(:changesets).size > 0
72 assigns(:changesets).size > 0
73 end
73 end
74
74
75 def test_browse_branch
75 def test_browse_branch
76 @repository.fetch_changesets
76 @repository.fetch_changesets
77 @repository.reload
77 @repository.reload
78 get :show, :id => PRJ_ID, :rev => 'test_branch'
78 get :show, :id => PRJ_ID, :rev => 'test_branch'
79 assert_response :success
79 assert_response :success
80 assert_template 'show'
80 assert_template 'show'
81 assert_not_nil assigns(:entries)
81 assert_not_nil assigns(:entries)
82 assert_equal 4, assigns(:entries).size
82 assert_equal 4, assigns(:entries).size
83 assert assigns(:entries).detect {|e| e.name == 'images' && e.kind == 'dir'}
83 assert assigns(:entries).detect {|e| e.name == 'images' && e.kind == 'dir'}
84 assert assigns(:entries).detect {|e| e.name == 'sources' && e.kind == 'dir'}
84 assert assigns(:entries).detect {|e| e.name == 'sources' && e.kind == 'dir'}
85 assert assigns(:entries).detect {|e| e.name == 'README' && e.kind == 'file'}
85 assert assigns(:entries).detect {|e| e.name == 'README' && e.kind == 'file'}
86 assert assigns(:entries).detect {|e| e.name == 'test.txt' && e.kind == 'file'}
86 assert assigns(:entries).detect {|e| e.name == 'test.txt' && e.kind == 'file'}
87 assert_not_nil assigns(:changesets)
87 assert_not_nil assigns(:changesets)
88 assigns(:changesets).size > 0
88 assigns(:changesets).size > 0
89 end
89 end
90
90
91 def test_browse_tag
91 def test_browse_tag
92 @repository.fetch_changesets
92 @repository.fetch_changesets
93 @repository.reload
93 @repository.reload
94 [
94 [
95 "tag00.lightweight",
95 "tag00.lightweight",
96 "tag01.annotated",
96 "tag01.annotated",
97 ].each do |t1|
97 ].each do |t1|
98 get :show, :id => PRJ_ID, :rev => t1
98 get :show, :id => PRJ_ID, :rev => t1
99 assert_response :success
99 assert_response :success
100 assert_template 'show'
100 assert_template 'show'
101 assert_not_nil assigns(:entries)
101 assert_not_nil assigns(:entries)
102 assigns(:entries).size > 0
102 assigns(:entries).size > 0
103 assert_not_nil assigns(:changesets)
103 assert_not_nil assigns(:changesets)
104 assigns(:changesets).size > 0
104 assigns(:changesets).size > 0
105 end
105 end
106 end
106 end
107
107
108 def test_browse_directory
108 def test_browse_directory
109 @repository.fetch_changesets
109 @repository.fetch_changesets
110 @repository.reload
110 @repository.reload
111 get :show, :id => PRJ_ID, :path => ['images']
111 get :show, :id => PRJ_ID, :path => ['images']
112 assert_response :success
112 assert_response :success
113 assert_template 'show'
113 assert_template 'show'
114 assert_not_nil assigns(:entries)
114 assert_not_nil assigns(:entries)
115 assert_equal ['edit.png'], assigns(:entries).collect(&:name)
115 assert_equal ['edit.png'], assigns(:entries).collect(&:name)
116 entry = assigns(:entries).detect {|e| e.name == 'edit.png'}
116 entry = assigns(:entries).detect {|e| e.name == 'edit.png'}
117 assert_not_nil entry
117 assert_not_nil entry
118 assert_equal 'file', entry.kind
118 assert_equal 'file', entry.kind
119 assert_equal 'images/edit.png', entry.path
119 assert_equal 'images/edit.png', entry.path
120 assert_not_nil assigns(:changesets)
120 assert_not_nil assigns(:changesets)
121 assigns(:changesets).size > 0
121 assigns(:changesets).size > 0
122 end
122 end
123
123
124 def test_browse_at_given_revision
124 def test_browse_at_given_revision
125 @repository.fetch_changesets
125 @repository.fetch_changesets
126 @repository.reload
126 @repository.reload
127 get :show, :id => PRJ_ID, :path => ['images'],
127 get :show, :id => PRJ_ID, :path => ['images'],
128 :rev => '7234cb2750b63f47bff735edc50a1c0a433c2518'
128 :rev => '7234cb2750b63f47bff735edc50a1c0a433c2518'
129 assert_response :success
129 assert_response :success
130 assert_template 'show'
130 assert_template 'show'
131 assert_not_nil assigns(:entries)
131 assert_not_nil assigns(:entries)
132 assert_equal ['delete.png'], assigns(:entries).collect(&:name)
132 assert_equal ['delete.png'], assigns(:entries).collect(&:name)
133 assert_not_nil assigns(:changesets)
133 assert_not_nil assigns(:changesets)
134 assigns(:changesets).size > 0
134 assigns(:changesets).size > 0
135 end
135 end
136
136
137 def test_changes
137 def test_changes
138 get :changes, :id => PRJ_ID, :path => ['images', 'edit.png']
138 get :changes, :id => PRJ_ID, :path => ['images', 'edit.png']
139 assert_response :success
139 assert_response :success
140 assert_template 'changes'
140 assert_template 'changes'
141 assert_tag :tag => 'h2', :content => 'edit.png'
141 assert_tag :tag => 'h2', :content => 'edit.png'
142 end
142 end
143
143
144 def test_entry_show
144 def test_entry_show
145 get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb']
145 get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb']
146 assert_response :success
146 assert_response :success
147 assert_template 'entry'
147 assert_template 'entry'
148 # Line 19
148 # Line 19
149 assert_tag :tag => 'th',
149 assert_tag :tag => 'th',
150 :content => '11',
150 :content => '11',
151 :attributes => { :class => 'line-num' },
151 :attributes => { :class => 'line-num' },
152 :sibling => { :tag => 'td', :content => /WITHOUT ANY WARRANTY/ }
152 :sibling => { :tag => 'td', :content => /WITHOUT ANY WARRANTY/ }
153 end
153 end
154
154
155 def test_entry_show_latin_1
155 def test_entry_show_latin_1
156 if @ruby19_non_utf8_pass
156 if @ruby19_non_utf8_pass
157 puts_ruby19_non_utf8_pass()
157 puts_ruby19_non_utf8_pass()
158 else
158 else
159 with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
159 with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
160 ['57ca437c', '57ca437c0acbbcb749821fdf3726a1367056d364'].each do |r1|
160 ['57ca437c', '57ca437c0acbbcb749821fdf3726a1367056d364'].each do |r1|
161 get :entry, :id => PRJ_ID,
161 get :entry, :id => PRJ_ID,
162 :path => ['latin-1-dir', "test-#{@char_1}.txt"], :rev => r1
162 :path => ['latin-1-dir', "test-#{@char_1}.txt"], :rev => r1
163 assert_response :success
163 assert_response :success
164 assert_template 'entry'
164 assert_template 'entry'
165 assert_tag :tag => 'th',
165 assert_tag :tag => 'th',
166 :content => '1',
166 :content => '1',
167 :attributes => { :class => 'line-num' },
167 :attributes => { :class => 'line-num' },
168 :sibling => { :tag => 'td',
168 :sibling => { :tag => 'td',
169 :content => /test-#{@char_1}.txt/ }
169 :content => /test-#{@char_1}.txt/ }
170 end
170 end
171 end
171 end
172 end
172 end
173 end
173 end
174
174
175 def test_entry_download
175 def test_entry_download
176 get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb'],
176 get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb'],
177 :format => 'raw'
177 :format => 'raw'
178 assert_response :success
178 assert_response :success
179 # File content
179 # File content
180 assert @response.body.include?('WITHOUT ANY WARRANTY')
180 assert @response.body.include?('WITHOUT ANY WARRANTY')
181 end
181 end
182
182
183 def test_directory_entry
183 def test_directory_entry
184 get :entry, :id => PRJ_ID, :path => ['sources']
184 get :entry, :id => PRJ_ID, :path => ['sources']
185 assert_response :success
185 assert_response :success
186 assert_template 'show'
186 assert_template 'show'
187 assert_not_nil assigns(:entry)
187 assert_not_nil assigns(:entry)
188 assert_equal 'sources', assigns(:entry).name
188 assert_equal 'sources', assigns(:entry).name
189 end
189 end
190
190
191 def test_diff
191 def test_diff
192 @repository.fetch_changesets
192 @repository.fetch_changesets
193 @repository.reload
193 @repository.reload
194 # Full diff of changeset 2f9c0091
194 # Full diff of changeset 2f9c0091
195 ['inline', 'sbs'].each do |dt|
195 ['inline', 'sbs'].each do |dt|
196 get :diff,
196 get :diff,
197 :id => PRJ_ID,
197 :id => PRJ_ID,
198 :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7',
198 :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7',
199 :type => dt
199 :type => dt
200 assert_response :success
200 assert_response :success
201 assert_template 'diff'
201 assert_template 'diff'
202 # Line 22 removed
202 # Line 22 removed
203 assert_tag :tag => 'th',
203 assert_tag :tag => 'th',
204 :content => /22/,
204 :content => /22/,
205 :sibling => { :tag => 'td',
205 :sibling => { :tag => 'td',
206 :attributes => { :class => /diff_out/ },
206 :attributes => { :class => /diff_out/ },
207 :content => /def remove/ }
207 :content => /def remove/ }
208 assert_tag :tag => 'h2', :content => /2f9c0091/
208 assert_tag :tag => 'h2', :content => /2f9c0091/
209 end
209 end
210 end
210 end
211
211
212 def test_diff_two_revs
212 def test_diff_two_revs
213 @repository.fetch_changesets
213 @repository.fetch_changesets
214 @repository.reload
214 @repository.reload
215 ['inline', 'sbs'].each do |dt|
215 ['inline', 'sbs'].each do |dt|
216 get :diff,
216 get :diff,
217 :id => PRJ_ID,
217 :id => PRJ_ID,
218 :rev => '61b685fbe55ab05b5ac68402d5720c1a6ac973d1',
218 :rev => '61b685fbe55ab05b5ac68402d5720c1a6ac973d1',
219 :rev_to => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7',
219 :rev_to => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7',
220 :type => dt
220 :type => dt
221 assert_response :success
221 assert_response :success
222 assert_template 'diff'
222 assert_template 'diff'
223 diff = assigns(:diff)
223 diff = assigns(:diff)
224 assert_not_nil diff
224 assert_not_nil diff
225 assert_tag :tag => 'h2', :content => /2f9c0091:61b685fb/
225 assert_tag :tag => 'h2', :content => /2f9c0091:61b685fb/
226 end
226 end
227 end
227 end
228
228
229 def test_diff_latin_1
229 def test_diff_latin_1
230 if @ruby19_non_utf8_pass
230 if @ruby19_non_utf8_pass
231 puts_ruby19_non_utf8_pass()
231 puts_ruby19_non_utf8_pass()
232 else
232 else
233 with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
233 with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
234 ['57ca437c', '57ca437c0acbbcb749821fdf3726a1367056d364'].each do |r1|
234 ['57ca437c', '57ca437c0acbbcb749821fdf3726a1367056d364'].each do |r1|
235 get :diff, :id => PRJ_ID, :rev => r1
235 ['inline', 'sbs'].each do |dt|
236 assert_response :success
236 get :diff, :id => PRJ_ID, :rev => r1, :type => dt
237 assert_template 'diff'
237 assert_response :success
238 assert_tag :tag => 'thead',
238 assert_template 'diff'
239 :descendant => {
239 assert_tag :tag => 'thead',
240 :tag => 'th',
241 :attributes => { :class => 'filename' } ,
242 :content => /latin-1-dir\/test-#{@char_1}.txt/ ,
243 },
244 :sibling => {
245 :tag => 'tbody',
246 :descendant => {
240 :descendant => {
247 :tag => 'td',
241 :tag => 'th',
248 :attributes => { :class => /diff_in/ },
242 :attributes => { :class => 'filename' } ,
249 :content => /test-#{@char_1}.txt/
243 :content => /latin-1-dir\/test-#{@char_1}.txt/ ,
244 },
245 :sibling => {
246 :tag => 'tbody',
247 :descendant => {
248 :tag => 'td',
249 :attributes => { :class => /diff_in/ },
250 :content => /test-#{@char_1}.txt/
251 }
250 }
252 }
251 }
253 end
252 end
254 end
253 end
255 end
254 end
256 end
255 end
257 end
256
258
257 def test_annotate
259 def test_annotate
258 get :annotate, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb']
260 get :annotate, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb']
259 assert_response :success
261 assert_response :success
260 assert_template 'annotate'
262 assert_template 'annotate'
261 # Line 24, changeset 2f9c0091
263 # Line 24, changeset 2f9c0091
262 assert_tag :tag => 'th', :content => '24',
264 assert_tag :tag => 'th', :content => '24',
263 :sibling => {
265 :sibling => {
264 :tag => 'td',
266 :tag => 'td',
265 :child => {
267 :child => {
266 :tag => 'a',
268 :tag => 'a',
267 :content => /2f9c0091c754a91af7a9c478e36556b4bde8dcf7/
269 :content => /2f9c0091c754a91af7a9c478e36556b4bde8dcf7/
268 }
270 }
269 },
271 },
270 :sibling => { :tag => 'td', :content => /jsmith/ }
272 :sibling => { :tag => 'td', :content => /jsmith/ }
271 assert_tag :tag => 'th', :content => '24',
273 assert_tag :tag => 'th', :content => '24',
272 :sibling => {
274 :sibling => {
273 :tag => 'td',
275 :tag => 'td',
274 :child => {
276 :child => {
275 :tag => 'a',
277 :tag => 'a',
276 :content => /2f9c0091c754a91af7a9c478e36556b4bde8dcf7/
278 :content => /2f9c0091c754a91af7a9c478e36556b4bde8dcf7/
277 }
279 }
278 },
280 },
279 :sibling => { :tag => 'td', :content => /watcher =/ }
281 :sibling => { :tag => 'td', :content => /watcher =/ }
280 end
282 end
281
283
282 def test_annotate_at_given_revision
284 def test_annotate_at_given_revision
283 @repository.fetch_changesets
285 @repository.fetch_changesets
284 @repository.reload
286 @repository.reload
285 get :annotate, :id => PRJ_ID, :rev => 'deff7',
287 get :annotate, :id => PRJ_ID, :rev => 'deff7',
286 :path => ['sources', 'watchers_controller.rb']
288 :path => ['sources', 'watchers_controller.rb']
287 assert_response :success
289 assert_response :success
288 assert_template 'annotate'
290 assert_template 'annotate'
289 assert_tag :tag => 'h2', :content => /@ deff712f/
291 assert_tag :tag => 'h2', :content => /@ deff712f/
290 end
292 end
291
293
292 def test_annotate_binary_file
294 def test_annotate_binary_file
293 get :annotate, :id => PRJ_ID, :path => ['images', 'edit.png']
295 get :annotate, :id => PRJ_ID, :path => ['images', 'edit.png']
294 assert_response 500
296 assert_response 500
295 assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
297 assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
296 :content => /cannot be annotated/
298 :content => /cannot be annotated/
297 end
299 end
298
300
299 def test_annotate_latin_1
301 def test_annotate_latin_1
300 if @ruby19_non_utf8_pass
302 if @ruby19_non_utf8_pass
301 puts_ruby19_non_utf8_pass()
303 puts_ruby19_non_utf8_pass()
302 else
304 else
303 with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
305 with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
304 ['57ca437c', '57ca437c0acbbcb749821fdf3726a1367056d364'].each do |r1|
306 ['57ca437c', '57ca437c0acbbcb749821fdf3726a1367056d364'].each do |r1|
305 get :annotate, :id => PRJ_ID,
307 get :annotate, :id => PRJ_ID,
306 :path => ['latin-1-dir', "test-#{@char_1}.txt"], :rev => r1
308 :path => ['latin-1-dir', "test-#{@char_1}.txt"], :rev => r1
307 assert_tag :tag => 'th',
309 assert_tag :tag => 'th',
308 :content => '1',
310 :content => '1',
309 :attributes => { :class => 'line-num' },
311 :attributes => { :class => 'line-num' },
310 :sibling => { :tag => 'td',
312 :sibling => { :tag => 'td',
311 :content => /test-#{@char_1}.txt/ }
313 :content => /test-#{@char_1}.txt/ }
312 end
314 end
313 end
315 end
314 end
316 end
315 end
317 end
316
318
317 def test_revision
319 def test_revision
318 @repository.fetch_changesets
320 @repository.fetch_changesets
319 @repository.reload
321 @repository.reload
320 ['61b685fbe55ab05b5ac68402d5720c1a6ac973d1', '61b685f'].each do |r|
322 ['61b685fbe55ab05b5ac68402d5720c1a6ac973d1', '61b685f'].each do |r|
321 get :revision, :id => PRJ_ID, :rev => r
323 get :revision, :id => PRJ_ID, :rev => r
322 assert_response :success
324 assert_response :success
323 assert_template 'revision'
325 assert_template 'revision'
324 end
326 end
325 end
327 end
326
328
327 def test_empty_revision
329 def test_empty_revision
328 @repository.fetch_changesets
330 @repository.fetch_changesets
329 @repository.reload
331 @repository.reload
330 ['', ' ', nil].each do |r|
332 ['', ' ', nil].each do |r|
331 get :revision, :id => PRJ_ID, :rev => r
333 get :revision, :id => PRJ_ID, :rev => r
332 assert_response 404
334 assert_response 404
333 assert_error_tag :content => /was not found/
335 assert_error_tag :content => /was not found/
334 end
336 end
335 end
337 end
336
338
337 private
339 private
338
340
339 def puts_ruby19_non_utf8_pass
341 def puts_ruby19_non_utf8_pass
340 puts "TODO: This test fails in Ruby 1.9 " +
342 puts "TODO: This test fails in Ruby 1.9 " +
341 "and Encoding.default_external is not UTF-8. " +
343 "and Encoding.default_external is not UTF-8. " +
342 "Current value is '#{Encoding.default_external.to_s}'"
344 "Current value is '#{Encoding.default_external.to_s}'"
343 end
345 end
344 else
346 else
345 puts "Git test repository NOT FOUND. Skipping functional tests !!!"
347 puts "Git test repository NOT FOUND. Skipping functional tests !!!"
346 def test_fake; assert true end
348 def test_fake; assert true end
347 end
349 end
348 end
350 end
General Comments 0
You need to be logged in to leave comments. Login now