comparison test/unit/changeset_test.rb @ 929:5f33065ddc4b redmine-1.3

Update to Redmine SVN rev 9414 on 1.3-stable branch
author Chris Cannam
date Wed, 27 Jun 2012 14:54:18 +0100
parents cbb26bc654de
children 433d4f72a19b
comparison
equal deleted inserted replaced
909:cbb26bc654de 929:5f33065ddc4b
176 assert c.save 176 assert c.save
177 assert_equal [5], c.issue_ids.sort 177 assert_equal [5], c.issue_ids.sort
178 assert c.issues.first.project != c.project 178 assert c.issues.first.project != c.project
179 end 179 end
180 180
181 def test_commit_closing_a_subproject_issue
182 with_settings :commit_fix_status_id => 5, :commit_fix_keywords => 'closes' do
183 issue = Issue.find(5)
184 assert !issue.closed?
185 assert_difference 'Journal.count' do
186 c = Changeset.new(:repository => Project.find(1).repository,
187 :committed_on => Time.now,
188 :comments => 'closes #5, a subproject issue',
189 :revision => '12345')
190 assert c.save
191 end
192 assert issue.reload.closed?
193 journal = Journal.first(:order => 'id DESC')
194 assert_equal issue, journal.issue
195 assert_include "Applied in changeset ecookbook:r12345.", journal.notes
196 end
197 end
198
181 def test_commit_referencing_a_parent_project_issue 199 def test_commit_referencing_a_parent_project_issue
182 # repository of child project 200 # repository of child project
183 r = Repository::Subversion.create!( 201 r = Repository::Subversion.create!(
184 :project => Project.find(3), 202 :project => Project.find(3),
185 :url => 'svn://localhost/test') 203 :url => 'svn://localhost/test')
195 def test_text_tag_revision 213 def test_text_tag_revision
196 c = Changeset.new(:revision => '520') 214 c = Changeset.new(:revision => '520')
197 assert_equal 'r520', c.text_tag 215 assert_equal 'r520', c.text_tag
198 end 216 end
199 217
218 def test_text_tag_revision_with_same_project
219 c = Changeset.new(:revision => '520', :repository => Project.find(1).repository)
220 assert_equal 'r520', c.text_tag(Project.find(1))
221 end
222
223 def test_text_tag_revision_with_different_project
224 c = Changeset.new(:revision => '520', :repository => Project.find(1).repository)
225 assert_equal 'ecookbook:r520', c.text_tag(Project.find(2))
226 end
227
200 def test_text_tag_hash 228 def test_text_tag_hash
201 c = Changeset.new( 229 c = Changeset.new(
202 :scmid => '7234cb2750b63f47bff735edc50a1c0a433c2518', 230 :scmid => '7234cb2750b63f47bff735edc50a1c0a433c2518',
203 :revision => '7234cb2750b63f47bff735edc50a1c0a433c2518') 231 :revision => '7234cb2750b63f47bff735edc50a1c0a433c2518')
204 assert_equal 'commit:7234cb2750b63f47bff735edc50a1c0a433c2518', c.text_tag 232 assert_equal 'commit:7234cb2750b63f47bff735edc50a1c0a433c2518', c.text_tag
233 end
234
235 def test_text_tag_hash_with_same_project
236 c = Changeset.new(:revision => '7234cb27', :scmid => '7234cb27', :repository => Project.find(1).repository)
237 assert_equal 'commit:7234cb27', c.text_tag(Project.find(1))
238 end
239
240 def test_text_tag_hash_with_different_project
241 c = Changeset.new(:revision => '7234cb27', :scmid => '7234cb27', :repository => Project.find(1).repository)
242 assert_equal 'ecookbook:commit:7234cb27', c.text_tag(Project.find(2))
205 end 243 end
206 244
207 def test_text_tag_hash_all_number 245 def test_text_tag_hash_all_number
208 c = Changeset.new(:scmid => '0123456789', :revision => '0123456789') 246 c = Changeset.new(:scmid => '0123456789', :revision => '0123456789')
209 assert_equal 'commit:0123456789', c.text_tag 247 assert_equal 'commit:0123456789', c.text_tag