Mercurial > hg > soundsoftware-site
comparison test/unit/.svn/text-base/repository_subversion_test.rb.svn-base @ 119:8661b858af72
* Update to Redmine trunk rev 4705
author | Chris Cannam |
---|---|
date | Thu, 13 Jan 2011 14:12:06 +0000 |
parents | 513646585e45 |
children | 051f544170fe |
comparison
equal
deleted
inserted
replaced
39:150ceac17a8d | 119:8661b858af72 |
---|---|
13 # | 13 # |
14 # You should have received a copy of the GNU General Public License | 14 # You should have received a copy of the GNU General Public License |
15 # along with this program; if not, write to the Free Software | 15 # along with this program; if not, write to the Free Software |
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
17 | 17 |
18 require File.dirname(__FILE__) + '/../test_helper' | 18 require File.expand_path('../../test_helper', __FILE__) |
19 | 19 |
20 class RepositorySubversionTest < ActiveSupport::TestCase | 20 class RepositorySubversionTest < ActiveSupport::TestCase |
21 fixtures :projects, :repositories | 21 fixtures :projects, :repositories, :enabled_modules, :users, :roles |
22 | 22 |
23 def setup | 23 def setup |
24 @project = Project.find(1) | 24 @project = Project.find(1) |
25 assert @repository = Repository::Subversion.create(:project => @project, :url => "file:///#{self.class.repository_path('subversion')}") | 25 assert @repository = Repository::Subversion.create(:project => @project, :url => "file:///#{self.class.repository_path('subversion')}") |
26 end | 26 end |
86 entries = @repository.entries('') | 86 entries = @repository.entries('') |
87 assert_not_nil entries, 'Expect to find entries' | 87 assert_not_nil entries, 'Expect to find entries' |
88 assert_equal 1, entries.size, 'Expect a single entry' | 88 assert_equal 1, entries.size, 'Expect a single entry' |
89 assert_equal 'README.txt', entries.first.name | 89 assert_equal 'README.txt', entries.first.name |
90 end | 90 end |
91 | |
92 def test_identifier | |
93 @repository.fetch_changesets | |
94 @repository.reload | |
95 c = @repository.changesets.find_by_revision('1') | |
96 assert_equal c.revision, c.identifier | |
97 end | |
98 | |
99 def test_find_changeset_by_empty_name | |
100 @repository.fetch_changesets | |
101 @repository.reload | |
102 ['', ' ', nil].each do |r| | |
103 assert_nil @repository.find_changeset_by_name(r) | |
104 end | |
105 end | |
106 | |
107 def test_identifier_nine_digit | |
108 c = Changeset.new(:repository => @repository, :committed_on => Time.now, | |
109 :revision => '123456789', :comments => 'test') | |
110 assert_equal c.identifier, c.revision | |
111 end | |
112 | |
113 def test_format_identifier | |
114 @repository.fetch_changesets | |
115 @repository.reload | |
116 c = @repository.changesets.find_by_revision('1') | |
117 assert_equal c.format_identifier, c.revision | |
118 end | |
119 | |
120 def test_format_identifier_nine_digit | |
121 c = Changeset.new(:repository => @repository, :committed_on => Time.now, | |
122 :revision => '123456789', :comments => 'test') | |
123 assert_equal c.format_identifier, c.revision | |
124 end | |
125 | |
126 def test_activities | |
127 c = Changeset.new(:repository => @repository, :committed_on => Time.now, | |
128 :revision => '1', :comments => 'test') | |
129 assert c.event_title.include?('1:') | |
130 assert_equal '1', c.event_url[:rev] | |
131 end | |
132 | |
133 def test_activities_nine_digit | |
134 c = Changeset.new(:repository => @repository, :committed_on => Time.now, | |
135 :revision => '123456789', :comments => 'test') | |
136 assert c.event_title.include?('123456789:') | |
137 assert_equal '123456789', c.event_url[:rev] | |
138 end | |
91 else | 139 else |
92 puts "Subversion test repository NOT FOUND. Skipping unit tests !!!" | 140 puts "Subversion test repository NOT FOUND. Skipping unit tests !!!" |
93 def test_fake; assert true end | 141 def test_fake; assert true end |
94 end | 142 end |
95 end | 143 end |