motiro 0.6.8 → 0.6.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. data/AUTHORS +15 -0
  2. data/README +2 -2
  3. data/README.en +1 -2
  4. data/README.pt-br +1 -2
  5. data/app/controllers/account_controller.rb +1 -1
  6. data/app/controllers/application.rb +13 -12
  7. data/app/controllers/javascript_controller.rb +1 -1
  8. data/app/controllers/report_controller.rb +1 -1
  9. data/app/controllers/wiki_controller.rb +3 -5
  10. data/app/core/cache_reporter.rb +1 -1
  11. data/app/core/cache_reporter_fetcher.rb +1 -1
  12. data/app/core/chief_editor.rb +1 -1
  13. data/app/core/reporter.rb +1 -1
  14. data/app/core/reporter_driver.rb +1 -1
  15. data/app/core/reporter_fetcher.rb +1 -1
  16. data/app/core/settings.rb +1 -1
  17. data/app/core/version.rb +1 -1
  18. data/app/core/wiki_reporter.rb +1 -1
  19. data/app/helpers/application_helper.rb +5 -1
  20. data/app/helpers/default_page_provider.rb +6 -2
  21. data/app/helpers/report_helper.rb +14 -1
  22. data/app/models/change.rb +1 -1
  23. data/app/models/chunk.rb +1 -1
  24. data/app/models/feed_observer.rb +1 -1
  25. data/app/models/headline.rb +1 -1
  26. data/app/models/page.rb +38 -4
  27. data/app/models/revision.rb +1 -1
  28. data/app/models/user.rb +1 -1
  29. data/app/models/wiki_reference.rb +21 -0
  30. data/app/models/wiki_sweeper.rb +17 -2
  31. data/app/ports/chdir_runner.rb +1 -1
  32. data/app/ports/runner.rb +1 -1
  33. data/app/reporters/darcs_connection.rb +1 -1
  34. data/app/reporters/darcs_reporter.rb +1 -1
  35. data/app/reporters/darcs_temp_repo.rb +1 -1
  36. data/app/reporters/events_reporter.rb +1 -1
  37. data/app/reporters/features_reporter.rb +1 -1
  38. data/app/reporters/subversion_reporter.rb +1 -1
  39. data/app/reporters/svn_connection.rb +1 -1
  40. data/app/reporters/svn_settings.rb +1 -1
  41. data/app/views/report/list.rhtml +6 -7
  42. data/app/views/report/older.rhtml +1 -2
  43. data/app/views/report/rss.rxml +1 -1
  44. data/app/views/report/show.rhtml +2 -2
  45. data/app/views/wiki/_edit_event.rhtml +2 -0
  46. data/app/views/wiki/_edit_feature.rhtml +2 -0
  47. data/app/views/wiki/_properties_edit.rhtml +3 -5
  48. data/app/views/wiki/_properties_show.rhtml +4 -5
  49. data/app/views/wiki/_show_event.rhtml +3 -0
  50. data/app/views/wiki/_show_feature.rhtml +2 -0
  51. data/app/views/wiki/show.rhtml +1 -1
  52. data/bin/motiro +3 -3
  53. data/config/routes.rb +1 -1
  54. data/db/migrate/024_add_feature_status.rb +11 -0
  55. data/db/migrate/025_add_page_references.rb +12 -0
  56. data/db/migrate/026_convert_link_syntax.rb +12 -0
  57. data/db/migrate/027_register_page_references.rb +12 -0
  58. data/db/motirodb.sqlite.initial +0 -0
  59. data/db/schema_version +1 -1
  60. data/db/translation/pt-BR.rb +7 -1
  61. data/lib/array_extensions.rb +1 -1
  62. data/lib/diff_chunk_builder.rb +1 -1
  63. data/lib/differ.rb +1 -1
  64. data/lib/string_extensions.rb +13 -6
  65. data/lib/stub_hash.rb +1 -1
  66. data/lib/tasks/packaging.rake +10 -12
  67. data/lib/tasks/testing.rake +1 -1
  68. data/lib/tick_daemon.rb +1 -1
  69. data/lib/{wiki_url_generator.rb → wiki_link_handler.rb} +13 -3
  70. data/lib/wiki_renderer.rb +63 -34
  71. data/public/images/done.png +0 -0
  72. data/public/images/not-done.png +0 -0
  73. data/public/stylesheets/motiro.css +8 -0
  74. data/script/ticker +1 -1
  75. data/test/acceptance/account_test.rb +1 -1
  76. data/test/acceptance/darcs_test.rb +1 -1
  77. data/test/acceptance/events_test.rb +1 -1
  78. data/test/acceptance/main_page_test.rb +1 -1
  79. data/test/acceptance/subversion_test.rb +1 -1
  80. data/test/acceptance/ts_all_suites.rb +1 -1
  81. data/test/acceptance/wiki_test.rb +3 -3
  82. data/test/contract/darcs_test.rb +1 -1
  83. data/test/contract/remote_darcs_test.rb +1 -1
  84. data/test/contract/svn_test.rb +1 -1
  85. data/test/fixtures/pages.yml +20 -1
  86. data/test/fixtures/revisions.yml +40 -1
  87. data/test/fixtures/wiki_references.yml +5 -0
  88. data/test/functional/report_controller_test.rb +1 -1
  89. data/test/functional/report_features_test.rb +8 -1
  90. data/test/functional/report_subversion_test.rb +1 -1
  91. data/test/functional/root_controller_test.rb +1 -1
  92. data/test/functional/wiki_controller_test.rb +67 -2
  93. data/test/lib/acceptance_test_case.rb +1 -1
  94. data/test/lib/darcs_excerpts.rb +1 -1
  95. data/test/lib/darcs_repo.rb +1 -1
  96. data/test/lib/hash_extensions.rb +22 -0
  97. data/test/lib/live_mode_test.rb +1 -1
  98. data/test/lib/netutils.rb +1 -1
  99. data/test/lib/platform_thread.rb +1 -1
  100. data/test/lib/selenium_extensions.rb +1 -1
  101. data/test/lib/stubio.rb +1 -1
  102. data/test/lib/webserver.rb +1 -1
  103. data/test/meta/darcs_repo_test.rb +1 -1
  104. data/test/meta/local_svn_test.rb +1 -1
  105. data/test/meta/platform_thread_test.rb +1 -1
  106. data/test/meta/stubio_test.rb +1 -1
  107. data/test/stubs/{url_generator.rb → wiki_link_handler.rb} +8 -4
  108. data/test/test_helper.rb +3 -1
  109. data/test/unit/array_extensions_test.rb +1 -1
  110. data/test/unit/cache_reporter_fetcher_test.rb +1 -1
  111. data/test/unit/cache_reporter_test.rb +1 -1
  112. data/test/unit/change_test.rb +1 -1
  113. data/test/unit/chdir_runner_test.rb +1 -1
  114. data/test/unit/chief_editor_test.rb +1 -1
  115. data/test/unit/darcs_connection_test.rb +1 -1
  116. data/test/unit/darcs_reporter_test.rb +4 -4
  117. data/test/unit/darcs_temp_repo_test.rb +1 -1
  118. data/test/unit/default_page_provider_test.rb +23 -13
  119. data/test/unit/diff_chunk_builder_test.rb +1 -1
  120. data/test/unit/page_test.rb +67 -4
  121. data/test/unit/reporter_driver_test.rb +1 -1
  122. data/test/unit/reporter_test.rb +1 -1
  123. data/test/unit/revision_test.rb +1 -1
  124. data/test/unit/runner_test.rb +1 -1
  125. data/test/unit/string_extensions_test.rb +15 -3
  126. data/test/unit/svn_connection_test.rb +1 -1
  127. data/test/unit/svn_reporter_interaction_test.rb +1 -1
  128. data/test/unit/svn_reporter_test.rb +1 -1
  129. data/test/unit/svn_settings_test.rb +1 -1
  130. data/test/unit/user_test.rb +1 -1
  131. data/test/unit/{wiki_url_generator_test.rb → wiki_link_handler_test.rb} +3 -3
  132. data/test/unit/wiki_renderer_test.rb +75 -20
  133. data/test/unit/wiki_reporter_test.rb +1 -1
  134. data/vendor/mediacloth-trunk/MIT-LICENSE +20 -0
  135. data/vendor/mediacloth-trunk/README +32 -0
  136. data/vendor/mediacloth-trunk/Rakefile +33 -0
  137. data/vendor/mediacloth-trunk/lib/mediacloth/mediawikiast.rb +122 -0
  138. data/vendor/mediacloth-trunk/lib/mediacloth/mediawikihtmlgenerator.rb +252 -0
  139. data/vendor/mediacloth-trunk/lib/mediacloth/mediawikilexer.rb +821 -0
  140. data/vendor/mediacloth-trunk/lib/mediacloth/mediawikilinkhandler.rb +68 -0
  141. data/vendor/mediacloth-trunk/lib/mediacloth/mediawikiparams.rb +33 -0
  142. data/vendor/mediacloth-trunk/lib/mediacloth/mediawikiparser.rb +1218 -0
  143. data/vendor/mediacloth-trunk/lib/mediacloth/mediawikiparser.y +493 -0
  144. data/vendor/mediacloth-trunk/lib/mediacloth/mediawikiwalker.rb +146 -0
  145. data/vendor/mediacloth-trunk/lib/mediacloth.rb +29 -0
  146. data/vendor/mediacloth-trunk/mediacloth.gemspec +24 -0
  147. data/vendor/mediacloth-trunk/mediacloth.kdevelop +117 -0
  148. data/vendor/mediacloth-trunk/setup.rb +1585 -0
  149. data/vendor/mediacloth-trunk/test/data/html1 +26 -0
  150. data/vendor/mediacloth-trunk/test/data/html10 +130 -0
  151. data/vendor/mediacloth-trunk/test/data/html11 +17 -0
  152. data/vendor/mediacloth-trunk/test/data/html12 +12 -0
  153. data/vendor/mediacloth-trunk/test/data/html13 +11 -0
  154. data/vendor/mediacloth-trunk/test/data/html2 +2 -0
  155. data/vendor/mediacloth-trunk/test/data/html3 +1 -0
  156. data/vendor/mediacloth-trunk/test/data/html4 +47 -0
  157. data/vendor/mediacloth-trunk/test/data/html5 +57 -0
  158. data/vendor/mediacloth-trunk/test/data/html6 +8 -0
  159. data/vendor/mediacloth-trunk/test/data/html7 +45 -0
  160. data/vendor/mediacloth-trunk/test/data/html8 +1 -0
  161. data/vendor/mediacloth-trunk/test/data/html9 +14 -0
  162. data/vendor/mediacloth-trunk/test/data/input1 +34 -0
  163. data/vendor/mediacloth-trunk/test/data/input10 +124 -0
  164. data/vendor/mediacloth-trunk/test/data/input11 +17 -0
  165. data/vendor/mediacloth-trunk/test/data/input12 +15 -0
  166. data/vendor/mediacloth-trunk/test/data/input13 +10 -0
  167. data/vendor/mediacloth-trunk/test/data/input2 +2 -0
  168. data/vendor/mediacloth-trunk/test/data/input3 +2 -0
  169. data/vendor/mediacloth-trunk/test/data/input4 +50 -0
  170. data/vendor/mediacloth-trunk/test/data/input5 +63 -0
  171. data/vendor/mediacloth-trunk/test/data/input6 +8 -0
  172. data/vendor/mediacloth-trunk/test/data/input7 +45 -0
  173. data/vendor/mediacloth-trunk/test/data/input8 +1 -0
  174. data/vendor/mediacloth-trunk/test/data/input9 +14 -0
  175. data/vendor/mediacloth-trunk/test/data/lex1 +26 -0
  176. data/vendor/mediacloth-trunk/test/data/lex10 +85 -0
  177. data/vendor/mediacloth-trunk/test/data/lex11 +17 -0
  178. data/vendor/mediacloth-trunk/test/data/lex12 +15 -0
  179. data/vendor/mediacloth-trunk/test/data/lex13 +3 -0
  180. data/vendor/mediacloth-trunk/test/data/lex2 +2 -0
  181. data/vendor/mediacloth-trunk/test/data/lex3 +1 -0
  182. data/vendor/mediacloth-trunk/test/data/lex4 +47 -0
  183. data/vendor/mediacloth-trunk/test/data/lex5 +57 -0
  184. data/vendor/mediacloth-trunk/test/data/lex6 +8 -0
  185. data/vendor/mediacloth-trunk/test/data/lex7 +45 -0
  186. data/vendor/mediacloth-trunk/test/data/lex8 +1 -0
  187. data/vendor/mediacloth-trunk/test/data/lex9 +14 -0
  188. data/vendor/mediacloth-trunk/test/data/result1 +48 -0
  189. data/vendor/mediacloth-trunk/test/dataproducers/html.rb +18 -0
  190. data/vendor/mediacloth-trunk/test/dataproducers/lex.rb +15 -0
  191. data/vendor/mediacloth-trunk/test/debugwalker.rb +68 -0
  192. data/vendor/mediacloth-trunk/test/htmlgenerator.rb +97 -0
  193. data/vendor/mediacloth-trunk/test/lexer.rb +542 -0
  194. data/vendor/mediacloth-trunk/test/linkhandler.rb +39 -0
  195. data/vendor/mediacloth-trunk/test/parser.rb +22 -0
  196. data/vendor/mediacloth-trunk/test/testhelper.rb +27 -0
  197. data/vendor/mediacloth.rb +3 -0
  198. data/vendor/motiro-installer.rb +1 -1
  199. data/vendor/plugins/cache_test-0.2/CHANGELOG +14 -0
  200. data/vendor/plugins/cache_test-0.2/MIT-LICENSE +20 -0
  201. data/vendor/plugins/cache_test-0.2/README +124 -0
  202. data/vendor/plugins/cache_test-0.2/init.rb +8 -0
  203. data/vendor/plugins/cache_test-0.2/lib/fragment_cache_test.rb +205 -0
  204. data/vendor/plugins/cache_test-0.2/lib/page_cache_test.rb +140 -0
  205. data/vendor/plugins/global_routing/init.rb +1 -1
  206. metadata +517 -455
