diff --git a/test/functional/repositories_mercurial_controller_test.rb b/test/functional/repositories_mercurial_controller_test.rb index 8cc1b27a1..ecc9007eb 100644 --- a/test/functional/repositories_mercurial_controller_test.rb +++ b/test/functional/repositories_mercurial_controller_test.rb @@ -445,6 +445,33 @@ class RepositoriesMercurialControllerTest < ActionController::TestCase @project.reload assert_nil @project.repository end + + def test_destroy_invalid_repository + @request.session[:user_id] = 1 # admin + @repository.fetch_changesets + @repository.reload + assert @repository.changesets.count > 0 + + get :destroy, :id => PRJ_ID + assert_response 302 + @project.reload + assert_nil @project.repository + + @repository = Repository::Mercurial.create( + :project => Project.find(PRJ_ID), + :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_response 302 + @project.reload + assert_nil @project.repository + end else puts "Mercurial test repository NOT FOUND. Skipping functional tests !!!" def test_fake; assert true end