Mercurial > hg > soundsoftware-site
comparison test/functional/repositories_subversion_controller_test.rb @ 119:8661b858af72
* Update to Redmine trunk rev 4705
author | Chris Cannam |
---|---|
date | Thu, 13 Jan 2011 14:12:06 +0000 |
parents | 94944d00e43c |
children | 07fa8a8b56a8 |
comparison
equal
deleted
inserted
replaced
39:150ceac17a8d | 119:8661b858af72 |
---|---|
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.dirname(__FILE__) + '/../test_helper' | 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 |
164 } | 164 } |
165 } | 165 } |
166 } | 166 } |
167 end | 167 end |
168 | 168 |
169 def test_invalid_revision | |
170 get :revision, :id => 1, :rev => 'something_weird' | |
171 assert_response 500 | |
172 assert_error_tag :content => /was not found/ | |
173 end | |
174 | |
175 def test_empty_revision | |
176 ['', ' ', nil].each do |r| | |
177 get :revision, :id => 1, :rev => r | |
178 assert_response 500 | |
179 assert_error_tag :content => /was not found/ | |
180 end | |
181 end | |
182 | |
169 def test_revision_with_repository_pointing_to_a_subdirectory | 183 def test_revision_with_repository_pointing_to_a_subdirectory |
170 r = Project.find(1).repository | 184 r = Project.find(1).repository |
171 # Changes repository url to a subdirectory | 185 # Changes repository url to a subdirectory |
172 r.update_attribute :url, (r.url + '/test/some') | 186 r.update_attribute :url, (r.url + '/test/some') |
173 | 187 |
190 | 204 |
191 def test_revision_diff | 205 def test_revision_diff |
192 get :diff, :id => 1, :rev => 3 | 206 get :diff, :id => 1, :rev => 3 |
193 assert_response :success | 207 assert_response :success |
194 assert_template 'diff' | 208 assert_template 'diff' |
209 | |
210 assert_tag :tag => 'h2', :content => /3/ | |
195 end | 211 end |
196 | 212 |
197 def test_directory_diff | 213 def test_directory_diff |
198 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'] |
199 assert_response :success | 215 assert_response :success |
201 | 217 |
202 diff = assigns(:diff) | 218 diff = assigns(:diff) |
203 assert_not_nil diff | 219 assert_not_nil diff |
204 # 2 files modified | 220 # 2 files modified |
205 assert_equal 2, Redmine::UnifiedDiff.new(diff).size | 221 assert_equal 2, Redmine::UnifiedDiff.new(diff).size |
222 | |
223 assert_tag :tag => 'h2', :content => /2:6/ | |
206 end | 224 end |
207 | 225 |
208 def test_annotate | 226 def test_annotate |
209 get :annotate, :id => 1, :path => ['subversion_test', 'helloworld.c'] | 227 get :annotate, :id => 1, :path => ['subversion_test', 'helloworld.c'] |
210 assert_response :success | 228 assert_response :success |