@@ -1,313 +1,321 | |||||
1 | # Redmine - project management software |
|
1 | # Redmine - project management software | |
2 | # Copyright (C) 2006-2011 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2011 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(:project => Project.find(3), :identifier => 'svn1', :url => 'file:///svn1') |
|
80 | repository1 = Repository::Subversion.new( | |
|
81 | :project => Project.find(3), | |||
|
82 | :identifier => 'svn1', | |||
|
83 | :url => 'file:///svn1' | |||
|
84 | ) | |||
81 | assert repository1.save |
|
85 | assert repository1.save | |
82 | assert repository1.is_default? |
|
86 | assert repository1.is_default? | |
83 |
|
87 | |||
84 | repository2 = Repository::Subversion.new(:project => Project.find(3), :identifier => 'svn2', :url => 'file:///svn2') |
|
88 | repository2 = Repository::Subversion.new( | |
|
89 | :project => Project.find(3), | |||
|
90 | :identifier => 'svn2', | |||
|
91 | :url => 'file:///svn2' | |||
|
92 | ) | |||
85 | assert repository2.save |
|
93 | assert repository2.save | |
86 | assert !repository2.is_default? |
|
94 | assert !repository2.is_default? | |
87 |
|
95 | |||
88 | assert_equal repository1, Project.find(3).repository |
|
96 | assert_equal repository1, Project.find(3).repository | |
89 | assert_equal [repository1, repository2], Project.find(3).repositories.sort |
|
97 | assert_equal [repository1, repository2], Project.find(3).repositories.sort | |
90 | end |
|
98 | end | |
91 |
|
99 | |||
92 | def test_destroy |
|
100 | def test_destroy | |
93 | changesets = Changeset.count(:all, :conditions => "repository_id = 10") |
|
101 | changesets = Changeset.count(:all, :conditions => "repository_id = 10") | |
94 | changes = Change.count(:all, :conditions => "repository_id = 10", |
|
102 | changes = Change.count(:all, :conditions => "repository_id = 10", | |
95 | :include => :changeset) |
|
103 | :include => :changeset) | |
96 | assert_difference 'Changeset.count', -changesets do |
|
104 | assert_difference 'Changeset.count', -changesets do | |
97 | assert_difference 'Change.count', -changes do |
|
105 | assert_difference 'Change.count', -changes do | |
98 | Repository.find(10).destroy |
|
106 | Repository.find(10).destroy | |
99 | end |
|
107 | end | |
100 | end |
|
108 | end | |
101 | end |
|
109 | end | |
102 |
|
110 | |||
103 | def test_destroy_should_delete_parents_associations |
|
111 | def test_destroy_should_delete_parents_associations | |
104 | changeset = Changeset.find(102) |
|
112 | changeset = Changeset.find(102) | |
105 | changeset.parents = Changeset.find_all_by_id([100, 101]) |
|
113 | changeset.parents = Changeset.find_all_by_id([100, 101]) | |
106 |
|
114 | |||
107 | assert_difference 'Changeset.connection.select_all("select * from changeset_parents").size', -2 do |
|
115 | assert_difference 'Changeset.connection.select_all("select * from changeset_parents").size', -2 do | |
108 | Repository.find(10).destroy |
|
116 | Repository.find(10).destroy | |
109 | end |
|
117 | end | |
110 | end |
|
118 | end | |
111 |
|
119 | |||
112 | def test_destroy_should_delete_issues_associations |
|
120 | def test_destroy_should_delete_issues_associations | |
113 | changeset = Changeset.find(102) |
|
121 | changeset = Changeset.find(102) | |
114 | changeset.issues = Issue.find_all_by_id([1, 2]) |
|
122 | changeset.issues = Issue.find_all_by_id([1, 2]) | |
115 |
|
123 | |||
116 | assert_difference 'Changeset.connection.select_all("select * from changesets_issues").size', -2 do |
|
124 | assert_difference 'Changeset.connection.select_all("select * from changesets_issues").size', -2 do | |
117 | Repository.find(10).destroy |
|
125 | Repository.find(10).destroy | |
118 | end |
|
126 | end | |
119 | end |
|
127 | end | |
120 |
|
128 | |||
121 | def test_should_not_create_with_disabled_scm |
|
129 | def test_should_not_create_with_disabled_scm | |
122 | # disable Subversion |
|
130 | # disable Subversion | |
123 | with_settings :enabled_scm => ['Darcs', 'Git'] do |
|
131 | with_settings :enabled_scm => ['Darcs', 'Git'] do | |
124 | repository = Repository::Subversion.new( |
|
132 | repository = Repository::Subversion.new( | |
125 | :project => Project.find(3), :url => "svn://localhost") |
|
133 | :project => Project.find(3), :url => "svn://localhost") | |
126 | assert !repository.save |
|
134 | assert !repository.save | |
127 | assert_equal I18n.translate('activerecord.errors.messages.invalid'), |
|
135 | assert_equal I18n.translate('activerecord.errors.messages.invalid'), | |
128 | repository.errors[:type].to_s |
|
136 | repository.errors[:type].to_s | |
129 | end |
|
137 | end | |
130 | end |
|
138 | end | |
131 |
|
139 | |||
132 | def test_scan_changesets_for_issue_ids |
|
140 | def test_scan_changesets_for_issue_ids | |
133 | Setting.default_language = 'en' |
|
141 | Setting.default_language = 'en' | |
134 | Setting.notified_events = ['issue_added','issue_updated'] |
|
142 | Setting.notified_events = ['issue_added','issue_updated'] | |
135 |
|
143 | |||
136 | # choosing a status to apply to fix issues |
|
144 | # choosing a status to apply to fix issues | |
137 | Setting.commit_fix_status_id = IssueStatus.find( |
|
145 | Setting.commit_fix_status_id = IssueStatus.find( | |
138 | :first, |
|
146 | :first, | |
139 | :conditions => ["is_closed = ?", true]).id |
|
147 | :conditions => ["is_closed = ?", true]).id | |
140 | Setting.commit_fix_done_ratio = "90" |
|
148 | Setting.commit_fix_done_ratio = "90" | |
141 | Setting.commit_ref_keywords = 'refs , references, IssueID' |
|
149 | Setting.commit_ref_keywords = 'refs , references, IssueID' | |
142 | Setting.commit_fix_keywords = 'fixes , closes' |
|
150 | Setting.commit_fix_keywords = 'fixes , closes' | |
143 | Setting.default_language = 'en' |
|
151 | Setting.default_language = 'en' | |
144 | ActionMailer::Base.deliveries.clear |
|
152 | ActionMailer::Base.deliveries.clear | |
145 |
|
153 | |||
146 | # make sure issue 1 is not already closed |
|
154 | # make sure issue 1 is not already closed | |
147 | fixed_issue = Issue.find(1) |
|
155 | fixed_issue = Issue.find(1) | |
148 | assert !fixed_issue.status.is_closed? |
|
156 | assert !fixed_issue.status.is_closed? | |
149 | old_status = fixed_issue.status |
|
157 | old_status = fixed_issue.status | |
150 |
|
158 | |||
151 | Repository.scan_changesets_for_issue_ids |
|
159 | Repository.scan_changesets_for_issue_ids | |
152 | assert_equal [101, 102], Issue.find(3).changeset_ids |
|
160 | assert_equal [101, 102], Issue.find(3).changeset_ids | |
153 |
|
161 | |||
154 | # fixed issues |
|
162 | # fixed issues | |
155 | fixed_issue.reload |
|
163 | fixed_issue.reload | |
156 | assert fixed_issue.status.is_closed? |
|
164 | assert fixed_issue.status.is_closed? | |
157 | assert_equal 90, fixed_issue.done_ratio |
|
165 | assert_equal 90, fixed_issue.done_ratio | |
158 | assert_equal [101], fixed_issue.changeset_ids |
|
166 | assert_equal [101], fixed_issue.changeset_ids | |
159 |
|
167 | |||
160 | # issue change |
|
168 | # issue change | |
161 | journal = fixed_issue.journals.find(:first, :order => 'created_on desc') |
|
169 | journal = fixed_issue.journals.find(:first, :order => 'created_on desc') | |
162 | assert_equal User.find_by_login('dlopper'), journal.user |
|
170 | assert_equal User.find_by_login('dlopper'), journal.user | |
163 | assert_equal 'Applied in changeset r2.', journal.notes |
|
171 | assert_equal 'Applied in changeset r2.', journal.notes | |
164 |
|
172 | |||
165 | # 2 email notifications |
|
173 | # 2 email notifications | |
166 | assert_equal 2, ActionMailer::Base.deliveries.size |
|
174 | assert_equal 2, ActionMailer::Base.deliveries.size | |
167 | mail = ActionMailer::Base.deliveries.first |
|
175 | mail = ActionMailer::Base.deliveries.first | |
168 | assert_kind_of TMail::Mail, mail |
|
176 | assert_kind_of TMail::Mail, mail | |
169 | assert mail.subject.starts_with?( |
|
177 | assert mail.subject.starts_with?( | |
170 | "[#{fixed_issue.project.name} - #{fixed_issue.tracker.name} ##{fixed_issue.id}]") |
|
178 | "[#{fixed_issue.project.name} - #{fixed_issue.tracker.name} ##{fixed_issue.id}]") | |
171 | assert mail.body.include?( |
|
179 | assert mail.body.include?( | |
172 | "Status changed from #{old_status} to #{fixed_issue.status}") |
|
180 | "Status changed from #{old_status} to #{fixed_issue.status}") | |
173 |
|
181 | |||
174 | # ignoring commits referencing an issue of another project |
|
182 | # ignoring commits referencing an issue of another project | |
175 | assert_equal [], Issue.find(4).changesets |
|
183 | assert_equal [], Issue.find(4).changesets | |
176 | end |
|
184 | end | |
177 |
|
185 | |||
178 | def test_for_changeset_comments_strip |
|
186 | def test_for_changeset_comments_strip | |
179 | repository = Repository::Mercurial.create( |
|
187 | repository = Repository::Mercurial.create( | |
180 | :project => Project.find( 4 ), |
|
188 | :project => Project.find( 4 ), | |
181 | :url => '/foo/bar/baz' ) |
|
189 | :url => '/foo/bar/baz' ) | |
182 | comment = <<-COMMENT |
|
190 | comment = <<-COMMENT | |
183 | This is a loooooooooooooooooooooooooooong comment |
|
191 | This is a loooooooooooooooooooooooooooong comment | |
184 |
|
192 | |||
185 |
|
193 | |||
186 | COMMENT |
|
194 | COMMENT | |
187 | changeset = Changeset.new( |
|
195 | changeset = Changeset.new( | |
188 | :comments => comment, :commit_date => Time.now, |
|
196 | :comments => comment, :commit_date => Time.now, | |
189 | :revision => 0, :scmid => 'f39b7922fb3c', |
|
197 | :revision => 0, :scmid => 'f39b7922fb3c', | |
190 | :committer => 'foo <foo@example.com>', |
|
198 | :committer => 'foo <foo@example.com>', | |
191 | :committed_on => Time.now, :repository => repository ) |
|
199 | :committed_on => Time.now, :repository => repository ) | |
192 | assert( changeset.save ) |
|
200 | assert( changeset.save ) | |
193 | assert_not_equal( comment, changeset.comments ) |
|
201 | assert_not_equal( comment, changeset.comments ) | |
194 | assert_equal( 'This is a loooooooooooooooooooooooooooong comment', |
|
202 | assert_equal( 'This is a loooooooooooooooooooooooooooong comment', | |
195 | changeset.comments ) |
|
203 | changeset.comments ) | |
196 | end |
|
204 | end | |
197 |
|
205 | |||
198 | def test_for_urls_strip_cvs |
|
206 | def test_for_urls_strip_cvs | |
199 | repository = Repository::Cvs.create( |
|
207 | repository = Repository::Cvs.create( | |
200 | :project => Project.find(4), |
|
208 | :project => Project.find(4), | |
201 | :url => ' :pserver:login:password@host:/path/to/the/repository', |
|
209 | :url => ' :pserver:login:password@host:/path/to/the/repository', | |
202 | :root_url => 'foo ', |
|
210 | :root_url => 'foo ', | |
203 | :log_encoding => 'UTF-8') |
|
211 | :log_encoding => 'UTF-8') | |
204 | assert repository.save |
|
212 | assert repository.save | |
205 | repository.reload |
|
213 | repository.reload | |
206 | assert_equal ':pserver:login:password@host:/path/to/the/repository', |
|
214 | assert_equal ':pserver:login:password@host:/path/to/the/repository', | |
207 | repository.url |
|
215 | repository.url | |
208 | assert_equal 'foo', repository.root_url |
|
216 | assert_equal 'foo', repository.root_url | |
209 | end |
|
217 | end | |
210 |
|
218 | |||
211 | def test_for_urls_strip_subversion |
|
219 | def test_for_urls_strip_subversion | |
212 | repository = Repository::Subversion.create( |
|
220 | repository = Repository::Subversion.create( | |
213 | :project => Project.find(4), |
|
221 | :project => Project.find(4), | |
214 | :url => ' file:///dummy ') |
|
222 | :url => ' file:///dummy ') | |
215 | assert repository.save |
|
223 | assert repository.save | |
216 | repository.reload |
|
224 | repository.reload | |
217 | assert_equal 'file:///dummy', repository.url |
|
225 | assert_equal 'file:///dummy', repository.url | |
218 | end |
|
226 | end | |
219 |
|
227 | |||
220 | def test_for_urls_strip_git |
|
228 | def test_for_urls_strip_git | |
221 | repository = Repository::Git.create( |
|
229 | repository = Repository::Git.create( | |
222 | :project => Project.find(4), |
|
230 | :project => Project.find(4), | |
223 | :url => ' c:\dummy ') |
|
231 | :url => ' c:\dummy ') | |
224 | assert repository.save |
|
232 | assert repository.save | |
225 | repository.reload |
|
233 | repository.reload | |
226 | assert_equal 'c:\dummy', repository.url |
|
234 | assert_equal 'c:\dummy', repository.url | |
227 | end |
|
235 | end | |
228 |
|
236 | |||
229 | def test_manual_user_mapping |
|
237 | def test_manual_user_mapping | |
230 | assert_no_difference "Changeset.count(:conditions => 'user_id <> 2')" do |
|
238 | assert_no_difference "Changeset.count(:conditions => 'user_id <> 2')" do | |
231 | c = Changeset.create!( |
|
239 | c = Changeset.create!( | |
232 | :repository => @repository, |
|
240 | :repository => @repository, | |
233 | :committer => 'foo', |
|
241 | :committer => 'foo', | |
234 | :committed_on => Time.now, |
|
242 | :committed_on => Time.now, | |
235 | :revision => 100, |
|
243 | :revision => 100, | |
236 | :comments => 'Committed by foo.' |
|
244 | :comments => 'Committed by foo.' | |
237 | ) |
|
245 | ) | |
238 | assert_nil c.user |
|
246 | assert_nil c.user | |
239 | @repository.committer_ids = {'foo' => '2'} |
|
247 | @repository.committer_ids = {'foo' => '2'} | |
240 | assert_equal User.find(2), c.reload.user |
|
248 | assert_equal User.find(2), c.reload.user | |
241 | # committer is now mapped |
|
249 | # committer is now mapped | |
242 | c = Changeset.create!( |
|
250 | c = Changeset.create!( | |
243 | :repository => @repository, |
|
251 | :repository => @repository, | |
244 | :committer => 'foo', |
|
252 | :committer => 'foo', | |
245 | :committed_on => Time.now, |
|
253 | :committed_on => Time.now, | |
246 | :revision => 101, |
|
254 | :revision => 101, | |
247 | :comments => 'Another commit by foo.' |
|
255 | :comments => 'Another commit by foo.' | |
248 | ) |
|
256 | ) | |
249 | assert_equal User.find(2), c.user |
|
257 | assert_equal User.find(2), c.user | |
250 | end |
|
258 | end | |
251 | end |
|
259 | end | |
252 |
|
260 | |||
253 | def test_auto_user_mapping_by_username |
|
261 | def test_auto_user_mapping_by_username | |
254 | c = Changeset.create!( |
|
262 | c = Changeset.create!( | |
255 | :repository => @repository, |
|
263 | :repository => @repository, | |
256 | :committer => 'jsmith', |
|
264 | :committer => 'jsmith', | |
257 | :committed_on => Time.now, |
|
265 | :committed_on => Time.now, | |
258 | :revision => 100, |
|
266 | :revision => 100, | |
259 | :comments => 'Committed by john.' |
|
267 | :comments => 'Committed by john.' | |
260 | ) |
|
268 | ) | |
261 | assert_equal User.find(2), c.user |
|
269 | assert_equal User.find(2), c.user | |
262 | end |
|
270 | end | |
263 |
|
271 | |||
264 | def test_auto_user_mapping_by_email |
|
272 | def test_auto_user_mapping_by_email | |
265 | c = Changeset.create!( |
|
273 | c = Changeset.create!( | |
266 | :repository => @repository, |
|
274 | :repository => @repository, | |
267 | :committer => 'john <jsmith@somenet.foo>', |
|
275 | :committer => 'john <jsmith@somenet.foo>', | |
268 | :committed_on => Time.now, |
|
276 | :committed_on => Time.now, | |
269 | :revision => 100, |
|
277 | :revision => 100, | |
270 | :comments => 'Committed by john.' |
|
278 | :comments => 'Committed by john.' | |
271 | ) |
|
279 | ) | |
272 | assert_equal User.find(2), c.user |
|
280 | assert_equal User.find(2), c.user | |
273 | end |
|
281 | end | |
274 |
|
282 | |||
275 | def test_filesystem_avaialbe |
|
283 | def test_filesystem_avaialbe | |
276 | klass = Repository::Filesystem |
|
284 | klass = Repository::Filesystem | |
277 | assert klass.scm_adapter_class |
|
285 | assert klass.scm_adapter_class | |
278 | assert_equal true, klass.scm_available |
|
286 | assert_equal true, klass.scm_available | |
279 | end |
|
287 | end | |
280 |
|
288 | |||
281 | def test_merge_extra_info |
|
289 | def test_merge_extra_info | |
282 | repo = Repository::Subversion.new(:project => Project.find(3)) |
|
290 | repo = Repository::Subversion.new(:project => Project.find(3)) | |
283 | assert !repo.save |
|
291 | assert !repo.save | |
284 | repo.url = "svn://localhost" |
|
292 | repo.url = "svn://localhost" | |
285 | assert repo.save |
|
293 | assert repo.save | |
286 | repo.reload |
|
294 | repo.reload | |
287 | project = Project.find(3) |
|
295 | project = Project.find(3) | |
288 | assert_equal repo, project.repository |
|
296 | assert_equal repo, project.repository | |
289 | assert_nil repo.extra_info |
|
297 | assert_nil repo.extra_info | |
290 | h1 = {"test_1" => {"test_11" => "test_value_11"}} |
|
298 | h1 = {"test_1" => {"test_11" => "test_value_11"}} | |
291 | repo.merge_extra_info(h1) |
|
299 | repo.merge_extra_info(h1) | |
292 | assert_equal h1, repo.extra_info |
|
300 | assert_equal h1, repo.extra_info | |
293 | h2 = {"test_2" => { |
|
301 | h2 = {"test_2" => { | |
294 | "test_21" => "test_value_21", |
|
302 | "test_21" => "test_value_21", | |
295 | "test_22" => "test_value_22", |
|
303 | "test_22" => "test_value_22", | |
296 | }} |
|
304 | }} | |
297 | repo.merge_extra_info(h2) |
|
305 | repo.merge_extra_info(h2) | |
298 | assert_equal (h = {"test_11" => "test_value_11"}), |
|
306 | assert_equal (h = {"test_11" => "test_value_11"}), | |
299 | repo.extra_info["test_1"] |
|
307 | repo.extra_info["test_1"] | |
300 | assert_equal "test_value_21", |
|
308 | assert_equal "test_value_21", | |
301 | repo.extra_info["test_2"]["test_21"] |
|
309 | repo.extra_info["test_2"]["test_21"] | |
302 | h3 = {"test_2" => { |
|
310 | h3 = {"test_2" => { | |
303 | "test_23" => "test_value_23", |
|
311 | "test_23" => "test_value_23", | |
304 | "test_24" => "test_value_24", |
|
312 | "test_24" => "test_value_24", | |
305 | }} |
|
313 | }} | |
306 | repo.merge_extra_info(h3) |
|
314 | repo.merge_extra_info(h3) | |
307 | assert_equal (h = {"test_11" => "test_value_11"}), |
|
315 | assert_equal (h = {"test_11" => "test_value_11"}), | |
308 | repo.extra_info["test_1"] |
|
316 | repo.extra_info["test_1"] | |
309 | assert_nil repo.extra_info["test_2"]["test_21"] |
|
317 | assert_nil repo.extra_info["test_2"]["test_21"] | |
310 | assert_equal "test_value_23", |
|
318 | assert_equal "test_value_23", | |
311 | repo.extra_info["test_2"]["test_23"] |
|
319 | repo.extra_info["test_2"]["test_23"] | |
312 | end |
|
320 | end | |
313 | end |
|
321 | end |
General Comments 0
You need to be logged in to leave comments.
Login now