@@ -28,7 +28,7 @@ list_last_modified_features_page:
28
28
  id: 7
29
29
  kind: feature
30
30
  name: ListLastModifiedFeatures
31
- modified_at: 2033-12-27 16:47:00
31
+ modified_at: 2007-08-13 00:02:48
32
32
 
33
33
  provide_rss_feed_for_last_modified_pages_page:
34
34
  id: 8
@@ -61,3 +61,22 @@ multilanguage_page:
61
61
  name: MultiLanguagePage
62
62
  kind: feature
63
63
  modified_at: 2007-06-14 12:06:38
64
+
65
+ finished_feature:
66
+ id: 13
67
+ name: FinishedFeature
68
+ kind: feature
69
+ modified_at: 2007-09-02 10:31:16
70
+
71
+ refering_page:
72
+ id: 14
73
+ name: ReferingPage
74
+ kind: common
75
+ modified_at: 2008-01-22 05:10:24
76
+
77
+ dependent_feature:
78
+ id: 15
79
+ name: DependentFeature
80
+ kind: feature
81
+ modified_at: 2020-02-22 15:57:37
82
+
@@ -71,9 +71,11 @@ non_matching_title_page_creation:
71
71
  list_last_modified_features_page_creation:
72
72
  id: 9
73
73
  page_id: 7
