##// END OF EJS Templates
scm: functional test of using format_revision() for annotate (#3724)....
Toshi MARUYAMA -
r4614:ccdea234ad65
parent child
Show More
@@ -1,203 +1,212
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 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
30
31 def setup
31 def setup
32 @controller = RepositoriesController.new
32 @controller = RepositoriesController.new
33 @request = ActionController::TestRequest.new
33 @request = ActionController::TestRequest.new
34 @response = ActionController::TestResponse.new
34 @response = ActionController::TestResponse.new
35 User.current = nil
35 User.current = nil
36 @repository = Repository::Git.create(:project => Project.find(3), :url => REPOSITORY_PATH)
36 @repository = Repository::Git.create(:project => Project.find(3), :url => REPOSITORY_PATH)
37 assert @repository
37 assert @repository
38 end
38 end
39
39
40 if File.directory?(REPOSITORY_PATH)
40 if File.directory?(REPOSITORY_PATH)
41 def test_show
41 def test_show
42 get :show, :id => 3
42 get :show, :id => 3
43 assert_response :success
43 assert_response :success
44 assert_template 'show'
44 assert_template 'show'
45 assert_not_nil assigns(:entries)
45 assert_not_nil assigns(:entries)
46 assert_not_nil assigns(:changesets)
46 assert_not_nil assigns(:changesets)
47 end
47 end
48
48
49 def test_browse_root
49 def test_browse_root
50 get :show, :id => 3
50 get :show, :id => 3
51 assert_response :success
51 assert_response :success
52 assert_template 'show'
52 assert_template 'show'
53 assert_not_nil assigns(:entries)
53 assert_not_nil assigns(:entries)
54 assert_equal 9, assigns(:entries).size
54 assert_equal 9, assigns(:entries).size
55 assert assigns(:entries).detect {|e| e.name == 'images' && e.kind == 'dir'}
55 assert assigns(:entries).detect {|e| e.name == 'images' && e.kind == 'dir'}
56 assert assigns(:entries).detect {|e| e.name == 'this_is_a_really_long_and_verbose_directory_name' && e.kind == 'dir'}
56 assert assigns(:entries).detect {|e| e.name == 'this_is_a_really_long_and_verbose_directory_name' && e.kind == 'dir'}
57 assert assigns(:entries).detect {|e| e.name == 'sources' && e.kind == 'dir'}
57 assert assigns(:entries).detect {|e| e.name == 'sources' && e.kind == 'dir'}
58 assert assigns(:entries).detect {|e| e.name == 'README' && e.kind == 'file'}
58 assert assigns(:entries).detect {|e| e.name == 'README' && e.kind == 'file'}
59 assert assigns(:entries).detect {|e| e.name == 'copied_README' && e.kind == 'file'}
59 assert assigns(:entries).detect {|e| e.name == 'copied_README' && e.kind == 'file'}
60 assert assigns(:entries).detect {|e| e.name == 'new_file.txt' && e.kind == 'file'}
60 assert assigns(:entries).detect {|e| e.name == 'new_file.txt' && e.kind == 'file'}
61 assert assigns(:entries).detect {|e| e.name == 'renamed_test.txt' && e.kind == 'file'}
61 assert assigns(:entries).detect {|e| e.name == 'renamed_test.txt' && e.kind == 'file'}
62 assert assigns(:entries).detect {|e| e.name == 'filemane with spaces.txt' && e.kind == 'file'}
62 assert assigns(:entries).detect {|e| e.name == 'filemane with spaces.txt' && e.kind == 'file'}
63 assert assigns(:entries).detect {|e| e.name == ' filename with a leading space.txt ' && e.kind == 'file'}
63 assert assigns(:entries).detect {|e| e.name == ' filename with a leading space.txt ' && e.kind == 'file'}
64 end
64 end
65
65
66 def test_browse_branch
66 def test_browse_branch
67 get :show, :id => 3, :rev => 'test_branch'
67 get :show, :id => 3, :rev => 'test_branch'
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 assigns(:entries).detect {|e| e.name == 'test.txt' && e.kind == 'file'}
75 assert assigns(:entries).detect {|e| e.name == 'test.txt' && e.kind == 'file'}
76 end
76 end
77
77
78 def test_browse_directory
78 def test_browse_directory
79 get :show, :id => 3, :path => ['images']
79 get :show, :id => 3, :path => ['images']
80 assert_response :success
80 assert_response :success
81 assert_template 'show'
81 assert_template 'show'
82 assert_not_nil assigns(:entries)
82 assert_not_nil assigns(:entries)
83 assert_equal ['edit.png'], assigns(:entries).collect(&:name)
83 assert_equal ['edit.png'], assigns(:entries).collect(&:name)
84 entry = assigns(:entries).detect {|e| e.name == 'edit.png'}
84 entry = assigns(:entries).detect {|e| e.name == 'edit.png'}
85 assert_not_nil entry
85 assert_not_nil entry
86 assert_equal 'file', entry.kind
86 assert_equal 'file', entry.kind
87 assert_equal 'images/edit.png', entry.path
87 assert_equal 'images/edit.png', entry.path
88 end
88 end
89
89
90 def test_browse_at_given_revision
90 def test_browse_at_given_revision
91 get :show, :id => 3, :path => ['images'], :rev => '7234cb2750b63f47bff735edc50a1c0a433c2518'
91 get :show, :id => 3, :path => ['images'], :rev => '7234cb2750b63f47bff735edc50a1c0a433c2518'
92 assert_response :success
92 assert_response :success
93 assert_template 'show'
93 assert_template 'show'
94 assert_not_nil assigns(:entries)
94 assert_not_nil assigns(:entries)
95 assert_equal ['delete.png'], assigns(:entries).collect(&:name)
95 assert_equal ['delete.png'], assigns(:entries).collect(&:name)
96 end
96 end
97
97
98 def test_changes
98 def test_changes
99 get :changes, :id => 3, :path => ['images', 'edit.png']
99 get :changes, :id => 3, :path => ['images', 'edit.png']
100 assert_response :success
100 assert_response :success
101 assert_template 'changes'
101 assert_template 'changes'
102 assert_tag :tag => 'h2', :content => 'edit.png'
102 assert_tag :tag => 'h2', :content => 'edit.png'
103 end
103 end
104
104
105 def test_entry_show
105 def test_entry_show
106 get :entry, :id => 3, :path => ['sources', 'watchers_controller.rb']
106 get :entry, :id => 3, :path => ['sources', 'watchers_controller.rb']
107 assert_response :success
107 assert_response :success
108 assert_template 'entry'
108 assert_template 'entry'
109 # Line 19
109 # Line 19
110 assert_tag :tag => 'th',
110 assert_tag :tag => 'th',
111 :content => /11/,
111 :content => /11/,
112 :attributes => { :class => /line-num/ },
112 :attributes => { :class => /line-num/ },
113 :sibling => { :tag => 'td', :content => /WITHOUT ANY WARRANTY/ }
113 :sibling => { :tag => 'td', :content => /WITHOUT ANY WARRANTY/ }
114 end
114 end
115
115
116 def test_entry_download
116 def test_entry_download
117 get :entry, :id => 3, :path => ['sources', 'watchers_controller.rb'], :format => 'raw'
117 get :entry, :id => 3, :path => ['sources', 'watchers_controller.rb'], :format => 'raw'
118 assert_response :success
118 assert_response :success
119 # File content
119 # File content
120 assert @response.body.include?('WITHOUT ANY WARRANTY')
120 assert @response.body.include?('WITHOUT ANY WARRANTY')
121 end
121 end
122
122
123 def test_directory_entry
123 def test_directory_entry
124 get :entry, :id => 3, :path => ['sources']
124 get :entry, :id => 3, :path => ['sources']
125 assert_response :success
125 assert_response :success
126 assert_template 'show'
126 assert_template 'show'
127 assert_not_nil assigns(:entry)
127 assert_not_nil assigns(:entry)
128 assert_equal 'sources', assigns(:entry).name
128 assert_equal 'sources', assigns(:entry).name
129 end
129 end
130
130
131 def test_diff
131 def test_diff
132 @repository.fetch_changesets
132 @repository.fetch_changesets
133 @repository.reload
133 @repository.reload
134
134
135 # Full diff of changeset 2f9c0091
135 # Full diff of changeset 2f9c0091
136 get :diff, :id => 3, :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
136 get :diff, :id => 3, :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
137 assert_response :success
137 assert_response :success
138 assert_template 'diff'
138 assert_template 'diff'
139 # Line 22 removed
139 # Line 22 removed
140 assert_tag :tag => 'th',
140 assert_tag :tag => 'th',
141 :content => /22/,
141 :content => /22/,
142 :sibling => { :tag => 'td',
142 :sibling => { :tag => 'td',
143 :attributes => { :class => /diff_out/ },
143 :attributes => { :class => /diff_out/ },
144 :content => /def remove/ }
144 :content => /def remove/ }
145 assert_tag :tag => 'h2', :content => /2f9c0091/
145 assert_tag :tag => 'h2', :content => /2f9c0091/
146 end
146 end
147
147
148 def test_diff_two_revs
148 def test_diff_two_revs
149 @repository.fetch_changesets
149 @repository.fetch_changesets
150 @repository.reload
150 @repository.reload
151
151
152 get :diff, :id => 3, :rev => '61b685fbe55ab05b5ac68402d5720c1a6ac973d1',
152 get :diff, :id => 3, :rev => '61b685fbe55ab05b5ac68402d5720c1a6ac973d1',
153 :rev_to => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
153 :rev_to => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
154 assert_response :success
154 assert_response :success
155 assert_template 'diff'
155 assert_template 'diff'
156
156
157 diff = assigns(:diff)
157 diff = assigns(:diff)
158 assert_not_nil diff
158 assert_not_nil diff
159 assert_tag :tag => 'h2', :content => /2f9c0091:61b685fb/
159 assert_tag :tag => 'h2', :content => /2f9c0091:61b685fb/
160 end
160 end
161
161
162 def test_annotate
162 def test_annotate
163 get :annotate, :id => 3, :path => ['sources', 'watchers_controller.rb']
163 get :annotate, :id => 3, :path => ['sources', 'watchers_controller.rb']
164 assert_response :success
164 assert_response :success
165 assert_template 'annotate'
165 assert_template 'annotate'
166 # Line 23, changeset 2f9c0091
166 # Line 23, changeset 2f9c0091
167 assert_tag :tag => 'th', :content => /24/,
167 assert_tag :tag => 'th', :content => /24/,
168 :sibling => { :tag => 'td', :child => { :tag => 'a', :content => /2f9c0091/ } },
168 :sibling => { :tag => 'td', :child => { :tag => 'a', :content => /2f9c0091/ } },
169 :sibling => { :tag => 'td', :content => /jsmith/ },
169 :sibling => { :tag => 'td', :content => /jsmith/ },
170 :sibling => { :tag => 'td', :content => /watcher =/ }
170 :sibling => { :tag => 'td', :content => /watcher =/ }
171 end
171 end
172
172
173 def test_annotate_at_given_revision
174 @repository.fetch_changesets
175 @repository.reload
176 get :annotate, :id => 3, :rev => 'deff7', :path => ['sources', 'watchers_controller.rb']
177 assert_response :success
178 assert_template 'annotate'
179 assert_tag :tag => 'h2', :content => /@ deff712f/
180 end
181
173 def test_annotate_binary_file
182 def test_annotate_binary_file
174 get :annotate, :id => 3, :path => ['images', 'edit.png']
183 get :annotate, :id => 3, :path => ['images', 'edit.png']
175 assert_response 500
184 assert_response 500
176 assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
185 assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
177 :content => /can not be annotated/
186 :content => /can not be annotated/
178 end
187 end
179
188
180 def test_revision
189 def test_revision
181 @repository.fetch_changesets
190 @repository.fetch_changesets
182 @repository.reload
191 @repository.reload
183 ['61b685fbe55ab05b5ac68402d5720c1a6ac973d1', '61b685f'].each do |r|
192 ['61b685fbe55ab05b5ac68402d5720c1a6ac973d1', '61b685f'].each do |r|
184 get :revision, :id => 3, :rev => r
193 get :revision, :id => 3, :rev => r
185 assert_response :success
194 assert_response :success
186 assert_template 'revision'
195 assert_template 'revision'
187 end
196 end
188 end
197 end
189
198
190 def test_empty_revision
199 def test_empty_revision
191 @repository.fetch_changesets
200 @repository.fetch_changesets
192 @repository.reload
201 @repository.reload
193 ['', ' ', nil].each do |r|
202 ['', ' ', nil].each do |r|
194 get :revision, :id => 3, :rev => r
203 get :revision, :id => 3, :rev => r
195 assert_response 404
204 assert_response 404
196 assert_error_tag :content => /was not found/
205 assert_error_tag :content => /was not found/
197 end
206 end
198 end
207 end
199 else
208 else
200 puts "Git test repository NOT FOUND. Skipping functional tests !!!"
209 puts "Git test repository NOT FOUND. Skipping functional tests !!!"
201 def test_fake; assert true end
210 def test_fake; assert true end
202 end
211 end
203 end
212 end
@@ -1,212 +1,223
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
29
30 def setup
30 def setup
31 @controller = RepositoriesController.new
31 @controller = RepositoriesController.new
32 @request = ActionController::TestRequest.new
32 @request = ActionController::TestRequest.new
33 @response = ActionController::TestResponse.new
33 @response = ActionController::TestResponse.new
34 User.current = nil
34 User.current = nil
35 @repository = Repository::Mercurial.create(:project => Project.find(3), :url => REPOSITORY_PATH)
35 @repository = Repository::Mercurial.create(:project => Project.find(3), :url => REPOSITORY_PATH)
36 assert @repository
36 assert @repository
37 end
37 end
38
38
39 if File.directory?(REPOSITORY_PATH)
39 if File.directory?(REPOSITORY_PATH)
40 def test_show
40 def test_show
41 get :show, :id => 3
41 get :show, :id => 3
42 assert_response :success
42 assert_response :success
43 assert_template 'show'
43 assert_template 'show'
44 assert_not_nil assigns(:entries)
44 assert_not_nil assigns(:entries)
45 assert_not_nil assigns(:changesets)
45 assert_not_nil assigns(:changesets)
46 end
46 end
47
47
48 def test_show_root
48 def test_show_root
49 get :show, :id => 3
49 get :show, :id => 3
50 assert_response :success
50 assert_response :success
51 assert_template 'show'
51 assert_template 'show'
52 assert_not_nil assigns(:entries)
52 assert_not_nil assigns(:entries)
53 assert_equal 4, assigns(:entries).size
53 assert_equal 4, assigns(:entries).size
54 assert assigns(:entries).detect {|e| e.name == 'images' && e.kind == 'dir'}
54 assert assigns(:entries).detect {|e| e.name == 'images' && e.kind == 'dir'}
55 assert assigns(:entries).detect {|e| e.name == 'sources' && e.kind == 'dir'}
55 assert assigns(:entries).detect {|e| e.name == 'sources' && e.kind == 'dir'}
56 assert assigns(:entries).detect {|e| e.name == 'README' && e.kind == 'file'}
56 assert assigns(:entries).detect {|e| e.name == 'README' && e.kind == 'file'}
57 end
57 end
58
58
59 def test_show_directory
59 def test_show_directory
60 get :show, :id => 3, :path => ['images']
60 get :show, :id => 3, :path => ['images']
61 assert_response :success
61 assert_response :success
62 assert_template 'show'
62 assert_template 'show'
63 assert_not_nil assigns(:entries)
63 assert_not_nil assigns(:entries)
64 assert_equal ['delete.png', 'edit.png'], assigns(:entries).collect(&:name)
64 assert_equal ['delete.png', 'edit.png'], assigns(:entries).collect(&:name)
65 entry = assigns(:entries).detect {|e| e.name == 'edit.png'}
65 entry = assigns(:entries).detect {|e| e.name == 'edit.png'}
66 assert_not_nil entry
66 assert_not_nil entry
67 assert_equal 'file', entry.kind
67 assert_equal 'file', entry.kind
68 assert_equal 'images/edit.png', entry.path
68 assert_equal 'images/edit.png', entry.path
69 end
69 end
70
70
71 def test_show_at_given_revision
71 def test_show_at_given_revision
72 [0, '0', '0885933ad4f6'].each do |r1|
72 [0, '0', '0885933ad4f6'].each do |r1|
73 get :show, :id => 3, :path => ['images'], :rev => r1
73 get :show, :id => 3, :path => ['images'], :rev => r1
74 assert_response :success
74 assert_response :success
75 assert_template 'show'
75 assert_template 'show'
76 assert_not_nil assigns(:entries)
76 assert_not_nil assigns(:entries)
77 assert_equal ['delete.png'], assigns(:entries).collect(&:name)
77 assert_equal ['delete.png'], assigns(:entries).collect(&:name)
78 end
78 end
79 end
79 end
80
80
81 def test_show_directory_sql_escape_percent
81 def test_show_directory_sql_escape_percent
82 [13, '13', '3a330eb32958'].each do |r1|
82 [13, '13', '3a330eb32958'].each do |r1|
83 get :show, :id => 3, :path => ['sql_escape', 'percent%dir'], :rev => r1
83 get :show, :id => 3, :path => ['sql_escape', 'percent%dir'], :rev => r1
84 assert_response :success
84 assert_response :success
85 assert_template 'show'
85 assert_template 'show'
86
86
87 assert_not_nil assigns(:entries)
87 assert_not_nil assigns(:entries)
88 assert_equal ['percent%file1.txt', 'percentfile1.txt'], assigns(:entries).collect(&:name)
88 assert_equal ['percent%file1.txt', 'percentfile1.txt'], assigns(:entries).collect(&:name)
89 changesets = assigns(:changesets)
89 changesets = assigns(:changesets)
90
90
91 ## This is not yet implemented.
91 ## This is not yet implemented.
92 # assert_not_nil changesets
92 # assert_not_nil changesets
93 # assert_equal %w(13 11 10 9), changesets.collect(&:revision)
93 # assert_equal %w(13 11 10 9), changesets.collect(&:revision)
94 end
94 end
95 end
95 end
96
96
97 def test_changes
97 def test_changes
98 get :changes, :id => 3, :path => ['images', 'edit.png']
98 get :changes, :id => 3, :path => ['images', 'edit.png']
99 assert_response :success
99 assert_response :success
100 assert_template 'changes'
100 assert_template 'changes'
101 assert_tag :tag => 'h2', :content => 'edit.png'
101 assert_tag :tag => 'h2', :content => 'edit.png'
102 end
102 end
103
103
104 def test_entry_show
104 def test_entry_show
105 get :entry, :id => 3, :path => ['sources', 'watchers_controller.rb']
105 get :entry, :id => 3, :path => ['sources', 'watchers_controller.rb']
106 assert_response :success
106 assert_response :success
107 assert_template 'entry'
107 assert_template 'entry'
108 # Line 10
108 # Line 10
109 assert_tag :tag => 'th',
109 assert_tag :tag => 'th',
110 :content => '10',
110 :content => '10',
111 :attributes => { :class => 'line-num' },
111 :attributes => { :class => 'line-num' },
112 :sibling => { :tag => 'td', :content => /WITHOUT ANY WARRANTY/ }
112 :sibling => { :tag => 'td', :content => /WITHOUT ANY WARRANTY/ }
113 end
113 end
114
114
115 def test_entry_download
115 def test_entry_download
116 get :entry, :id => 3, :path => ['sources', 'watchers_controller.rb'], :format => 'raw'
116 get :entry, :id => 3, :path => ['sources', 'watchers_controller.rb'], :format => 'raw'
117 assert_response :success
117 assert_response :success
118 # File content
118 # File content
119 assert @response.body.include?('WITHOUT ANY WARRANTY')
119 assert @response.body.include?('WITHOUT ANY WARRANTY')
120 end
120 end
121
121
122 def test_directory_entry
122 def test_directory_entry
123 get :entry, :id => 3, :path => ['sources']
123 get :entry, :id => 3, :path => ['sources']
124 assert_response :success
124 assert_response :success
125 assert_template 'show'
125 assert_template 'show'
126 assert_not_nil assigns(:entry)
126 assert_not_nil assigns(:entry)
127 assert_equal 'sources', assigns(:entry).name
127 assert_equal 'sources', assigns(:entry).name
128 end
128 end
129
129
130 def test_diff
130 def test_diff
131 @repository.fetch_changesets
131 @repository.fetch_changesets
132 @repository.reload
132 @repository.reload
133
133
134 [4, '4', 'def6d2f1254a'].each do |r1|
134 [4, '4', 'def6d2f1254a'].each do |r1|
135 # Full diff of changeset 4
135 # Full diff of changeset 4
136 get :diff, :id => 3, :rev => r1
136 get :diff, :id => 3, :rev => r1
137 assert_response :success
137 assert_response :success
138 assert_template 'diff'
138 assert_template 'diff'
139
139
140 if @repository.scm.class.client_version_above?([1, 2])
140 if @repository.scm.class.client_version_above?([1, 2])
141 # Line 22 removed
141 # Line 22 removed
142 assert_tag :tag => 'th',
142 assert_tag :tag => 'th',
143 :content => '22',
143 :content => '22',
144 :sibling => { :tag => 'td',
144 :sibling => { :tag => 'td',
145 :attributes => { :class => /diff_out/ },
145 :attributes => { :class => /diff_out/ },
146 :content => /def remove/ }
146 :content => /def remove/ }
147 assert_tag :tag => 'h2', :content => /4:def6d2f1254a/
147 assert_tag :tag => 'h2', :content => /4:def6d2f1254a/
148 end
148 end
149 end
149 end
150 end
150 end
151
151
152 def test_diff_two_revs
152 def test_diff_two_revs
153 @repository.fetch_changesets
153 @repository.fetch_changesets
154 @repository.reload
154 @repository.reload
155
155
156 [2, '400bb8672109', '400', 400].each do |r1|
156 [2, '400bb8672109', '400', 400].each do |r1|
157 [4, 'def6d2f1254a'].each do |r2|
157 [4, 'def6d2f1254a'].each do |r2|
158 get :diff, :id => 3, :rev => r1,
158 get :diff, :id => 3, :rev => r1,
159 :rev_to => r2
159 :rev_to => r2
160 assert_response :success
160 assert_response :success
161 assert_template 'diff'
161 assert_template 'diff'
162
162
163 diff = assigns(:diff)
163 diff = assigns(:diff)
164 assert_not_nil diff
164 assert_not_nil diff
165 assert_tag :tag => 'h2', :content => /4:def6d2f1254a 2:400bb8672109/
165 assert_tag :tag => 'h2', :content => /4:def6d2f1254a 2:400bb8672109/
166 end
166 end
167 end
167 end
168 end
168 end
169
169
170 def test_annotate
170 def test_annotate
171 get :annotate, :id => 3, :path => ['sources', 'watchers_controller.rb']
171 get :annotate, :id => 3, :path => ['sources', 'watchers_controller.rb']
172 assert_response :success
172 assert_response :success
173 assert_template 'annotate'
173 assert_template 'annotate'
174 # Line 23, revision 4:def6d2f1254a
174 # Line 23, revision 4:def6d2f1254a
175 assert_tag :tag => 'th',
175 assert_tag :tag => 'th',
176 :content => '23',
176 :content => '23',
177 :attributes => { :class => 'line-num' },
177 :attributes => { :class => 'line-num' },
178 :sibling =>
178 :sibling =>
179 {
179 {
180 :tag => 'td',
180 :tag => 'td',
181 :attributes => { :class => 'revision' },
181 :attributes => { :class => 'revision' },
182 :child => { :tag => 'a', :content => '4:def6d2f1254a' }
182 :child => { :tag => 'a', :content => '4:def6d2f1254a' }
183 }
183 }
184 assert_tag :tag => 'th',
184 assert_tag :tag => 'th',
185 :content => '23',
185 :content => '23',
186 :attributes => { :class => 'line-num' },
186 :attributes => { :class => 'line-num' },
187 :sibling =>
187 :sibling =>
188 {
188 {
189 :tag => 'td' ,
189 :tag => 'td' ,
190 :content => 'jsmith' ,
190 :content => 'jsmith' ,
191 :attributes => { :class => 'author' },
191 :attributes => { :class => 'author' },
192 }
192 }
193 assert_tag :tag => 'th',
193 assert_tag :tag => 'th',
194 :content => '23',
194 :content => '23',
195 :attributes => { :class => 'line-num' },
195 :attributes => { :class => 'line-num' },
196 :sibling => { :tag => 'td', :content => /watcher =/ }
196 :sibling => { :tag => 'td', :content => /watcher =/ }
197 end
197 end
198
198
199 def test_annotate_at_given_revision
200 @repository.fetch_changesets
201 @repository.reload
202 [2, '400bb8672109', '400', 400].each do |r1|
203 get :annotate, :id => 3, :rev => r1, :path => ['sources', 'watchers_controller.rb']
204 assert_response :success
205 assert_template 'annotate'
206 assert_tag :tag => 'h2', :content => /@ 2:400bb8672109/
207 end
208 end
209
199 def test_empty_revision
210 def test_empty_revision
200 @repository.fetch_changesets
211 @repository.fetch_changesets
201 @repository.reload
212 @repository.reload
202 ['', ' ', nil].each do |r|
213 ['', ' ', nil].each do |r|
203 get :revision, :id => 3, :rev => r
214 get :revision, :id => 3, :rev => r
204 assert_response 404
215 assert_response 404
205 assert_error_tag :content => /was not found/
216 assert_error_tag :content => /was not found/
206 end
217 end
207 end
218 end
208 else
219 else
209 puts "Mercurial test repository NOT FOUND. Skipping functional tests !!!"
220 puts "Mercurial test repository NOT FOUND. Skipping functional tests !!!"
210 def test_fake; assert true end
221 def test_fake; assert true end
211 end
222 end
212 end
223 end
@@ -1,235 +1,242
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 RepositoriesSubversionControllerTest < ActionController::TestCase
24 class RepositoriesSubversionControllerTest < ActionController::TestCase
25 fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules,
25 fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules,
26 :repositories, :issues, :issue_statuses, :changesets, :changes,
26 :repositories, :issues, :issue_statuses, :changesets, :changes,
27 :issue_categories, :enumerations, :custom_fields, :custom_values, :trackers
27 :issue_categories, :enumerations, :custom_fields, :custom_values, :trackers
28
28
29 def setup
29 def setup
30 @controller = RepositoriesController.new
30 @controller = RepositoriesController.new
31 @request = ActionController::TestRequest.new
31 @request = ActionController::TestRequest.new
32 @response = ActionController::TestResponse.new
32 @response = ActionController::TestResponse.new
33 Setting.default_language = 'en'
33 Setting.default_language = 'en'
34 User.current = nil
34 User.current = nil
35 end
35 end
36
36
37 if repository_configured?('subversion')
37 if repository_configured?('subversion')
38 def test_show
38 def test_show
39 get :show, :id => 1
39 get :show, :id => 1
40 assert_response :success
40 assert_response :success
41 assert_template 'show'
41 assert_template 'show'
42 assert_not_nil assigns(:entries)
42 assert_not_nil assigns(:entries)
43 assert_not_nil assigns(:changesets)
43 assert_not_nil assigns(:changesets)
44 end
44 end
45
45
46 def test_browse_root
46 def test_browse_root
47 get :show, :id => 1
47 get :show, :id => 1
48 assert_response :success
48 assert_response :success
49 assert_template 'show'
49 assert_template 'show'
50 assert_not_nil assigns(:entries)
50 assert_not_nil assigns(:entries)
51 entry = assigns(:entries).detect {|e| e.name == 'subversion_test'}
51 entry = assigns(:entries).detect {|e| e.name == 'subversion_test'}
52 assert_equal 'dir', entry.kind
52 assert_equal 'dir', entry.kind
53 end
53 end
54
54
55 def test_browse_directory
55 def test_browse_directory
56 get :show, :id => 1, :path => ['subversion_test']
56 get :show, :id => 1, :path => ['subversion_test']
57 assert_response :success
57 assert_response :success
58 assert_template 'show'
58 assert_template 'show'
59 assert_not_nil assigns(:entries)
59 assert_not_nil assigns(:entries)
60 assert_equal ['[folder_with_brackets]', 'folder', '.project', 'helloworld.c', 'textfile.txt'], assigns(:entries).collect(&:name)
60 assert_equal ['[folder_with_brackets]', 'folder', '.project', 'helloworld.c', 'textfile.txt'], assigns(:entries).collect(&:name)
61 entry = assigns(:entries).detect {|e| e.name == 'helloworld.c'}
61 entry = assigns(:entries).detect {|e| e.name == 'helloworld.c'}
62 assert_equal 'file', entry.kind
62 assert_equal 'file', entry.kind
63 assert_equal 'subversion_test/helloworld.c', entry.path
63 assert_equal 'subversion_test/helloworld.c', entry.path
64 assert_tag :a, :content => 'helloworld.c', :attributes => { :class => /text\-x\-c/ }
64 assert_tag :a, :content => 'helloworld.c', :attributes => { :class => /text\-x\-c/ }
65 end
65 end
66
66
67 def test_browse_at_given_revision
67 def test_browse_at_given_revision
68 get :show, :id => 1, :path => ['subversion_test'], :rev => 4
68 get :show, :id => 1, :path => ['subversion_test'], :rev => 4
69 assert_response :success
69 assert_response :success
70 assert_template 'show'
70 assert_template 'show'
71 assert_not_nil assigns(:entries)
71 assert_not_nil assigns(:entries)
72 assert_equal ['folder', '.project', 'helloworld.c', 'helloworld.rb', 'textfile.txt'], assigns(:entries).collect(&:name)
72 assert_equal ['folder', '.project', 'helloworld.c', 'helloworld.rb', 'textfile.txt'], assigns(:entries).collect(&:name)
73 end
73 end
74
74
75 def test_file_changes
75 def test_file_changes
76 get :changes, :id => 1, :path => ['subversion_test', 'folder', 'helloworld.rb' ]
76 get :changes, :id => 1, :path => ['subversion_test', 'folder', 'helloworld.rb' ]
77 assert_response :success
77 assert_response :success
78 assert_template 'changes'
78 assert_template 'changes'
79
79
80 changesets = assigns(:changesets)
80 changesets = assigns(:changesets)
81 assert_not_nil changesets
81 assert_not_nil changesets
82 assert_equal %w(6 3 2), changesets.collect(&:revision)
82 assert_equal %w(6 3 2), changesets.collect(&:revision)
83
83
84 # svn properties displayed with svn >= 1.5 only
84 # svn properties displayed with svn >= 1.5 only
85 if Redmine::Scm::Adapters::SubversionAdapter.client_version_above?([1, 5, 0])
85 if Redmine::Scm::Adapters::SubversionAdapter.client_version_above?([1, 5, 0])
86 assert_not_nil assigns(:properties)
86 assert_not_nil assigns(:properties)
87 assert_equal 'native', assigns(:properties)['svn:eol-style']
87 assert_equal 'native', assigns(:properties)['svn:eol-style']
88 assert_tag :ul,
88 assert_tag :ul,
89 :child => { :tag => 'li',
89 :child => { :tag => 'li',
90 :child => { :tag => 'b', :content => 'svn:eol-style' },
90 :child => { :tag => 'b', :content => 'svn:eol-style' },
91 :child => { :tag => 'span', :content => 'native' } }
91 :child => { :tag => 'span', :content => 'native' } }
92 end
92 end
93 end
93 end
94
94
95 def test_directory_changes
95 def test_directory_changes
96 get :changes, :id => 1, :path => ['subversion_test', 'folder' ]
96 get :changes, :id => 1, :path => ['subversion_test', 'folder' ]
97 assert_response :success
97 assert_response :success
98 assert_template 'changes'
98 assert_template 'changes'
99
99
100 changesets = assigns(:changesets)
100 changesets = assigns(:changesets)
101 assert_not_nil changesets
101 assert_not_nil changesets
102 assert_equal %w(10 9 7 6 5 2), changesets.collect(&:revision)
102 assert_equal %w(10 9 7 6 5 2), changesets.collect(&:revision)
103 end
103 end
104
104
105 def test_entry
105 def test_entry
106 get :entry, :id => 1, :path => ['subversion_test', 'helloworld.c']
106 get :entry, :id => 1, :path => ['subversion_test', 'helloworld.c']
107 assert_response :success
107 assert_response :success
108 assert_template 'entry'
108 assert_template 'entry'
109 end
109 end
110
110
111 def test_entry_should_send_if_too_big
111 def test_entry_should_send_if_too_big
112 # no files in the test repo is larger than 1KB...
112 # no files in the test repo is larger than 1KB...
113 with_settings :file_max_size_displayed => 0 do
113 with_settings :file_max_size_displayed => 0 do
114 get :entry, :id => 1, :path => ['subversion_test', 'helloworld.c']
114 get :entry, :id => 1, :path => ['subversion_test', 'helloworld.c']
115 assert_response :success
115 assert_response :success
116 assert_template ''
116 assert_template ''
117 assert_equal 'attachment; filename="helloworld.c"', @response.headers['Content-Disposition']
117 assert_equal 'attachment; filename="helloworld.c"', @response.headers['Content-Disposition']
118 end
118 end
119 end
119 end
120
120
121 def test_entry_at_given_revision
121 def test_entry_at_given_revision
122 get :entry, :id => 1, :path => ['subversion_test', 'helloworld.rb'], :rev => 2
122 get :entry, :id => 1, :path => ['subversion_test', 'helloworld.rb'], :rev => 2
123 assert_response :success
123 assert_response :success
124 assert_template 'entry'
124 assert_template 'entry'
125 # this line was removed in r3 and file was moved in r6
125 # this line was removed in r3 and file was moved in r6
126 assert_tag :tag => 'td', :attributes => { :class => /line-code/},
126 assert_tag :tag => 'td', :attributes => { :class => /line-code/},
127 :content => /Here's the code/
127 :content => /Here's the code/
128 end
128 end
129
129
130 def test_entry_not_found
130 def test_entry_not_found
131 get :entry, :id => 1, :path => ['subversion_test', 'zzz.c']
131 get :entry, :id => 1, :path => ['subversion_test', 'zzz.c']
132 assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
132 assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
133 :content => /The entry or revision was not found in the repository/
133 :content => /The entry or revision was not found in the repository/
134 end
134 end
135
135
136 def test_entry_download
136 def test_entry_download
137 get :entry, :id => 1, :path => ['subversion_test', 'helloworld.c'], :format => 'raw'
137 get :entry, :id => 1, :path => ['subversion_test', 'helloworld.c'], :format => 'raw'
138 assert_response :success
138 assert_response :success
139 assert_template ''
139 assert_template ''
140 assert_equal 'attachment; filename="helloworld.c"', @response.headers['Content-Disposition']
140 assert_equal 'attachment; filename="helloworld.c"', @response.headers['Content-Disposition']
141 end
141 end
142
142
143 def test_directory_entry
143 def test_directory_entry
144 get :entry, :id => 1, :path => ['subversion_test', 'folder']
144 get :entry, :id => 1, :path => ['subversion_test', 'folder']
145 assert_response :success
145 assert_response :success
146 assert_template 'show'
146 assert_template 'show'
147 assert_not_nil assigns(:entry)
147 assert_not_nil assigns(:entry)
148 assert_equal 'folder', assigns(:entry).name
148 assert_equal 'folder', assigns(:entry).name
149 end
149 end
150
150
151 def test_revision
151 def test_revision
152 get :revision, :id => 1, :rev => 2
152 get :revision, :id => 1, :rev => 2
153 assert_response :success
153 assert_response :success
154 assert_template 'revision'
154 assert_template 'revision'
155 assert_tag :tag => 'ul',
155 assert_tag :tag => 'ul',
156 :child => { :tag => 'li',
156 :child => { :tag => 'li',
157 # link to the entry at rev 2
157 # link to the entry at rev 2
158 :child => { :tag => 'a',
158 :child => { :tag => 'a',
159 :attributes => {:href => '/projects/ecookbook/repository/revisions/2/entry/test/some/path/in/the/repo'},
159 :attributes => {:href => '/projects/ecookbook/repository/revisions/2/entry/test/some/path/in/the/repo'},
160 :content => 'repo',
160 :content => 'repo',
161 # link to partial diff
161 # link to partial diff
162 :sibling => { :tag => 'a',
162 :sibling => { :tag => 'a',
163 :attributes => { :href => '/projects/ecookbook/repository/revisions/2/diff/test/some/path/in/the/repo' }
163 :attributes => { :href => '/projects/ecookbook/repository/revisions/2/diff/test/some/path/in/the/repo' }
164 }
164 }
165 }
165 }
166 }
166 }
167 end
167 end
168
168
169 def test_invalid_revision
169 def test_invalid_revision
170 get :revision, :id => 1, :rev => 'something_weird'
170 get :revision, :id => 1, :rev => 'something_weird'
171 assert_response 404
171 assert_response 404
172 assert_error_tag :content => /was not found/
172 assert_error_tag :content => /was not found/
173 end
173 end
174
174
175 def test_empty_revision
175 def test_empty_revision
176 ['', ' ', nil].each do |r|
176 ['', ' ', nil].each do |r|
177 get :revision, :id => 1, :rev => r
177 get :revision, :id => 1, :rev => r
178 assert_response 404
178 assert_response 404
179 assert_error_tag :content => /was not found/
179 assert_error_tag :content => /was not found/
180 end
180 end
181 end
181 end
182
182
183 def test_revision_with_repository_pointing_to_a_subdirectory
183 def test_revision_with_repository_pointing_to_a_subdirectory
184 r = Project.find(1).repository
184 r = Project.find(1).repository
185 # Changes repository url to a subdirectory
185 # Changes repository url to a subdirectory
186 r.update_attribute :url, (r.url + '/test/some')
186 r.update_attribute :url, (r.url + '/test/some')
187
187
188 get :revision, :id => 1, :rev => 2
188 get :revision, :id => 1, :rev => 2
189 assert_response :success
189 assert_response :success
190 assert_template 'revision'
190 assert_template 'revision'
191 assert_tag :tag => 'ul',
191 assert_tag :tag => 'ul',
192 :child => { :tag => 'li',
192 :child => { :tag => 'li',
193 # link to the entry at rev 2
193 # link to the entry at rev 2
194 :child => { :tag => 'a',
194 :child => { :tag => 'a',
195 :attributes => {:href => '/projects/ecookbook/repository/revisions/2/entry/path/in/the/repo'},
195 :attributes => {:href => '/projects/ecookbook/repository/revisions/2/entry/path/in/the/repo'},
196 :content => 'repo',
196 :content => 'repo',
197 # link to partial diff
197 # link to partial diff
198 :sibling => { :tag => 'a',
198 :sibling => { :tag => 'a',
199 :attributes => { :href => '/projects/ecookbook/repository/revisions/2/diff/path/in/the/repo' }
199 :attributes => { :href => '/projects/ecookbook/repository/revisions/2/diff/path/in/the/repo' }
200 }
200 }
201 }
201 }
202 }
202 }
203 end
203 end
204
204
205 def test_revision_diff
205 def test_revision_diff
206 get :diff, :id => 1, :rev => 3
206 get :diff, :id => 1, :rev => 3
207 assert_response :success
207 assert_response :success
208 assert_template 'diff'
208 assert_template 'diff'
209
209
210 assert_tag :tag => 'h2', :content => /3/
210 assert_tag :tag => 'h2', :content => /3/
211 end
211 end
212
212
213 def test_directory_diff
213 def test_directory_diff
214 get :diff, :id => 1, :rev => 6, :rev_to => 2, :path => ['subversion_test', 'folder']
214 get :diff, :id => 1, :rev => 6, :rev_to => 2, :path => ['subversion_test', 'folder']
215 assert_response :success
215 assert_response :success
216 assert_template 'diff'
216 assert_template 'diff'
217
217
218 diff = assigns(:diff)
218 diff = assigns(:diff)
219 assert_not_nil diff
219 assert_not_nil diff
220 # 2 files modified
220 # 2 files modified
221 assert_equal 2, Redmine::UnifiedDiff.new(diff).size
221 assert_equal 2, Redmine::UnifiedDiff.new(diff).size
222
222
223 assert_tag :tag => 'h2', :content => /2:6/
223 assert_tag :tag => 'h2', :content => /2:6/
224 end
224 end
225
225
226 def test_annotate
226 def test_annotate
227 get :annotate, :id => 1, :path => ['subversion_test', 'helloworld.c']
227 get :annotate, :id => 1, :path => ['subversion_test', 'helloworld.c']
228 assert_response :success
228 assert_response :success
229 assert_template 'annotate'
229 assert_template 'annotate'
230 end
230 end
231
232 def test_annotate_at_given_revision
233 get :annotate, :id => 1, :rev => 8, :path => ['subversion_test', 'helloworld.c']
234 assert_response :success
235 assert_template 'annotate'
236 assert_tag :tag => 'h2', :content => /@ 8/
237 end
231 else
238 else
232 puts "Subversion test repository NOT FOUND. Skipping functional tests !!!"
239 puts "Subversion test repository NOT FOUND. Skipping functional tests !!!"
233 def test_fake; assert true end
240 def test_fake; assert true end
234 end
241 end
235 end
242 end
General Comments 0
You need to be logged in to leave comments. Login now