Test for repository edit and cleanup.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8052 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2011-12-03 15:13:47 +00:00
parent a08fa696d4
commit e67afc8886
3 changed files with 39 additions and 21 deletions

View File

@ -16,12 +16,10 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require File.expand_path('../../test_helper', __FILE__)
require 'repositories_controller'
# Re-raise errors caught by the controller.
class RepositoriesController; def rescue_action(e) raise e end; end
class RepositoriesBazaarControllerTest < ActionController::TestCase
tests RepositoriesController
fixtures :projects, :users, :roles, :members, :member_roles,
:repositories, :enabled_modules
@ -29,9 +27,6 @@ class RepositoriesBazaarControllerTest < ActionController::TestCase
PRJ_ID = 3
def setup
@controller = RepositoriesController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
User.current = nil
@project = Project.find(PRJ_ID)
@repository = Repository::Bazaar.create(
@ -42,6 +37,17 @@ class RepositoriesBazaarControllerTest < ActionController::TestCase
end
if File.directory?(REPOSITORY_PATH)
def test_get_edit
@request.session[:user_id] = 1
@project.repository.destroy
xhr :get, :edit, :id => 'subproject1', :repository_scm => 'Bazaar'
assert_response :success
assert_equal 'text/javascript', @response.content_type
assert_kind_of Repository::Bazaar, assigns(:repository)
assert assigns(:repository).new_record?
assert_select_rjs :replace_html, 'tab-content-repository'
end
def test_browse_root
get :show, :id => PRJ_ID
assert_response :success

View File

@ -16,12 +16,10 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require File.expand_path('../../test_helper', __FILE__)
require 'repositories_controller'
# Re-raise errors caught by the controller.
class RepositoriesController; def rescue_action(e) raise e end; end
class RepositoriesCvsControllerTest < ActionController::TestCase
tests RepositoriesController
fixtures :projects, :users, :roles, :members, :member_roles,
:repositories, :enabled_modules
@ -33,9 +31,6 @@ class RepositoriesCvsControllerTest < ActionController::TestCase
NUM_REV = 7
def setup
@controller = RepositoriesController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
Setting.default_language = 'en'
User.current = nil
@ -48,6 +43,17 @@ class RepositoriesCvsControllerTest < ActionController::TestCase
end
if File.directory?(REPOSITORY_PATH)
def test_get_edit
@request.session[:user_id] = 1
@project.repository.destroy
xhr :get, :edit, :id => 'subproject1', :repository_scm => 'Cvs'
assert_response :success
assert_equal 'text/javascript', @response.content_type
assert_kind_of Repository::Cvs, assigns(:repository)
assert assigns(:repository).new_record?
assert_select_rjs :replace_html, 'tab-content-repository'
end
def test_browse_root
assert_equal 0, @repository.changesets.count
@repository.fetch_changesets

View File

@ -16,12 +16,10 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require File.expand_path('../../test_helper', __FILE__)
require 'repositories_controller'
# Re-raise errors caught by the controller.
class RepositoriesController; def rescue_action(e) raise e end; end
class RepositoriesDarcsControllerTest < ActionController::TestCase
tests RepositoriesController
fixtures :projects, :users, :roles, :members, :member_roles,
:repositories, :enabled_modules
@ -30,9 +28,6 @@ class RepositoriesDarcsControllerTest < ActionController::TestCase
NUM_REV = 6
def setup
@controller = RepositoriesController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
User.current = nil
@project = Project.find(PRJ_ID)
@repository = Repository::Darcs.create(
@ -44,6 +39,17 @@ class RepositoriesDarcsControllerTest < ActionController::TestCase
end
if File.directory?(REPOSITORY_PATH)
def test_get_edit
@request.session[:user_id] = 1
@project.repository.destroy
xhr :get, :edit, :id => 'subproject1', :repository_scm => 'Darcs'
assert_response :success
assert_equal 'text/javascript', @response.content_type
assert_kind_of Repository::Darcs, assigns(:repository)
assert assigns(:repository).new_record?
assert_select_rjs :replace_html, 'tab-content-repository'
end
def test_browse_root
assert_equal 0, @repository.changesets.count
@repository.fetch_changesets