74
+ position: 1
74
75
  kind: feature
75
76
  last_editor_id: 1000001
76
- modified_at: 2033-12-27 16:47:00
77
+ modified_at: 2007-08-13 00:02:48
78
+ done: f
77
79
  editors: ""
78
80
  title: List last modified features
79
81
  text: Motiro should list the last modified feature suggestion pages on the
@@ -182,3 +184,40 @@ second_page_edition:
182
184
  title: This page has been edited since creation
183
185
  text: Eric changed the text that John entered. Twice.
184
186
  position: 3
187
+
188
+ finished_feature_creation:
189
+ id: 18
190
+ page_id: 13
191
+ position: 1
192
+ kind: feature
193
+ modified_at: 2007-09-02 10:31:16
194
+ last_editor_id: 1000005
195
+ editors: ""
196
+ title: Finished feature
197
+ text: Do something!
198
+ done: t
199
+
200
+ refering_page_creation:
201
+ id: 19
202
+ page_id: 14
203
+ kind: common
204
+ modified_at: 2008-01-22 05:10:24
205
+ last_editor_id: 1000005 #eric
206
+ editors: ""
207
+ title: Refering page
208
+ text: This pages refers to the [[ListLastModifiedFeatures]] page
209
+ position: 1
210
+
211
+ dependent_feature_creation:
212
+ id: 20
213
+ page_id: 15
214
+ position: 1
215
+ kind: feature
216
+ last_editor_id: 1000001
217
+ modified_at: 2020-02-22 15:57:37
218
+ done: f
219
+ editors: ""
220
+ title: Dependent feature
221
+ text: This features requires the completion of [[ListLastModifiedFeatures]]
222
+ and [[FinishedFeature]]
223
+
@@ -0,0 +1,5 @@
1
+ refering_page_refers_to_list_modified_features:
2
+ id: 1
3
+ referer_id: 14
4
+ referee_id: 7
5
+
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -35,6 +35,13 @@ class ReportFeaturesTest < Test::Unit::TestCase
35
35
  get :list, :reporter => 'features', :locale => 'en', :format => 'xml'
