Resourcified repositories for CRUD operations to prepare for multiple SCM per project (#779).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8648 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -58,15 +58,14 @@ class RepositoriesGitControllerTest < ActionController::TestCase
|
||||
end
|
||||
|
||||
if File.directory?(REPOSITORY_PATH)
|
||||
def test_get_edit
|
||||
def test_get_new
|
||||
@request.session[:user_id] = 1
|
||||
@project.repository.destroy
|
||||
xhr :get, :edit, :id => 'subproject1', :repository_scm => 'Git'
|
||||
get :new, :project_id => 'subproject1', :repository_scm => 'Git'
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', @response.content_type
|
||||
assert_template 'new'
|
||||
assert_kind_of Repository::Git, assigns(:repository)
|
||||
assert assigns(:repository).new_record?
|
||||
assert_select_rjs :replace_html, 'tab-content-repository'
|
||||
end
|
||||
|
||||
def test_browse_root
|
||||
@@ -424,7 +423,9 @@ class RepositoriesGitControllerTest < ActionController::TestCase
|
||||
@project.reload
|
||||
assert_equal NUM_REV, @repository.changesets.count
|
||||
|
||||
get :destroy, :id => PRJ_ID
|
||||
assert_difference 'Repository.count', -1 do
|
||||
delete :destroy, :id => @repository.id
|
||||
end
|
||||
assert_response 302
|
||||
@project.reload
|
||||
assert_nil @project.repository
|
||||
@@ -432,27 +433,19 @@ class RepositoriesGitControllerTest < ActionController::TestCase
|
||||
|
||||
def test_destroy_invalid_repository
|
||||
@request.session[:user_id] = 1 # admin
|
||||
assert_equal 0, @repository.changesets.count
|
||||
@repository.fetch_changesets
|
||||
@project.reload
|
||||
assert_equal NUM_REV, @repository.changesets.count
|
||||
|
||||
get :destroy, :id => PRJ_ID
|
||||
assert_response 302
|
||||
@project.reload
|
||||
assert_nil @project.repository
|
||||
|
||||
@repository = Repository::Git.create(
|
||||
@project.repository.destroy
|
||||
@repository = Repository::Git.create!(
|
||||
:project => @project,
|
||||
:url => "/invalid",
|
||||
:path_encoding => 'ISO-8859-1'
|
||||
)
|
||||
assert @repository
|
||||
@repository.fetch_changesets
|
||||
@repository.reload
|
||||
assert_equal 0, @repository.changesets.count
|
||||
|
||||
get :destroy, :id => PRJ_ID
|
||||
assert_difference 'Repository.count', -1 do
|
||||
delete :destroy, :id => @repository.id
|
||||
end
|
||||
assert_response 302
|
||||
@project.reload
|
||||
assert_nil @project.repository
|
||||
|
||||
Reference in New Issue
Block a user