##// END OF EJS Templates
remove trailing white-spaces from RepositoryTest...
Toshi MARUYAMA -
r12286:5315943bb991
parent child
Show More
@@ -1,392 +1,392
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2013 Jean-Philippe Lang
2 # Copyright (C) 2006-2013 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
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.expand_path('../../test_helper', __FILE__)
18 require File.expand_path('../../test_helper', __FILE__)
19
19
20 class RepositoryTest < ActiveSupport::TestCase
20 class RepositoryTest < ActiveSupport::TestCase
21 fixtures :projects,
21 fixtures :projects,
22 :trackers,
22 :trackers,
23 :projects_trackers,
23 :projects_trackers,
24 :enabled_modules,
24 :enabled_modules,
25 :repositories,
25 :repositories,
26 :issues,
26 :issues,
27 :issue_statuses,
27 :issue_statuses,
28 :issue_categories,
28 :issue_categories,
29 :changesets,
29 :changesets,
30 :changes,
30 :changes,
31 :users,
31 :users,
32 :members,
32 :members,
33 :member_roles,
33 :member_roles,
34 :roles,
34 :roles,
35 :enumerations
35 :enumerations
36
36
37 include Redmine::I18n
37 include Redmine::I18n
38
38
39 def setup
39 def setup
40 @repository = Project.find(1).repository
40 @repository = Project.find(1).repository
41 end
41 end
42
42
43 def test_blank_log_encoding_error_message
43 def test_blank_log_encoding_error_message
44 set_language_if_valid 'en'
44 set_language_if_valid 'en'
45 repo = Repository::Bazaar.new(
45 repo = Repository::Bazaar.new(
46 :project => Project.find(3),
46 :project => Project.find(3),
47 :url => "/test",
47 :url => "/test",
48 :log_encoding => ''
48 :log_encoding => ''
49 )
49 )
50 assert !repo.save
50 assert !repo.save
51 assert_include "Commit messages encoding can't be blank",
51 assert_include "Commit messages encoding can't be blank",
52 repo.errors.full_messages
52 repo.errors.full_messages
53 end
53 end
54
54
55 def test_blank_log_encoding_error_message_fr
55 def test_blank_log_encoding_error_message_fr
56 set_language_if_valid 'fr'
56 set_language_if_valid 'fr'
57 str = "Encodage des messages de commit doit \xc3\xaatre renseign\xc3\xa9(e)"
57 str = "Encodage des messages de commit doit \xc3\xaatre renseign\xc3\xa9(e)"
58 str.force_encoding('UTF-8') if str.respond_to?(:force_encoding)
58 str.force_encoding('UTF-8') if str.respond_to?(:force_encoding)
59 repo = Repository::Bazaar.new(
59 repo = Repository::Bazaar.new(
60 :project => Project.find(3),
60 :project => Project.find(3),
61 :url => "/test"
61 :url => "/test"
62 )
62 )
63 assert !repo.save
63 assert !repo.save
64 assert_include str, repo.errors.full_messages
64 assert_include str, repo.errors.full_messages
65 end
65 end
66
66
67 def test_create
67 def test_create
68 repository = Repository::Subversion.new(:project => Project.find(3))
68 repository = Repository::Subversion.new(:project => Project.find(3))
69 assert !repository.save
69 assert !repository.save
70
70
71 repository.url = "svn://localhost"
71 repository.url = "svn://localhost"
72 assert repository.save
72 assert repository.save
73 repository.reload
73 repository.reload
74
74
75 project = Project.find(3)
75 project = Project.find(3)
76 assert_equal repository, project.repository
76 assert_equal repository, project.repository
77 end
77 end
78
78
79 def test_first_repository_should_be_set_as_default
79 def test_first_repository_should_be_set_as_default
80 repository1 = Repository::Subversion.new(
80 repository1 = Repository::Subversion.new(
81 :project => Project.find(3),
81 :project => Project.find(3),
82 :identifier => 'svn1',
82 :identifier => 'svn1',
83 :url => 'file:///svn1'
83 :url => 'file:///svn1'
84 )
84 )
85 assert repository1.save
85 assert repository1.save
86 assert repository1.is_default?
86 assert repository1.is_default?
87
87
88 repository2 = Repository::Subversion.new(
88 repository2 = Repository::Subversion.new(
89 :project => Project.find(3),
89 :project => Project.find(3),
90 :identifier => 'svn2',
90 :identifier => 'svn2',
91 :url => 'file:///svn2'
91 :url => 'file:///svn2'
92 )
92 )
93 assert repository2.save
93 assert repository2.save
94 assert !repository2.is_default?
94 assert !repository2.is_default?
95
95
96 assert_equal repository1, Project.find(3).repository
96 assert_equal repository1, Project.find(3).repository
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
100 def test_default_repository_should_be_one
101 assert_equal 0, Project.find(3).repositories.count
101 assert_equal 0, Project.find(3).repositories.count
102 repository1 = Repository::Subversion.new(
102 repository1 = Repository::Subversion.new(
103 :project => Project.find(3),
103 :project => Project.find(3),
104 :identifier => 'svn1',
104 :identifier => 'svn1',
105 :url => 'file:///svn1'
105 :url => 'file:///svn1'
106 )
106 )
107 assert repository1.save
107 assert repository1.save
108 assert repository1.is_default?
108 assert repository1.is_default?
109
109
110 repository2 = Repository::Subversion.new(
110 repository2 = Repository::Subversion.new(
111 :project => Project.find(3),
111 :project => Project.find(3),
112 :identifier => 'svn2',
112 :identifier => 'svn2',
113 :url => 'file:///svn2',
113 :url => 'file:///svn2',
114 :is_default => true
114 :is_default => true
115 )
115 )
116 assert repository2.save
116 assert repository2.save
117 assert repository2.is_default?
117 assert repository2.is_default?
118 repository1.reload
118 repository1.reload
119 assert !repository1.is_default?
119 assert !repository1.is_default?
120
120
121 assert_equal repository2, Project.find(3).repository
121 assert_equal repository2, Project.find(3).repository
122 assert_equal [repository2, repository1], Project.find(3).repositories.sort
122 assert_equal [repository2, repository1], Project.find(3).repositories.sort
123 end
123 end
124
124
125 def test_identifier_should_accept_letters_digits_dashes_and_underscores
125 def test_identifier_should_accept_letters_digits_dashes_and_underscores
126 r = Repository::Subversion.new(
126 r = Repository::Subversion.new(
127 :project_id => 3,
127 :project_id => 3,
128 :identifier => 'svn-123_45',
128 :identifier => 'svn-123_45',
129 :url => 'file:///svn'
129 :url => 'file:///svn'
130 )
130 )
131 assert r.save
131 assert r.save
132 end
132 end
133
133
134 def test_identifier_should_not_be_frozen_for_a_new_repository
134 def test_identifier_should_not_be_frozen_for_a_new_repository
135 assert_equal false, Repository.new.identifier_frozen?
135 assert_equal false, Repository.new.identifier_frozen?
136 end
136 end
137
137
138 def test_identifier_should_not_be_frozen_for_a_saved_repository_with_blank_identifier
138 def test_identifier_should_not_be_frozen_for_a_saved_repository_with_blank_identifier
139 Repository.where(:id => 10).update_all(["identifier = ''"])
139 Repository.where(:id => 10).update_all(["identifier = ''"])
140 assert_equal false, Repository.find(10).identifier_frozen?
140 assert_equal false, Repository.find(10).identifier_frozen?
141 end
141 end
142
142
143 def test_identifier_should_be_frozen_for_a_saved_repository_with_valid_identifier
143 def test_identifier_should_be_frozen_for_a_saved_repository_with_valid_identifier
144 Repository.where(:id => 10).update_all(["identifier = 'abc123'"])
144 Repository.where(:id => 10).update_all(["identifier = 'abc123'"])
145 assert_equal true, Repository.find(10).identifier_frozen?
145 assert_equal true, Repository.find(10).identifier_frozen?
146 end
146 end
147
147
148 def test_identifier_should_not_accept_change_if_frozen
148 def test_identifier_should_not_accept_change_if_frozen
149 r = Repository.new(:identifier => 'foo')
149 r = Repository.new(:identifier => 'foo')
150 r.stubs(:identifier_frozen?).returns(true)
150 r.stubs(:identifier_frozen?).returns(true)
151
151
152 r.identifier = 'bar'
152 r.identifier = 'bar'
153 assert_equal 'foo', r.identifier
153 assert_equal 'foo', r.identifier
154 end
154 end
155
155
156 def test_identifier_should_accept_change_if_not_frozen
156 def test_identifier_should_accept_change_if_not_frozen
157 r = Repository.new(:identifier => 'foo')
157 r = Repository.new(:identifier => 'foo')
158 r.stubs(:identifier_frozen?).returns(false)
158 r.stubs(:identifier_frozen?).returns(false)
159
159
160 r.identifier = 'bar'
160 r.identifier = 'bar'
161 assert_equal 'bar', r.identifier
161 assert_equal 'bar', r.identifier
162 end
162 end
163
163
164 def test_destroy
164 def test_destroy
165 repository = Repository.find(10)
165 repository = Repository.find(10)
166 changesets = repository.changesets.count
166 changesets = repository.changesets.count
167 changes = repository.filechanges.count
167 changes = repository.filechanges.count
168
168
169 assert_difference 'Changeset.count', -changesets do
169 assert_difference 'Changeset.count', -changesets do
170 assert_difference 'Change.count', -changes do
170 assert_difference 'Change.count', -changes do
171 Repository.find(10).destroy
171 Repository.find(10).destroy
172 end
172 end
173 end
173 end
174 end
174 end
175
175
176 def test_destroy_should_delete_parents_associations
176 def test_destroy_should_delete_parents_associations
177 changeset = Changeset.find(102)
177 changeset = Changeset.find(102)
178 changeset.parents = Changeset.where(:id => [100, 101]).all
178 changeset.parents = Changeset.where(:id => [100, 101]).all
179 assert_difference 'Changeset.connection.select_all("select * from changeset_parents").count', -2 do
179 assert_difference 'Changeset.connection.select_all("select * from changeset_parents").count', -2 do
180 Repository.find(10).destroy
180 Repository.find(10).destroy
181 end
181 end
182 end
182 end
183
183
184 def test_destroy_should_delete_issues_associations
184 def test_destroy_should_delete_issues_associations
185 changeset = Changeset.find(102)
185 changeset = Changeset.find(102)
186 changeset.issues = Issue.where(:id => [1, 2]).all
186 changeset.issues = Issue.where(:id => [1, 2]).all
187 assert_difference 'Changeset.connection.select_all("select * from changesets_issues").count', -2 do
187 assert_difference 'Changeset.connection.select_all("select * from changesets_issues").count', -2 do
188 Repository.find(10).destroy
188 Repository.find(10).destroy
189 end
189 end
190 end
190 end
191
191
192 def test_should_not_create_with_disabled_scm
192 def test_should_not_create_with_disabled_scm
193 # disable Subversion
193 # disable Subversion
194 with_settings :enabled_scm => ['Darcs', 'Git'] do
194 with_settings :enabled_scm => ['Darcs', 'Git'] do
195 repository = Repository::Subversion.new(
195 repository = Repository::Subversion.new(
196 :project => Project.find(3), :url => "svn://localhost")
196 :project => Project.find(3), :url => "svn://localhost")
197 assert !repository.save
197 assert !repository.save
198 assert_include I18n.translate('activerecord.errors.messages.invalid'),
198 assert_include I18n.translate('activerecord.errors.messages.invalid'),
199 repository.errors[:type]
199 repository.errors[:type]
200 end
200 end
201 end
201 end
202
202
203 def test_scan_changesets_for_issue_ids
203 def test_scan_changesets_for_issue_ids
204 Setting.default_language = 'en'
204 Setting.default_language = 'en'
205 Setting.commit_ref_keywords = 'refs , references, IssueID'
205 Setting.commit_ref_keywords = 'refs , references, IssueID'
206 Setting.commit_update_keywords = [
206 Setting.commit_update_keywords = [
207 {'keywords' => 'fixes , closes',
207 {'keywords' => 'fixes , closes',
208 'status_id' => IssueStatus.where(:is_closed => true).first.id,
208 'status_id' => IssueStatus.where(:is_closed => true).first.id,
209 'done_ratio' => '90'}
209 'done_ratio' => '90'}
210 ]
210 ]
211 Setting.default_language = 'en'
211 Setting.default_language = 'en'
212 ActionMailer::Base.deliveries.clear
212 ActionMailer::Base.deliveries.clear
213
213
214 # make sure issue 1 is not already closed
214 # make sure issue 1 is not already closed
215 fixed_issue = Issue.find(1)
215 fixed_issue = Issue.find(1)
216 assert !fixed_issue.status.is_closed?
216 assert !fixed_issue.status.is_closed?
217 old_status = fixed_issue.status
217 old_status = fixed_issue.status
218
218
219 with_settings :notified_events => %w(issue_added issue_updated) do
219 with_settings :notified_events => %w(issue_added issue_updated) do
220 Repository.scan_changesets_for_issue_ids
220 Repository.scan_changesets_for_issue_ids
221 end
221 end
222 assert_equal [101, 102], Issue.find(3).changeset_ids
222 assert_equal [101, 102], Issue.find(3).changeset_ids
223
223
224 # fixed issues
224 # fixed issues
225 fixed_issue.reload
225 fixed_issue.reload
226 assert fixed_issue.status.is_closed?
226 assert fixed_issue.status.is_closed?
227 assert_equal 90, fixed_issue.done_ratio
227 assert_equal 90, fixed_issue.done_ratio
228 assert_equal [101], fixed_issue.changeset_ids
228 assert_equal [101], fixed_issue.changeset_ids
229
229
230 # issue change
230 # issue change
231 journal = fixed_issue.journals.reorder('created_on desc').first
231 journal = fixed_issue.journals.reorder('created_on desc').first
232 assert_equal User.find_by_login('dlopper'), journal.user
232 assert_equal User.find_by_login('dlopper'), journal.user
233 assert_equal 'Applied in changeset r2.', journal.notes
233 assert_equal 'Applied in changeset r2.', journal.notes
234
234
235 # 2 email notifications
235 # 2 email notifications
236 assert_equal 2, ActionMailer::Base.deliveries.size
236 assert_equal 2, ActionMailer::Base.deliveries.size
237 mail = ActionMailer::Base.deliveries.first
237 mail = ActionMailer::Base.deliveries.first
238 assert_not_nil mail
238 assert_not_nil mail
239 assert mail.subject.starts_with?(
239 assert mail.subject.starts_with?(
240 "[#{fixed_issue.project.name} - #{fixed_issue.tracker.name} ##{fixed_issue.id}]")
240 "[#{fixed_issue.project.name} - #{fixed_issue.tracker.name} ##{fixed_issue.id}]")
241 assert_mail_body_match(
241 assert_mail_body_match(
242 "Status changed from #{old_status} to #{fixed_issue.status}", mail)
242 "Status changed from #{old_status} to #{fixed_issue.status}", mail)
243
243
244 # ignoring commits referencing an issue of another project
244 # ignoring commits referencing an issue of another project
245 assert_equal [], Issue.find(4).changesets
245 assert_equal [], Issue.find(4).changesets
246 end
246 end
247
247
248 def test_for_changeset_comments_strip
248 def test_for_changeset_comments_strip
249 repository = Repository::Mercurial.create(
249 repository = Repository::Mercurial.create(
250 :project => Project.find( 4 ),
250 :project => Project.find( 4 ),
251 :url => '/foo/bar/baz' )
251 :url => '/foo/bar/baz' )
252 comment = <<-COMMENT
252 comment = <<-COMMENT
253 This is a loooooooooooooooooooooooooooong comment
253 This is a loooooooooooooooooooooooooooong comment
254
254
255
255
256 COMMENT
256 COMMENT
257 changeset = Changeset.new(
257 changeset = Changeset.new(
258 :comments => comment, :commit_date => Time.now,
258 :comments => comment, :commit_date => Time.now,
259 :revision => 0, :scmid => 'f39b7922fb3c',
259 :revision => 0, :scmid => 'f39b7922fb3c',
260 :committer => 'foo <foo@example.com>',
260 :committer => 'foo <foo@example.com>',
261 :committed_on => Time.now, :repository => repository )
261 :committed_on => Time.now, :repository => repository )
262 assert( changeset.save )
262 assert( changeset.save )
263 assert_not_equal( comment, changeset.comments )
263 assert_not_equal( comment, changeset.comments )
264 assert_equal( 'This is a loooooooooooooooooooooooooooong comment',
264 assert_equal( 'This is a loooooooooooooooooooooooooooong comment',
265 changeset.comments )
265 changeset.comments )
266 end
266 end
267
267
268 def test_for_urls_strip_cvs
268 def test_for_urls_strip_cvs
269 repository = Repository::Cvs.create(
269 repository = Repository::Cvs.create(
270 :project => Project.find(4),
270 :project => Project.find(4),
271 :url => ' :pserver:login:password@host:/path/to/the/repository',
271 :url => ' :pserver:login:password@host:/path/to/the/repository',
272 :root_url => 'foo ',
272 :root_url => 'foo ',
273 :log_encoding => 'UTF-8')
273 :log_encoding => 'UTF-8')
274 assert repository.save
274 assert repository.save
275 repository.reload
275 repository.reload
276 assert_equal ':pserver:login:password@host:/path/to/the/repository',
276 assert_equal ':pserver:login:password@host:/path/to/the/repository',
277 repository.url
277 repository.url
278 assert_equal 'foo', repository.root_url
278 assert_equal 'foo', repository.root_url
279 end
279 end
280
280
281 def test_for_urls_strip_subversion
281 def test_for_urls_strip_subversion
282 repository = Repository::Subversion.create(
282 repository = Repository::Subversion.create(
283 :project => Project.find(4),
283 :project => Project.find(4),
284 :url => ' file:///dummy ')
284 :url => ' file:///dummy ')
285 assert repository.save
285 assert repository.save
286 repository.reload
286 repository.reload
287 assert_equal 'file:///dummy', repository.url
287 assert_equal 'file:///dummy', repository.url
288 end
288 end
289
289
290 def test_for_urls_strip_git
290 def test_for_urls_strip_git
291 repository = Repository::Git.create(
291 repository = Repository::Git.create(
292 :project => Project.find(4),
292 :project => Project.find(4),
293 :url => ' c:\dummy ')
293 :url => ' c:\dummy ')
294 assert repository.save
294 assert repository.save
295 repository.reload
295 repository.reload
296 assert_equal 'c:\dummy', repository.url
296 assert_equal 'c:\dummy', repository.url
297 end
297 end
298
298
299 def test_manual_user_mapping
299 def test_manual_user_mapping
300 assert_no_difference "Changeset.where('user_id <> 2').count" do
300 assert_no_difference "Changeset.where('user_id <> 2').count" do
301 c = Changeset.create!(
301 c = Changeset.create!(
302 :repository => @repository,
302 :repository => @repository,
303 :committer => 'foo',
303 :committer => 'foo',
304 :committed_on => Time.now,
304 :committed_on => Time.now,
305 :revision => 100,
305 :revision => 100,
306 :comments => 'Committed by foo.'
306 :comments => 'Committed by foo.'
307 )
307 )
308 assert_nil c.user
308 assert_nil c.user
309 @repository.committer_ids = {'foo' => '2'}
309 @repository.committer_ids = {'foo' => '2'}
310 assert_equal User.find(2), c.reload.user
310 assert_equal User.find(2), c.reload.user
311 # committer is now mapped
311 # committer is now mapped
312 c = Changeset.create!(
312 c = Changeset.create!(
313 :repository => @repository,
313 :repository => @repository,
314 :committer => 'foo',
314 :committer => 'foo',
315 :committed_on => Time.now,
315 :committed_on => Time.now,
316 :revision => 101,
316 :revision => 101,
317 :comments => 'Another commit by foo.'
317 :comments => 'Another commit by foo.'
318 )
318 )
319 assert_equal User.find(2), c.user
319 assert_equal User.find(2), c.user
320 end
320 end
321 end
321 end
322
322
323 def test_auto_user_mapping_by_username
323 def test_auto_user_mapping_by_username
324 c = Changeset.create!(
324 c = Changeset.create!(
325 :repository => @repository,
325 :repository => @repository,
326 :committer => 'jsmith',
326 :committer => 'jsmith',
327 :committed_on => Time.now,
327 :committed_on => Time.now,
328 :revision => 100,
328 :revision => 100,
329 :comments => 'Committed by john.'
329 :comments => 'Committed by john.'
330 )
330 )
331 assert_equal User.find(2), c.user
331 assert_equal User.find(2), c.user
332 end
332 end
333
333
334 def test_auto_user_mapping_by_email
334 def test_auto_user_mapping_by_email
335 c = Changeset.create!(
335 c = Changeset.create!(
336 :repository => @repository,
336 :repository => @repository,
337 :committer => 'john <jsmith@somenet.foo>',
337 :committer => 'john <jsmith@somenet.foo>',
338 :committed_on => Time.now,
338 :committed_on => Time.now,
339 :revision => 100,
339 :revision => 100,
340 :comments => 'Committed by john.'
340 :comments => 'Committed by john.'
341 )
341 )
342 assert_equal User.find(2), c.user
342 assert_equal User.find(2), c.user
343 end
343 end
344
344
345 def test_filesystem_avaialbe
345 def test_filesystem_avaialbe
346 klass = Repository::Filesystem
346 klass = Repository::Filesystem
347 assert klass.scm_adapter_class
347 assert klass.scm_adapter_class
348 assert_equal true, klass.scm_available
348 assert_equal true, klass.scm_available
349 end
349 end
350
350
351 def test_merge_extra_info
351 def test_merge_extra_info
352 repo = Repository::Subversion.new(:project => Project.find(3))
352 repo = Repository::Subversion.new(:project => Project.find(3))
353 assert !repo.save
353 assert !repo.save
354 repo.url = "svn://localhost"
354 repo.url = "svn://localhost"
355 assert repo.save
355 assert repo.save
356 repo.reload
356 repo.reload
357 project = Project.find(3)
357 project = Project.find(3)
358 assert_equal repo, project.repository
358 assert_equal repo, project.repository
359 assert_nil repo.extra_info
359 assert_nil repo.extra_info
360 h1 = {"test_1" => {"test_11" => "test_value_11"}}
360 h1 = {"test_1" => {"test_11" => "test_value_11"}}
361 repo.merge_extra_info(h1)
361 repo.merge_extra_info(h1)
362 assert_equal h1, repo.extra_info
362 assert_equal h1, repo.extra_info
363 h2 = {"test_2" => {
363 h2 = {"test_2" => {
364 "test_21" => "test_value_21",
364 "test_21" => "test_value_21",
365 "test_22" => "test_value_22",
365 "test_22" => "test_value_22",
366 }}
366 }}
367 repo.merge_extra_info(h2)
367 repo.merge_extra_info(h2)
368 assert_equal (h = {"test_11" => "test_value_11"}),
368 assert_equal (h = {"test_11" => "test_value_11"}),
369 repo.extra_info["test_1"]
369 repo.extra_info["test_1"]
370 assert_equal "test_value_21",
370 assert_equal "test_value_21",
371 repo.extra_info["test_2"]["test_21"]
371 repo.extra_info["test_2"]["test_21"]
372 h3 = {"test_2" => {
372 h3 = {"test_2" => {
373 "test_23" => "test_value_23",
373 "test_23" => "test_value_23",
374 "test_24" => "test_value_24",
374 "test_24" => "test_value_24",
375 }}
375 }}
376 repo.merge_extra_info(h3)
376 repo.merge_extra_info(h3)
377 assert_equal (h = {"test_11" => "test_value_11"}),
377 assert_equal (h = {"test_11" => "test_value_11"}),
378 repo.extra_info["test_1"]
378 repo.extra_info["test_1"]
379 assert_nil repo.extra_info["test_2"]["test_21"]
379 assert_nil repo.extra_info["test_2"]["test_21"]
380 assert_equal "test_value_23",
380 assert_equal "test_value_23",
381 repo.extra_info["test_2"]["test_23"]
381 repo.extra_info["test_2"]["test_23"]
382 end
382 end
383
383
384 def test_sort_should_not_raise_an_error_with_nil_identifiers
384 def test_sort_should_not_raise_an_error_with_nil_identifiers
385 r1 = Repository.new
385 r1 = Repository.new
386 r2 = Repository.new
386 r2 = Repository.new
387
387
388 assert_nothing_raised do
388 assert_nothing_raised do
389 [r1, r2].sort
389 [r1, r2].sort
390 end
390 end
391 end
391 end
392 end
392 end
General Comments 0
You need to be logged in to leave comments. Login now