36
36
  assert_xml_element "//link[text() = 'http://test.host/wiki/show/ListLastModifiedFeatures']"
37
37
  end
38
+
39
+ def test_feed_item_text_links_to_other_wiki_pages
40
+ get :list, :reporter => 'features', :locale => 'en', :format => 'xml'
41
+ assert_xml_element '//description['+
42
+ 'contains(text(),' +
43
+ "'&lt;a href=\"http://test.host/wiki/show/ListLastModifiedFeatures\"&gt;ListLastModifiedFeatures&lt;/a&gt;')]"
44
+ end
38
45
 
39
46
  def test_shows_title_for_second_language
40
47
  get :older, :reporter => 'features', :locale => 'pt-br'
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@ class RootControllerTest < Test::Unit::TestCase
17
17
  def test_version_number
18
18
  get :index, :locale => 'en'
19
19
 
20
- assert_tag :content => /Motiro version 0.6.8/
20
+ assert_tag :content => /Motiro version 0.6.9/
21
21
  end
22
22
 
23
23
 
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ class WikiControllerTest < Test::Unit::TestCase
26
26
 
27
27
  include TestConfiguration
28
28
 
29
- fixtures :users, :pages, :revisions
29
+ fixtures :users, :pages, :revisions, :wiki_references
30
30
 
