@@ -37,8 +37,8 class Repository < ActiveRecord::Base | |||
|
37 | 37 | validates_presence_of :identifier, :unless => Proc.new { |r| r.is_default? || r.set_as_default? } |
|
38 | 38 | validates_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true |
|
39 | 39 | validates_exclusion_of :identifier, :in => %w(show entry raw changes annotate diff show stats graph) |
|
40 | # donwcase letters, digits, dashes but not digits only | |
|
41 | validates_format_of :identifier, :with => /^(?!\d+$)[a-z0-9\-]*$/, :allow_blank => true | |
|
40 | # donwcase letters, digits, dashes, underscores but not digits only | |
|
41 | validates_format_of :identifier, :with => /^(?!\d+$)[a-z0-9\-_]*$/, :allow_blank => true | |
|
42 | 42 | # Checks if the SCM is enabled when creating a repository |
|
43 | 43 | validate :repo_create_validation, :on => :create |
|
44 | 44 |
@@ -97,6 +97,15 class RepositoryTest < ActiveSupport::TestCase | |||
|
97 | 97 | assert_equal [repository1, repository2], Project.find(3).repositories.sort |
|
98 | 98 | end |
|
99 | 99 | |
|
100 | def test_identifier_should_accept_letters_digits_dashes_and_underscores | |
|
101 | r = Repository::Subversion.new( | |
|
102 | :project_id => 3, | |
|
103 | :identifier => 'svn-123_45', | |
|
104 | :url => 'file:///svn' | |
|
105 | ) | |
|
106 | assert r.save | |
|
107 | end | |
|
108 | ||
|
100 | 109 | def test_destroy |
|
101 | 110 | repository = Repository.find(10) |
|
102 | 111 | changesets = repository.changesets.count |
General Comments 0
You need to be logged in to leave comments.
Login now