Mercurial > hg > soundsoftware-site
comparison test/unit/helpers/.svn/text-base/application_helper_test.rb.svn-base @ 120:cd2282d2aa55 cannam
Merge from the default branch. Note that this is not a valid SVN repository any more (use default, redmine-1.1 etc for SVN updates).
author | Chris Cannam |
---|---|
date | Thu, 13 Jan 2011 14:33:08 +0000 |
parents | af80e5618e9b 8661b858af72 |
children | eeebe205a056 |
comparison
equal
deleted
inserted
replaced
118:b859cc0c4fa1 | 120:cd2282d2aa55 |
---|---|
145 # escaping | 145 # escaping |
146 '"test":http://foo"bar' => '<a href="http://foo"bar" class="external">test</a>', | 146 '"test":http://foo"bar' => '<a href="http://foo"bar" class="external">test</a>', |
147 } | 147 } |
148 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) } | 148 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) } |
149 end | 149 end |
150 | 150 |
151 def test_redmine_links | 151 def test_redmine_links |
152 issue_link = link_to('#3', {:controller => 'issues', :action => 'show', :id => 3}, | 152 issue_link = link_to('#3', {:controller => 'issues', :action => 'show', :id => 3}, |
153 :class => 'issue status-1 priority-1 overdue', :title => 'Error 281 when updating a recipe (New)') | 153 :class => 'issue status-1 priority-1 overdue', :title => 'Error 281 when updating a recipe (New)') |
154 | 154 |
155 changeset_link = link_to('r1', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 1}, | 155 changeset_link = link_to('r1', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 1}, |
222 "http://foo.bar/FAQ#3" => '<a class="external" href="http://foo.bar/FAQ#3">http://foo.bar/FAQ#3</a>', | 222 "http://foo.bar/FAQ#3" => '<a class="external" href="http://foo.bar/FAQ#3">http://foo.bar/FAQ#3</a>', |
223 } | 223 } |
224 @project = Project.find(1) | 224 @project = Project.find(1) |
225 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text), "#{text} failed" } | 225 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text), "#{text} failed" } |
226 end | 226 end |
227 | 227 |
228 def test_redmine_links_git_commit | |
229 changeset_link = link_to('abcd', | |
230 { | |
231 :controller => 'repositories', | |
232 :action => 'revision', | |
233 :id => 'subproject1', | |
234 :rev => 'abcd', | |
235 }, | |
236 :class => 'changeset', :title => 'test commit') | |
237 to_test = { | |
238 'commit:abcd' => changeset_link, | |
239 } | |
240 @project = Project.find(3) | |
241 r = Repository::Git.create!(:project => @project, :url => '/tmp/test/git') | |
242 assert r | |
243 c = Changeset.new(:repository => r, | |
244 :committed_on => Time.now, | |
245 :revision => 'abcd', | |
246 :scmid => 'abcd', | |
247 :comments => 'test commit') | |
248 assert( c.save ) | |
249 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) } | |
250 end | |
251 | |
252 # TODO: Bazaar commit id contains mail address, so it contains '@' and '_'. | |
253 def test_redmine_links_darcs_commit | |
254 changeset_link = link_to('20080308225258-98289-abcd456efg.gz', | |
255 { | |
256 :controller => 'repositories', | |
257 :action => 'revision', | |
258 :id => 'subproject1', | |
259 :rev => '123', | |
260 }, | |
261 :class => 'changeset', :title => 'test commit') | |
262 to_test = { | |
263 'commit:20080308225258-98289-abcd456efg.gz' => changeset_link, | |
264 } | |
265 @project = Project.find(3) | |
266 r = Repository::Darcs.create!(:project => @project, :url => '/tmp/test/darcs') | |
267 assert r | |
268 c = Changeset.new(:repository => r, | |
269 :committed_on => Time.now, | |
270 :revision => '123', | |
271 :scmid => '20080308225258-98289-abcd456efg.gz', | |
272 :comments => 'test commit') | |
273 assert( c.save ) | |
274 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) } | |
275 end | |
276 | |
277 def test_redmine_links_mercurial_commit | |
278 changeset_link_rev = link_to('r123', | |
279 { | |
280 :controller => 'repositories', | |
281 :action => 'revision', | |
282 :id => 'subproject1', | |
283 :rev => '123' , | |
284 }, | |
285 :class => 'changeset', :title => 'test commit') | |
286 changeset_link_commit = link_to('abcd', | |
287 { | |
288 :controller => 'repositories', | |
289 :action => 'revision', | |
290 :id => 'subproject1', | |
291 :rev => 'abcd' , | |
292 }, | |
293 :class => 'changeset', :title => 'test commit') | |
294 to_test = { | |
295 'r123' => changeset_link_rev, | |
296 'commit:abcd' => changeset_link_commit, | |
297 } | |
298 @project = Project.find(3) | |
299 r = Repository::Mercurial.create!(:project => @project, :url => '/tmp/test') | |
300 assert r | |
301 c = Changeset.new(:repository => r, | |
302 :committed_on => Time.now, | |
303 :revision => '123', | |
304 :scmid => 'abcd', | |
305 :comments => 'test commit') | |
306 assert( c.save ) | |
307 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) } | |
308 end | |
309 | |
228 def test_attachment_links | 310 def test_attachment_links |
229 attachment_link = link_to('error281.txt', {:controller => 'attachments', :action => 'download', :id => '1'}, :class => 'attachment') | 311 attachment_link = link_to('error281.txt', {:controller => 'attachments', :action => 'download', :id => '1'}, :class => 'attachment') |
230 to_test = { | 312 to_test = { |
231 'attachment:error281.txt' => attachment_link | 313 'attachment:error281.txt' => attachment_link |
232 } | 314 } |
608 Date.today + 20000 => 'Due in over 54 years', | 690 Date.today + 20000 => 'Due in over 54 years', |
609 Date.today - 1 => '1 day late', | 691 Date.today - 1 => '1 day late', |
610 Date.today - 100 => 'about 3 months late', | 692 Date.today - 100 => 'about 3 months late', |
611 Date.today - 20000 => 'over 54 years late', | 693 Date.today - 20000 => 'over 54 years late', |
612 } | 694 } |
695 ::I18n.locale = :en | |
613 to_test.each do |date, expected| | 696 to_test.each do |date, expected| |
614 assert_equal expected, due_date_distance_in_words(date) | 697 assert_equal expected, due_date_distance_in_words(date) |
615 end | 698 end |
616 end | 699 end |
617 | 700 |