31
31
  def setup
32
32
  @controller = WikiController.new
@@ -429,6 +429,71 @@ end
429
429
  assert_tag :a, :content => 'View rendered diff'
430
430
  assert_tag :a, :content => 'View revision 2'
431
431
  end
432
+
433
+ def test_allows_feature_status_update
434
+ ActionController::Base.perform_caching = false
435
+ page = pages('list_last_modified_features_page')
436
+ log_as :bob
437
+
438
+ get :show, :page_name => page.name
439
+ assert_tag :content => /This feature is not done/
440
+
441
+ get :edit, :page_name => page.name
442
+ assert_tag :content => /This feature is done/
443
+ assert_tag :input, :attributes => {:type => 'checkbox'}
444
+
445
+ post :save, :page_name => page.name,
446
+ :btnSave => true,
447
+ :page => { :title => 'List last modified features',
448
+ :text => 'We should really have this',
449
+ :done => '1',
450
+ :kind => 'feature', :editors => '' }
451
+ log_out
452
+
453
+ get :show, :page_name => page.name
454
+ assert_no_tag :content => /This feature is not done/
455
+ assert_tag :content => /This feature is done/
456
+ end
457
+
458
+ def test_expires_refering_pages_cache_when_finishing_feature
459
+ ActionController::Base.perform_caching = true
460
+ log_as :bob
461
+
462
+ refering_page = pages('refering_page')
463
+
464
+ assert_expire_fragments(:controller=> 'wiki', :action => 'show',
465
+ :page => refering_page.name,
466
+ :locale_suffix => 'en-us') do
467
+ post :save, :page_name => pages('list_last_modified_features_page').name,
468
+ :btnSave => true,
469
+ :page => { :title => 'List last modified features',
470
+ :text => 'We should really have this',
471
+ :done => '1',
472
+ :kind => 'feature', :editors => '' }
473
+ end
474
+ end
475
+
476
+ def test_does_not_expire_refering_pages_cache_after_editing_page_text_only
477
+ ActionController::Base.perform_caching = true
478
+ log_as :bob
479
+
480
+ begin
481
+ assert_expire_fragments(:controller=> 'wiki', :action => 'show',
482
+ :page => pages('refering_page').name,
483
+ :locale_suffix => 'en-us') do
484
+ post :save, :page_name => pages('list_last_modified_features_page').name,
485
+ :btnSave => true,
486
+ :page => { :title => 'List last modified features',
487
+ :text => 'We should really have this and that',
488
+ :done => '0',
489
+ :kind => 'feature', :editors => '' }
490
+ end
491
+ rescue Test::Unit::AssertionFailedError
492
+ return nil # error expected
493
+ end
494
+
495
+ assert false, "Refering page expired after text-only edition"
496
+ end
432
497
 
