@@ -97,6 +97,31 class RepositoryTest < ActiveSupport::TestCase | |||||
97 | assert_equal [repository1, repository2], Project.find(3).repositories.sort |
|
97 | assert_equal [repository1, repository2], Project.find(3).repositories.sort | |
98 | end |
|
98 | end | |
99 |
|
99 | |||
|
100 | def test_default_repository_should_be_one | |||
|
101 | assert_equal 0, Project.find(3).repositories.count | |||
|
102 | repository1 = Repository::Subversion.new( | |||
|
103 | :project => Project.find(3), | |||
|
104 | :identifier => 'svn1', | |||
|
105 | :url => 'file:///svn1' | |||
|
106 | ) | |||
|
107 | assert repository1.save | |||
|
108 | assert repository1.is_default? | |||
|
109 | ||||
|
110 | repository2 = Repository::Subversion.new( | |||
|
111 | :project => Project.find(3), | |||
|
112 | :identifier => 'svn2', | |||
|
113 | :url => 'file:///svn2', | |||
|
114 | :is_default => true | |||
|
115 | ) | |||
|
116 | assert repository2.save | |||
|
117 | assert repository2.is_default? | |||
|
118 | repository1.reload | |||
|
119 | assert !repository1.is_default? | |||
|
120 | ||||
|
121 | assert_equal repository2, Project.find(3).repository | |||
|
122 | assert_equal [repository2, repository1], Project.find(3).repositories.sort | |||
|
123 | end | |||
|
124 | ||||
100 | def test_identifier_should_accept_letters_digits_dashes_and_underscores |
|
125 | def test_identifier_should_accept_letters_digits_dashes_and_underscores | |
101 | r = Repository::Subversion.new( |
|
126 | r = Repository::Subversion.new( | |
102 | :project_id => 3, |
|
127 | :project_id => 3, |
General Comments 0
You need to be logged in to leave comments.
Login now