summaryrefslogtreecommitdiffstats
path: root/test/functional/repositories_bazaar_controller_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/repositories_bazaar_controller_test.rb')
-rw-r--r--test/functional/repositories_bazaar_controller_test.rb30
1 files changed, 11 insertions, 19 deletions
diff --git a/test/functional/repositories_bazaar_controller_test.rb b/test/functional/repositories_bazaar_controller_test.rb
index 0273ef8cd..099c05088 100644
--- a/test/functional/repositories_bazaar_controller_test.rb
+++ b/test/functional/repositories_bazaar_controller_test.rb
@@ -37,15 +37,14 @@ class RepositoriesBazaarControllerTest < 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 => 'Bazaar'
+ get :new, :project_id => 'subproject1', :repository_scm => 'Bazaar'
assert_response :success
- assert_equal 'text/javascript', @response.content_type
+ assert_template 'new'
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
@@ -157,10 +156,11 @@ class RepositoriesBazaarControllerTest < ActionController::TestCase
@request.session[:user_id] = 1 # admin
assert_equal 0, @repository.changesets.count
@repository.fetch_changesets
- @project.reload
assert @repository.changesets.count > 0
- 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
@@ -168,26 +168,18 @@ class RepositoriesBazaarControllerTest < 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 @repository.changesets.count > 0
-
- get :destroy, :id => PRJ_ID
- assert_response 302
- @project.reload
- assert_nil @project.repository
-
- @repository = Repository::Bazaar.create(
+ @project.repository.destroy
+ @repository = Repository::Bazaar.create!(
:project => @project,
:url => "/invalid",
:log_encoding => 'UTF-8')
- 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