433
498
  private
434
499
 
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -0,0 +1,22 @@
1
+ # Motiro - A project tracking tool
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
+ #
4
+ # This program is free software; you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation; either version 2 of the License, or
7
+ # any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
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
16
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
+
18
+ class Hash
19
+ def to_att
20
+ entries.map { |k, v| "#{k.to_s}=\"#{v}\""}.join(' ')
21
+ end
22
+ end
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
data/test/lib/netutils.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
data/test/lib/stubio.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -15,10 +15,14 @@
15
15
  # along with this program; if not, write to the Free Software
16
16
  # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
- class TestingUrlGenerator
18
+ class TestingWikiLinkHandler < WikiLinkHandler
19
19
 
20
- def generate_url_for(page_name)
20
+ def initialize
21
+ super(nil)
22
+ end
23
+
24
+ def url_for(page_name)
21
25
  "http://test.host/wiki/show/#{page_name}"
22
26
  end
23
27
 
24
- end
28
+ end
data/test/test_helper.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -24,6 +24,8 @@ $:.push File.expand_path(File.dirname(__FILE__) + '/../app')
24
24
  require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
25
25
  require 'test_help'
26
26
 
27
+ require 'hash_extensions'
28
+
27
29
  require 'rubygems'
28
30
  require 'flexmock'
29
31
 
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -117,7 +117,7 @@ class DarcsReporterTest < Test::Unit::TestCase
117
117
 
