summaryrefslogtreecommitdiffstats
path: root/test/functional/repositories_filesystem_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-01-15 14:23:06 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-01-15 14:23:06 +0000
commitfb1a2fd7cd4ca7335d660265a32604f6e2006dd6 (patch)
tree444bf09c5a63e91cc314de7c7e9fd78f93d1ff09 /test/functional/repositories_filesystem_controller_test.rb
parent6f462d373f1b57657082f22f882942d41df47a39 (diff)
downloadredmine-fb1a2fd7cd4ca7335d660265a32604f6e2006dd6.tar.gz
redmine-fb1a2fd7cd4ca7335d660265a32604f6e2006dd6.zip
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
Diffstat (limited to 'test/functional/repositories_filesystem_controller_test.rb')
-rw-r--r--test/functional/repositories_filesystem_controller_test.rb27
1 files changed, 12 insertions, 15 deletions
diff --git a/test/functional/repositories_filesystem_controller_test.rb b/test/functional/repositories_filesystem_controller_test.rb
index 257537893..0b10d8fe3 100644
--- a/test/functional/repositories_filesystem_controller_test.rb
+++ b/test/functional/repositories_filesystem_controller_test.rb
@@ -41,15 +41,14 @@ class RepositoriesFilesystemControllerTest < 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 => 'Filesystem'
+ get :new, :project_id => 'subproject1', :repository_scm => 'Filesystem'
assert_response :success
- assert_equal 'text/javascript', @response.content_type
+ assert_template 'new'
assert_kind_of Repository::Filesystem, assigns(:repository)
assert assigns(:repository).new_record?
- assert_select_rjs :replace_html, 'tab-content-repository'
end
def test_browse_root
@@ -126,7 +125,9 @@ class RepositoriesFilesystemControllerTest < ActionController::TestCase
def test_destroy_valid_repository
@request.session[:user_id] = 1 # admin
- 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
@@ -134,20 +135,16 @@ class RepositoriesFilesystemControllerTest < ActionController::TestCase
def test_destroy_invalid_repository
@request.session[:user_id] = 1 # admin
-
- get :destroy, :id => PRJ_ID
- assert_response 302
- @project.reload
- assert_nil @project.repository
-
- @repository = Repository::Filesystem.create(
- :project => Project.find(PRJ_ID),
+ @project.repository.destroy
+ @repository = Repository::Filesystem.create!(
+ :project => @project,
:url => "/invalid",
:path_encoding => ''
)
- assert @repository
- 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