summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-03-07 16:02:56 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-03-07 16:02:56 +0000
commit9ea438720ffc27eefb1e19e33c7c57b276386d01 (patch)
treede5391fddc83abbc36478b39eb2f923107a1441a /test/unit
parent3789a8539e39bd3afe70b99b5eee7b52e3ed584f (diff)
downloadredmine-9ea438720ffc27eefb1e19e33c7c57b276386d01.tar.gz
redmine-9ea438720ffc27eefb1e19e33c7c57b276386d01.zip
Fixed that non-default identifier-less git repositories are undeletable (#19260).
Patch by Felix Schäfer. git-svn-id: http://svn.redmine.org/redmine/trunk@14050 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/repository_git_test.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/unit/repository_git_test.rb b/test/unit/repository_git_test.rb
index cf1ae0826..be5726b81 100644
--- a/test/unit/repository_git_test.rb
+++ b/test/unit/repository_git_test.rb
@@ -49,6 +49,35 @@ class RepositoryGitTest < ActiveSupport::TestCase
assert @repository
end
+ def test_nondefault_repo_with_blank_identifier_destruction
+ repo1 = Repository::Git.new(
+ :project => @project,
+ :url => REPOSITORY_PATH,
+ :identifier => '',
+ :is_default => true
+ )
+ assert repo1.save
+ repo1.fetch_changesets
+
+ repo2 = Repository::Git.new(
+ :project => @project,
+ :url => REPOSITORY_PATH,
+ :identifier => 'repo2',
+ :is_default => true
+ )
+ assert repo2.save
+ repo2.fetch_changesets
+
+ repo1.reload
+ repo2.reload
+ assert !repo1.is_default?
+ assert repo2.is_default?
+
+ assert_difference 'Repository.count', -1 do
+ repo1.destroy
+ end
+ end
+
def test_blank_path_to_repository_error_message
set_language_if_valid 'en'
repo = Repository::Git.new(