118
118
  assert change.diff.match(/\A@@ -56,18 \+56,36 @@$/)
119
119
  assert change.diff.match(/^- public void widgetDefaultSelected\(SelectionEvent e\) \{\}\n\+ public void widgetDefaultSelected\(SelectionEvent e\) \{/)
120
- assert change.diff.match(/@Override\n\n\Z/)
120
+ assert change.diff.match(/@Override\n\n/)
121
121
  end
122
122
 
123
123
  def test_reads_more_resource_names_and_diffs
@@ -135,11 +135,11 @@ class DarcsReporterTest < Test::Unit::TestCase
135
135
 
136
136
  assert changes[0].diff.match(/\A@@ -1,3 \+1,14 @@$/)
137
137
  assert changes[0].diff.match(/^\+\tpublic void removeOutput\(Writer out\) \{$/)
138
- assert changes[0].diff.match(/^\+\n \}\n\Z/)
138
+ assert changes[0].diff.match(/^\+\n \}\n/)
139
139
 
140
140
  assert changes[1].diff.match(/@@ -76,6 \+76,17 @@/)
141
141
  assert changes[1].diff.match(/^\+\t\tmultiplexer.addOutput\(output\);/)
142
- assert changes[1].diff.match(/Writer multiplexer = new MultiplexedWriter\(outputs\);\n\n\Z/)
142
+ assert changes[1].diff.match(/Writer multiplexer = new MultiplexedWriter\(outputs\);\n\n/)
143
143
 
144
144
  end
145
145
 
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -19,19 +19,29 @@ require File.dirname(__FILE__) + '/../test_helper'
19
19
 
20
20
  class DefaultPageProviderTest < Test::Unit::TestCase
21
21
 
22
- def setup
23
- @provider = DefaultPageProvider.new
24
- end
25
-
26
- def test_provides_congratulations_page_for_main_page
27
- page_text = @provider.find_by_name('MainPage').text
28
- assert page_text.match(/Congratulations/)
22
+ def test_delegates_retrieval_to_decorated_provider
23
+ FlexMock.use('provider') do |provider|
24
+ provider.should_receive(:find_by_name).
25
+ with('MainPage').
26
+ returns(:page).
27
+ once
28
+
29
+ assert_equal :page,
30
+ DefaultPageProvider.new(provider).find_by_name('MainPage')
31
+ end
29
32
  end
30
33
 
31
- def test_provides_you_can_edit_this_page_for_random_pages
32
- page_text = @provider.find_by_name('AnyPage').text
33
- assert page_text.match(/nothing to be read here/)
34
- assert page_text.match(/But you can write something right now/)
34
+ def test_provides_an_empty_page_when_decorated_provider_cant_find_one
35
+ FlexMock.use('provider') do |provider|
36
+ provider.should_receive(:find_by_name).
37
+ with('RandomPage').
38
+ returns(nil).
39
+ once
40
+
41
+ page = DefaultPageProvider.new(provider).find_by_name('RandomPage')
42
+ assert page.text.match(/nothing to be read here/)
43
+ assert page.text.match(/But you can write something right now/)
44
+ end
35
45
  end
36
46
 
37
- end
47
+ end
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -20,6 +20,10 @@ require File.dirname(__FILE__) + '/../test_helper'
20
20
  class PageTest < Test::Unit::TestCase
21
21
  fixtures :pages, :revisions, :users
22
22
 
23
+ def teardown
24
+ WikiReference.delete_all
25
+ end
26
+
23
27
  def test_is_open_to_all
24
28
  attrs = { :text => 'Page text' }
25
29
  assert !revise_named_page(attrs.merge(:editors => 'john')).is_open_to_all?
@@ -80,11 +84,11 @@ class PageTest < Test::Unit::TestCase
80
84
  end
81
85
 
82
86
  def test_resolves_clashing_page_names
