##// END OF EJS Templates
Merged r14050 (#19260)....
Jean-Philippe Lang -
r13676:36b70437e0fc
parent child
Show More
@@ -38,7 +38,6 class Repository < ActiveRecord::Base
38
38
39 validates_length_of :password, :maximum => 255, :allow_nil => true
39 validates_length_of :password, :maximum => 255, :allow_nil => true
40 validates_length_of :identifier, :maximum => IDENTIFIER_MAX_LENGTH, :allow_blank => true
40 validates_length_of :identifier, :maximum => IDENTIFIER_MAX_LENGTH, :allow_blank => true
41 validates_presence_of :identifier, :unless => Proc.new { |r| r.is_default? || r.set_as_default? }
42 validates_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true
41 validates_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true
43 validates_exclusion_of :identifier, :in => %w(browse show entry raw changes annotate diff statistics graph revisions revision)
42 validates_exclusion_of :identifier, :in => %w(browse show entry raw changes annotate diff statistics graph revisions revision)
44 # donwcase letters, digits, dashes, underscores but not digits only
43 # donwcase letters, digits, dashes, underscores but not digits only
@@ -49,6 +49,35 class RepositoryGitTest < ActiveSupport::TestCase
49 assert @repository
49 assert @repository
50 end
50 end
51
51
52 def test_nondefault_repo_with_blank_identifier_destruction
53 repo1 = Repository::Git.new(
54 :project => @project,
55 :url => REPOSITORY_PATH,
56 :identifier => '',
57 :is_default => true
58 )
59 assert repo1.save
60 repo1.fetch_changesets
61
62 repo2 = Repository::Git.new(
63 :project => @project,
64 :url => REPOSITORY_PATH,
65 :identifier => 'repo2',
66 :is_default => true
67 )
68 assert repo2.save
69 repo2.fetch_changesets
70
71 repo1.reload
72 repo2.reload
73 assert !repo1.is_default?
74 assert repo2.is_default?
75
76 assert_difference 'Repository.count', -1 do
77 repo1.destroy
78 end
79 end
80
52 def test_blank_path_to_repository_error_message
81 def test_blank_path_to_repository_error_message
53 set_language_if_valid 'en'
82 set_language_if_valid 'en'
54 repo = Repository::Git.new(
83 repo = Repository::Git.new(
General Comments 0
You need to be logged in to leave comments. Login now