@@ -43,6 +43,42 class RepositoriesSubversionControllerTest < ActionController::TestCase | |||||
43 | end |
|
43 | end | |
44 |
|
44 | |||
45 | if repository_configured?('subversion') |
|
45 | if repository_configured?('subversion') | |
|
46 | def test_get_edit | |||
|
47 | @request.session[:user_id] = 1 | |||
|
48 | @project.repository.destroy | |||
|
49 | xhr :get, :edit, :id => 'subproject1', :repository_scm => 'Subversion' | |||
|
50 | assert_response :success | |||
|
51 | assert_equal 'text/javascript', @response.content_type | |||
|
52 | assert_kind_of Repository::Subversion, assigns(:repository) | |||
|
53 | assert assigns(:repository).new_record? | |||
|
54 | assert_select_rjs :replace_html, 'tab-content-repository' | |||
|
55 | end | |||
|
56 | ||||
|
57 | def test_post_edit | |||
|
58 | @request.session[:user_id] = 1 | |||
|
59 | @project.repository.destroy | |||
|
60 | assert_difference 'Repository.count' do | |||
|
61 | xhr :post, :edit, :id => 'subproject1', :repository_scm => 'Subversion', :repository => {:url => 'file:///svn/path'} | |||
|
62 | end | |||
|
63 | assert_response :success | |||
|
64 | assert_equal 'text/javascript', @response.content_type | |||
|
65 | assert_kind_of Repository::Subversion, assigns(:repository) | |||
|
66 | assert !assigns(:repository).new_record? | |||
|
67 | assert_select_rjs :replace_html, 'tab-content-repository' | |||
|
68 | end | |||
|
69 | ||||
|
70 | def test_post_edit_existing_repository | |||
|
71 | @request.session[:user_id] = 1 | |||
|
72 | assert_no_difference 'Repository.count' do | |||
|
73 | xhr :post, :edit, :id => 'subproject1', :repository_scm => 'Subversion', :repository => {:password => 'newpassword'} | |||
|
74 | end | |||
|
75 | assert_response :success | |||
|
76 | assert_equal 'text/javascript', @response.content_type | |||
|
77 | assert_kind_of Repository::Subversion, assigns(:repository) | |||
|
78 | assert_select_rjs :replace_html, 'tab-content-repository' | |||
|
79 | assert_equal 'newpassword', Project.find('subproject1').repository.password | |||
|
80 | end | |||
|
81 | ||||
46 | def test_show |
|
82 | def test_show | |
47 | assert_equal 0, @repository.changesets.count |
|
83 | assert_equal 0, @repository.changesets.count | |
48 | @repository.fetch_changesets |
|
84 | @repository.fetch_changesets |
General Comments 0
You need to be logged in to leave comments.
Login now