83
- fst_page = revise_brand_new_page(:title => 'My first Motiro page', :text => '')
87
+ fst_page = revise_brand_new_page(:title => 'My first Motiro page', :text => 'aaa')
84
88
  assert_equal 'MyFirstMotiroPage', fst_page.name
85
89
  fst_page.save
86
90
 
87
- snd_page = revise_brand_new_page(:title => 'My first Motiro page', :text => '')
91
+ snd_page = revise_brand_new_page(:title => 'My first Motiro page', :text => 'aaa')
88
92
  assert_equal 'MyFirstMotiroPage2', snd_page.name
89
93
  snd_page.save
90
94
 
@@ -243,6 +247,15 @@ class PageTest < Test::Unit::TestCase
243
247
  assert_equal old_time, event.revisions.first.happens_at
244
248
  end
245
249
 
250
+ def test_stores_feature_status_revisions
251
+ feature = pages('list_last_modified_features_page')
252
+ feature.revise(bob, now, :done => 1)
253
+
254
+ assert feature.done?
255
+ assert feature.revisions.last.done?
256
+ assert !feature.revisions.first.done?
257
+ end
258
+
246
259
  def test_rbab
247
260
  date = Date.new(2007, 4, 4)
248
261
  page = revise_brand_new_page(:kind => 'event',
@@ -322,7 +335,57 @@ class PageTest < Test::Unit::TestCase
322
335
  assert_equal DEFAULT_AUTHOR, headline.author
323
336
  assert_equal DEFAULT_TIME, headline.happened_at
324
337
  end
325
-
338
+
339
+ def test_records_wiki_references
340
+ page = revise_brand_new_page(:title => 'Usual page',
341
+ :kind => 'common',
342
+ :text => "This is page has a link to the\n" +
343
+ "[[MainPage|main page]] and to\n" +
344
+ "the [[TestPage|test page]]")
345
+ assert_equal 2, page.references.size
346
+ assert_equal 2, page.refered_pages.size
347
+
348
+ main_page, test_page = pages('main_page'), pages('test_page')
349
+
350
+ assert_equal page, page.references.first.referer
351
+ assert_equal main_page, page.references.first.referee
352
+ assert_equal test_page, page.refered_pages.last
353
+ assert_equal page, main_page.referrals.first.referer
354
+ assert_equal page, test_page.refering_pages.first
355
+ end
356
+
357
+ def test_rebuilds_references_with_new_revision
358
+ main_page, test_page = pages('main_page'), pages('test_page')
359
+ page = revise_brand_new_page(:title => 'Usual page',
360
+ :kind => 'common',
361
+ :text => "Here is a [[MainPage|reference]]")
362
+
363
+ assert_equal 1, page.refered_pages.size
364
+ assert_equal 1, main_page.refering_pages.size
365
+
366
+ page.revise(bob, now, :text => "Here is another [[TestPage|reference]]")
367
+ main_page = Page.find_by_name('MainPage')
368
+
369
+ assert_equal 1, page.refered_pages.size
370
+ assert_equal 0, main_page.refering_pages.size
371
+ assert_equal 1, test_page.refering_pages.size
372
+ assert_equal test_page, page.references.first.referee
373
+ assert_equal test_page, page.refered_pages.first
374
+ end
375
+
376
+ def test_referencing_an_empty_page_creates_it
377
+ page = revise_brand_new_page(:title => 'Referencing page',
378
+ :kind => 'common',
379
+ :text => "You should go [[ReferedPage|there]]")
380
+
381
+ refered_page = Page.find_by_name('ReferedPage')
382
+
383
+ assert_not_nil refered_page
384
+ assert_equal 1, refered_page.referrals.size
385
+ assert_equal page, refered_page.refering_pages.first
386
+ assert_equal WIKI_NOT_FOUND_TEXT, refered_page.text
387
+ end
388
+
326
389
  private
327
390
 
328
391
  def create_page_with_one_revision