motiro 0.6.3

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 (309) hide show
  1. data/LICENSE +280 -0
  2. data/README +28 -0
  3. data/README.en +175 -0
  4. data/README.pt-br +175 -0
  5. data/Rakefile +10 -0
  6. data/app/controllers/account_controller.rb +62 -0
  7. data/app/controllers/application.rb +72 -0
  8. data/app/controllers/edition_controller.rb +13 -0
  9. data/app/controllers/javascript_controller.rb +21 -0
  10. data/app/controllers/report_controller.rb +79 -0
  11. data/app/controllers/root_controller.rb +7 -0
  12. data/app/controllers/wiki_controller.rb +102 -0
  13. data/app/core/cache_reporter.rb +53 -0
  14. data/app/core/cache_reporter_fetcher.rb +33 -0
  15. data/app/core/chief_editor.rb +69 -0
  16. data/app/core/reporter.rb +105 -0
  17. data/app/core/reporter_driver.rb +36 -0
  18. data/app/core/reporter_fetcher.rb +39 -0
  19. data/app/core/settings.rb +43 -0
  20. data/app/core/version.rb +1 -0
  21. data/app/core/wiki_page_not_found.rb +33 -0
  22. data/app/core/wiki_reporter.rb +83 -0
  23. data/app/helpers/account_helper.rb +2 -0
  24. data/app/helpers/application_helper.rb +68 -0
  25. data/app/helpers/default_page_provider.rb +28 -0
  26. data/app/helpers/report_helper.rb +2 -0
  27. data/app/helpers/root_helper.rb +2 -0
  28. data/app/helpers/wiki_helper.rb +3 -0
  29. data/app/models/change.rb +96 -0
  30. data/app/models/diff_table_builder.rb +285 -0
  31. data/app/models/event.rb +18 -0
  32. data/app/models/headline.rb +109 -0
  33. data/app/models/page.rb +114 -0
  34. data/app/models/page_sweeper.rb +26 -0
  35. data/app/models/user.rb +85 -0
  36. data/app/ports/chdir_runner.rb +36 -0
  37. data/app/ports/reporter_loader.rb +9 -0
  38. data/app/ports/runner.rb +64 -0
  39. data/app/reporters/darcs_connection.rb +54 -0
  40. data/app/reporters/darcs_reporter.rb +104 -0
  41. data/app/reporters/darcs_settings.rb +9 -0
  42. data/app/reporters/darcs_temp_repo.rb +40 -0
  43. data/app/reporters/events_reporter.rb +28 -0
  44. data/app/reporters/features_reporter.rb +24 -0
  45. data/app/reporters/subversion_reporter.rb +203 -0
  46. data/app/reporters/svn_connection.rb +62 -0
  47. data/app/reporters/svn_settings.rb +40 -0
  48. data/app/views/account/_authorization.rhtml +54 -0
  49. data/app/views/account/_availability.rhtml +5 -0
  50. data/app/views/account/availability.rhtml +1 -0
  51. data/app/views/account/login.rhtml +22 -0
  52. data/app/views/account/logout.rhtml +10 -0
  53. data/app/views/javascript/motiro.rjs +132 -0
  54. data/app/views/javascript/niftycube.rjs +300 -0
  55. data/app/views/layouts/_bottom.rhtml +5 -0
  56. data/app/views/layouts/_header.rhtml +7 -0
  57. data/app/views/layouts/_top.rhtml +25 -0
  58. data/app/views/layouts/application.rhtml +3 -0
  59. data/app/views/layouts/scaffold.rhtml +13 -0
  60. data/app/views/layouts/wiki_edit.rhtml +26 -0
  61. data/app/views/report/list.rhtml +32 -0
  62. data/app/views/report/older.rhtml +26 -0
  63. data/app/views/report/rss.rxml +29 -0
  64. data/app/views/report/show.rhtml +20 -0
  65. data/app/views/root/index.rhtml +33 -0
  66. data/app/views/wiki/_editbar.rhtml +26 -0
  67. data/app/views/wiki/_properties_edit.rhtml +5 -0
  68. data/app/views/wiki/_properties_show.rhtml +5 -0
  69. data/app/views/wiki/edit.rhtml +56 -0
  70. data/app/views/wiki/properties_edit.rhtml +1 -0
  71. data/app/views/wiki/show.rhtml +9 -0
  72. data/bin/motiro +44 -0
  73. data/config/boot.rb +19 -0
  74. data/config/database.yml +14 -0
  75. data/config/environment.rb +64 -0
  76. data/config/environments/development.rb +20 -0
  77. data/config/environments/production.rb +19 -0
  78. data/config/environments/test.rb +19 -0
  79. data/config/motiro.yml +43 -0
  80. data/config/routes.rb +79 -0
  81. data/db/migrate/005_globalize_migration.rb +11363 -0
  82. data/db/migrate/006_remove_headline_title.rb +14 -0
  83. data/db/migrate/007_stretch_rid.rb +11 -0
  84. data/db/migrate/008_add_page_editors.rb +12 -0
  85. data/db/migrate/009_add_page_original_author.rb +12 -0
  86. data/db/migrate/010_remove_empty_string_defaults_from_pages.rb +17 -0
  87. data/db/migrate/011_add_title_and_kind_to_pages.rb +13 -0
  88. data/db/migrate/012_page_modification_info.rb +13 -0
  89. data/db/migrate/013_nullify_initial_page_attributes.rb +21 -0
  90. data/db/migrate/014_events_are_wiki_pages.rb +13 -0
  91. data/db/migrate/015_migrate_previous_event_data.rb +23 -0
  92. data/db/migrate/1_initial_structure.rb +36 -0
  93. data/db/migrate/2_add_authentication.rb +12 -0
  94. data/db/migrate/3_drop_articles.rb +26 -0
  95. data/db/migrate/4_add_page_editing.rb +14 -0
  96. data/db/motirodb.sqlite.initial +0 -0
  97. data/db/schema_version +1 -0
  98. data/db/translation/pt-BR.rb +76 -0
  99. data/doc/README_FOR_APP +2 -0
  100. data/installer/rails_installer_defaults.yml +5 -0
  101. data/lib/import_translations.rb +154 -0
  102. data/lib/login_system.rb +89 -0
  103. data/lib/relative_time.rb +48 -0
  104. data/lib/string_extensions.rb +10 -0
  105. data/lib/stub_hash.rb +22 -0
  106. data/lib/tasks/packaging.rake +93 -0
  107. data/lib/tasks/testing.rake +32 -0
  108. data/lib/tick_daemon.rb +41 -0
  109. data/lib/translator.rb +67 -0
  110. data/lib/wiki_renderer.rb +42 -0
  111. data/lib/wiki_url_generator.rb +29 -0
  112. data/log/.keepdir +0 -0
  113. data/public/404.html +8 -0
  114. data/public/500.html +8 -0
  115. data/public/dispatch.cgi +10 -0
  116. data/public/dispatch.fcgi +24 -0
  117. data/public/dispatch.rb +10 -0
  118. data/public/favicon.ico +0 -0
  119. data/public/images/calendar.png +0 -0
  120. data/public/images/rss.png +0 -0
  121. data/public/javascripts/controls.js +750 -0
  122. data/public/javascripts/dragdrop.js +584 -0
  123. data/public/javascripts/effects.js +854 -0
  124. data/public/javascripts/prototype.js +1785 -0
  125. data/public/robots.txt +1 -0
  126. data/public/stylesheets/motiro.css +269 -0
  127. data/public/stylesheets/niftyCorners.css +35 -0
  128. data/public/stylesheets/scaffold.css +74 -0
  129. data/script/about +3 -0
  130. data/script/breakpointer +3 -0
  131. data/script/console +3 -0
  132. data/script/destroy +3 -0
  133. data/script/generate +3 -0
  134. data/script/performance/benchmarker +3 -0
  135. data/script/performance/profiler +3 -0
  136. data/script/plugin +3 -0
  137. data/script/process/reaper +3 -0
  138. data/script/process/spawner +3 -0
  139. data/script/process/spinner +3 -0
  140. data/script/runner +3 -0
  141. data/script/server +3 -0
  142. data/script/ticker +29 -0
  143. data/test/acceptance/account_test.rb +186 -0
  144. data/test/acceptance/darcs_test.rb +62 -0
  145. data/test/acceptance/events_test.rb +47 -0
  146. data/test/acceptance/main_page_test.rb +92 -0
  147. data/test/acceptance/subversion_test.rb +319 -0
  148. data/test/acceptance/ts_all_suites.rb +27 -0
  149. data/test/acceptance/wiki_test.rb +202 -0
  150. data/test/contract/darcs_test.rb +51 -0
  151. data/test/contract/remote_darcs_test.rb +61 -0
  152. data/test/contract/svn_test.rb +53 -0
  153. data/test/fixtures/changes.yml +25 -0
  154. data/test/fixtures/headlines.yml +45 -0
  155. data/test/fixtures/pages.yml +98 -0
  156. data/test/fixtures/users.yml +31 -0
  157. data/test/functional/account_controller_test.rb +96 -0
  158. data/test/functional/report_controller_test.rb +113 -0
  159. data/test/functional/report_features_test.rb +38 -0
  160. data/test/functional/report_subversion_test.rb +79 -0
  161. data/test/functional/root_controller_test.rb +127 -0
  162. data/test/functional/wiki_controller_test.rb +280 -0
  163. data/test/lib/acceptance_test_case.rb +43 -0
  164. data/test/lib/configuration.rb +53 -0
  165. data/test/lib/darcs_excerpts.rb +181 -0
  166. data/test/lib/darcs_repo.rb +77 -0
  167. data/test/lib/live_mode_test.rb +51 -0
  168. data/test/lib/local_svn.rb +157 -0
  169. data/test/lib/netutils.rb +42 -0
  170. data/test/lib/platform_thread.rb +62 -0
  171. data/test/lib/repoutils.rb +23 -0
  172. data/test/lib/selenium_extensions.rb +32 -0
  173. data/test/lib/stubio.rb +37 -0
  174. data/test/lib/svn_excerpts.rb +288 -0
  175. data/test/lib/test_configuration.rb +14 -0
  176. data/test/lib/webserver.rb +71 -0
  177. data/test/meta/configuration_test.rb +72 -0
  178. data/test/meta/darcs_repo_test.rb +118 -0
  179. data/test/meta/local_svn_test.rb +125 -0
  180. data/test/meta/platform_thread_test.rb +46 -0
  181. data/test/meta/stubio_test.rb +44 -0
  182. data/test/mocks/headline.rb +34 -0
  183. data/test/mocks/svn_reporter.rb +29 -0
  184. data/test/stubs/svn_settings.rb +19 -0
  185. data/test/stubs/url_generator.rb +24 -0
  186. data/test/test_helper.rb +36 -0
  187. data/test/unit/cache_reporter_fetcher_test.rb +46 -0
  188. data/test/unit/cache_reporter_test.rb +97 -0
  189. data/test/unit/caching_test.rb +78 -0
  190. data/test/unit/change_test.rb +152 -0
  191. data/test/unit/chdir_runner_test.rb +77 -0
  192. data/test/unit/chief_editor_test.rb +234 -0
  193. data/test/unit/darcs_connection_test.rb +109 -0
  194. data/test/unit/darcs_reporter_test.rb +146 -0
  195. data/test/unit/darcs_settings_test.rb +37 -0
  196. data/test/unit/darcs_temp_repo_test.rb +51 -0
  197. data/test/unit/default_page_provider_test.rb +46 -0
  198. data/test/unit/diff_table_builder_test.rb +602 -0
  199. data/test/unit/headline_test.rb +259 -0
  200. data/test/unit/page_test.rb +145 -0
  201. data/test/unit/relative_time_test.rb +56 -0
  202. data/test/unit/reporter_driver_test.rb +85 -0
  203. data/test/unit/reporter_fetcher_test.rb +31 -0
  204. data/test/unit/reporter_test.rb +81 -0
  205. data/test/unit/runner_test.rb +93 -0
  206. data/test/unit/settings_test.rb +55 -0
  207. data/test/unit/string_extensions_test.rb +10 -0
  208. data/test/unit/svn_connection_test.rb +183 -0
  209. data/test/unit/svn_reporter_interaction_test.rb +38 -0
  210. data/test/unit/svn_reporter_test.rb +286 -0
  211. data/test/unit/svn_settings_test.rb +86 -0
  212. data/test/unit/translator_test.rb +96 -0
  213. data/test/unit/user_test.rb +125 -0
  214. data/test/unit/wiki_renderer_test.rb +87 -0
  215. data/test/unit/wiki_reporter_test.rb +94 -0
  216. data/test/unit/wiki_url_generator_test.rb +31 -0
  217. data/vendor/motiro-installer.rb +159 -0
  218. data/vendor/plugins/globalize/LICENSE +9 -0
  219. data/vendor/plugins/globalize/README +49 -0
  220. data/vendor/plugins/globalize/data/country_data.csv +240 -0
  221. data/vendor/plugins/globalize/data/language_data.csv +188 -0
  222. data/vendor/plugins/globalize/data/translation_data.csv +3421 -0
  223. data/vendor/plugins/globalize/generators/globalize/USAGE +10 -0
  224. data/vendor/plugins/globalize/generators/globalize/globalize_generator.rb +42 -0
  225. data/vendor/plugins/globalize/generators/globalize/templates/migration.rb.gz +0 -0
  226. data/vendor/plugins/globalize/generators/globalize/templates/tiny_migration.rb.gz +0 -0
  227. data/vendor/plugins/globalize/init.rb +30 -0
  228. data/vendor/plugins/globalize/lib/globalize/localization/core_ext.rb +170 -0
  229. data/vendor/plugins/globalize/lib/globalize/localization/core_ext_hooks.rb +33 -0
  230. data/vendor/plugins/globalize/lib/globalize/localization/db_translate.rb +494 -0
  231. data/vendor/plugins/globalize/lib/globalize/localization/db_view_translator.rb +152 -0
  232. data/vendor/plugins/globalize/lib/globalize/localization/locale.rb +173 -0
  233. data/vendor/plugins/globalize/lib/globalize/localization/rfc_3066.rb +40 -0
  234. data/vendor/plugins/globalize/lib/globalize/models/country.rb +24 -0
  235. data/vendor/plugins/globalize/lib/globalize/models/currency.rb +188 -0
  236. data/vendor/plugins/globalize/lib/globalize/models/language.rb +84 -0
  237. data/vendor/plugins/globalize/lib/globalize/models/model_translation.rb +4 -0
  238. data/vendor/plugins/globalize/lib/globalize/models/translation.rb +9 -0
  239. data/vendor/plugins/globalize/lib/globalize/models/view_translation.rb +14 -0
  240. data/vendor/plugins/globalize/lib/globalize/rails/action_mailer.rb +125 -0
  241. data/vendor/plugins/globalize/lib/globalize/rails/action_view.rb +79 -0
  242. data/vendor/plugins/globalize/lib/globalize/rails/active_record.rb +129 -0
  243. data/vendor/plugins/globalize/lib/globalize/rails/active_record_helper.rb +33 -0
  244. data/vendor/plugins/globalize/populators/pop_dates.rb +81 -0
  245. data/vendor/plugins/globalize/populators/pop_migration.rb +18 -0
  246. data/vendor/plugins/globalize/populators/pop_pluralization.rb +26 -0
  247. data/vendor/plugins/globalize/populators/pop_seps.rb +32 -0
  248. data/vendor/plugins/globalize/tasks/data.rake +130 -0
  249. data/vendor/plugins/globalize/test/action_mailer_test/globalize_mailer/test.en-US.plain.text.rhtml +1 -0
  250. data/vendor/plugins/globalize/test/action_mailer_test/globalize_mailer/test.en.plain.text.rhtml +1 -0
  251. data/vendor/plugins/globalize/test/action_mailer_test/globalize_mailer/test.he.plain.text.rhtml +1 -0
  252. data/vendor/plugins/globalize/test/action_mailer_test/globalize_mailer/test.plain.text.rhtml +1 -0
  253. data/vendor/plugins/globalize/test/action_mailer_test.rb +54 -0
  254. data/vendor/plugins/globalize/test/config/database.yml.default +16 -0
  255. data/vendor/plugins/globalize/test/config/database.yml.example +22 -0
  256. data/vendor/plugins/globalize/test/core_ext_test.rb +61 -0
  257. data/vendor/plugins/globalize/test/currency_test.rb +141 -0
  258. data/vendor/plugins/globalize/test/date_helper_test.rb +634 -0
  259. data/vendor/plugins/globalize/test/db/schema.rb +90 -0
  260. data/vendor/plugins/globalize/test/db_translation_test.rb +374 -0
  261. data/vendor/plugins/globalize/test/fixtures/globalize_categories.yml +7 -0
  262. data/vendor/plugins/globalize/test/fixtures/globalize_categories_products.yml +7 -0
  263. data/vendor/plugins/globalize/test/fixtures/globalize_countries.yml +41 -0
  264. data/vendor/plugins/globalize/test/fixtures/globalize_languages.yml +64 -0
  265. data/vendor/plugins/globalize/test/fixtures/globalize_manufacturers.yml +5 -0
  266. data/vendor/plugins/globalize/test/fixtures/globalize_products.yml +29 -0
  267. data/vendor/plugins/globalize/test/fixtures/globalize_simples.yml +5 -0
  268. data/vendor/plugins/globalize/test/fixtures/globalize_translations.yml +354 -0
  269. data/vendor/plugins/globalize/test/locale_test.rb +27 -0
  270. data/vendor/plugins/globalize/test/mime_responds_test.rb +358 -0
  271. data/vendor/plugins/globalize/test/model_test.rb +17 -0
  272. data/vendor/plugins/globalize/test/standard_data_test_helper.rb +33 -0
  273. data/vendor/plugins/globalize/test/test_helper.rb +19 -0
  274. data/vendor/plugins/globalize/test/test_standard_data.rb +54 -0
  275. data/vendor/plugins/globalize/test/validation_test.rb +29 -0
  276. data/vendor/plugins/globalize/test/view_picking_test.rb +49 -0
  277. data/vendor/plugins/globalize/test/view_translation_test.rb +237 -0
  278. data/vendor/plugins/globalize/test/views/layouts/standard.rhtml +1 -0
  279. data/vendor/plugins/globalize/test/views/respond_to/all_types_with_layout.rhtml +1 -0
  280. data/vendor/plugins/globalize/test/views/respond_to/all_types_with_layout.rjs +1 -0
  281. data/vendor/plugins/globalize/test/views/respond_to/using_defaults.en.rhtml +1 -0
  282. data/vendor/plugins/globalize/test/views/respond_to/using_defaults.en.rjs +1 -0
  283. data/vendor/plugins/globalize/test/views/respond_to/using_defaults.en.rxml +1 -0
  284. data/vendor/plugins/globalize/test/views/respond_to/using_defaults.fr.rhtml +1 -0
  285. data/vendor/plugins/globalize/test/views/respond_to/using_defaults.fr.rjs +1 -0
  286. data/vendor/plugins/globalize/test/views/respond_to/using_defaults.fr.rxml +1 -0
  287. data/vendor/plugins/globalize/test/views/respond_to/using_defaults.rhtml +1 -0
  288. data/vendor/plugins/globalize/test/views/respond_to/using_defaults.rjs +1 -0
  289. data/vendor/plugins/globalize/test/views/respond_to/using_defaults.rxml +1 -0
  290. data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.en.rhtml +1 -0
  291. data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.en.rjs +1 -0
  292. data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.en.rxml +1 -0
  293. data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.fr.rhtml +1 -0
  294. data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.fr.rjs +1 -0
  295. data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.fr.rxml +1 -0
  296. data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.rhtml +1 -0
  297. data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.rjs +1 -0
  298. data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.rxml +1 -0
  299. data/vendor/plugins/globalize/test/views/test.he-IL.rhtml +1 -0
  300. data/vendor/plugins/globalize/test/views/test.rhtml +1 -0
  301. data/vendor/plugins/globalize/test/views/test2.he.rhtml +1 -0
  302. data/vendor/plugins/globalize/test/views/test2.rhtml +1 -0
  303. data/vendor/plugins/test_xml/MIT-LICENSE +20 -0
  304. data/vendor/plugins/test_xml/README +20 -0
  305. data/vendor/plugins/test_xml/Rakefile +22 -0
  306. data/vendor/plugins/test_xml/init.rb +7 -0
  307. data/vendor/plugins/test_xml/lib/xml_assertions.rb +22 -0
  308. data/vendor/plugins/test_xml/test/test_xml_test.rb +40 -0
  309. metadata +505 -0
@@ -0,0 +1,202 @@
1
+ # Motiro - A project tracking tool
2
+ # Copyright (C) 2006-2007 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 WikiAcceptanceTest < AcceptanceTestCase
19
+
20
+ fixtures :users, :pages
21
+
22
+ def test_edit_main_page
23
+ log_as(:bob)
24
+
25
+ click "//a[text() = 'Edit']"
26
+ wait_for_page_to_load(1000)
27
+
28
+ type 'txaEditor', "= Motiro =\n\nThis is project motiro."
29
+ click 'btnSave'
30
+
31
+ wait_for_page_to_load(1000)
32
+
33
+ assert_element_present "//h1[text() = 'Motiro']"
34
+ assert_text_present 'This is project motiro'
35
+ end
36
+
37
+ def test_translates_edition_page
38
+ log_as(:bob)
39
+
40
+ click "//a[text() = 'Edit']"
41
+ wait_for_page_to_load(1500)
42
+
43
+ assert_equal 'Save modifications', get_attribute('btnSave@value')
44
+ assert_equal 'Discard', get_attribute('btnDiscard@value')
45
+
46
+ assert_text_present 'Quick reference'
47
+ assert_text_present 'Title: = Title ='
48
+ assert_text_present 'Link: [address label]'
49
+
50
+ click "pt-BR"
51
+ wait_for_page_to_load(1500)
52
+
53
+ assert /Salvar modifica/ =~ get_attribute('btnSave@value')
54
+ assert_equal 'Descartar', get_attribute('btnDiscard@value')
55
+
56
+ assert_text_present 'Refer'
57
+ assert_text_present 'ncia r'
58
+ assert_text_present 'tulo'
59
+ assert_text_present 'Link'
60
+ assert_text_present '[endere'
61
+ assert_text_present 'o r'
62
+ assert_text_present 'tulo]'
63
+ end
64
+
65
+ def test_does_not_save_modifications_when_discard_button_pressed
66
+ log_as(:bob)
67
+
68
+ click "//a[text() = 'Edit']"
69
+ wait_for_page_to_load(1500)
70
+
71
+ type 'txaEditor', "= This title does not show =\n\n" +
72
+ "Neither does this text"
73
+
74
+ click 'btnDiscard'
75
+ wait_for_page_to_load(1500)
76
+
77
+ assert_location 'exact:http://localhost:3000/'
78
+
79
+ assert_text_not_present 'This title does not show'
80
+ end
81
+
82
+ def test_blocks_edition_for_unauthorized_users
83
+ log_as(:bob)
84
+
85
+ open '/wiki/edit/TestPage'
86
+
87
+ type 'txaEditor', 'Original Text'
88
+ type 'txtAuthorized', 'bob eric'
89
+ click 'btnSave'
90
+ wait_for_page_to_load(1500)
91
+
92
+ log_out
93
+ log_as(:john)
94
+
95
+ open '/wiki/show/TestPage'
96
+ assert_text_present 'Edit (not authorized)'
97
+
98
+ open '/wiki/edit/TestPage'
99
+ assert get_text("//span[@class = 'marked']").match(/\(not authorized\)/)
100
+ end
101
+
102
+ def test_original_author_can_change_authorization_list
103
+ log_as(:bob)
104
+
105
+ open '/wiki/edit/' + pages('bob_and_erics_page').name
106
+
107
+ type 'txtAuthorized', 'bob eric john'
108
+ click 'btnSave'
109
+ wait_for_page_to_load(1500)
110
+
111
+ log_out
112
+ log_as(:john)
113
+
114
+ open '/wiki/edit/' + pages('bob_and_erics_page').name
115
+ assert_element_present 'txaEditor'
116
+ end
117
+
118
+ def test_only_original_author_can_change_authorization_list
119
+ log_as(:eric)
120
+ wait_for_page_to_load(1500)
121
+
122
+ open '/wiki/edit/' + pages('bob_and_erics_page').name
123
+ assert_element_present 'txaEditor'
124
+ assert_element_not_present 'txtAuthorized'
125
+ end
126
+
127
+ def test_records_original_author_for_pages_without_author
128
+ log_as(:bob)
129
+
130
+ edition_page = '/wiki/edit/' + pages('nobodys_page').name
131
+ open edition_page
132
+
133
+ assert_element_present 'txtAuthorized'
134
+
135
+ type 'txaEditor', 'New edited text for Nobody\'s Page'
136
+ click 'btnSave'
137
+ wait_for_page_to_load(1500)
138
+
139
+ log_out
140
+ log_as(:john)
141
+
142
+ open edition_page
143
+
144
+ assert_element_not_present 'txtAuthorized'
145
+ end
146
+
147
+ def test_describing_feature_adds_to_main_page_channel
148
+ log_as(:bob)
149
+
150
+ feature_title = 'Tagging wiki pages as feature suggestions'
151
+
152
+ open '/wiki/new/feature'
153
+
154
+ type 'txtTitle', feature_title
155
+ type 'txaEditor', 'Maybe being able to tag some wiki pages as feature suggestions will be a good idea'
156
+
157
+ click 'btnSave'
158
+ wait_for_page_to_load(2000)
159
+
160
+ open '/en'
161
+
162
+ assert_text_present feature_title
163
+ end
164
+
165
+ def test_links_to_recently_changed_features_on_main_page
166
+ open '/en'
167
+
168
+ list_page = pages('list_last_modified_features_page')
169
+ assert_element_present "//a[text() = '#{list_page.title}']"
170
+ click "//a[text() = '#{list_page.title}']"
171
+ wait_for_page_to_load(2000)
172
+
173
+ assert_text_present list_page.title
174
+ assert_text_present list_page.text
175
+ end
176
+
177
+ def test_new_events_page_shows_fields_for_date
178
+ log_as(:bob)
179
+
180
+ open '/wiki/new/event/en'
181
+
182
+ assert_text_present 'This event is planned for'
183
+ assert_element_present "//select/option[text() = 'February']"
184
+ end
185
+
186
+ def test_wiki_new_page_loads_events_extra_fields_asynchronously
187
+ log_as(:bob)
188
+
189
+ open '/wiki/new'
190
+
191
+ select 'cmbType', 'value=event'
192
+ wait_for_not_visible 'loading'
193
+ assert_element_present "//select/option[text() = '2007']"
194
+ assert_editable "//input[@id = 'btnSave']"
195
+ assert_editable "//input[@id = 'btnDiscard']"
196
+
197
+ select 'cmbType', 'value=common'
198
+ wait_for_not_visible 'loading'
199
+ assert_element_not_present "//select/option[text() = '2007']"
200
+ end
201
+
202
+ end
@@ -0,0 +1,51 @@
1
+ # Motiro - A project tracking tool
2
+ # Copyright (C) 2006-2007 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
+ $:.push File.expand_path(File.dirname(__FILE__) + '/../lib')
19
+
20
+ require 'darcs_repo'
21
+
22
+ require 'rexml/document'
23
+ require 'test/unit'
24
+
25
+ # What we expect from the `darcs' command line client
26
+ class LocalDarcsTest < Test::Unit::TestCase
27
+
28
+ def setup
29
+ @repo = DarcsRepository.new(:file)
30
+ end
31
+
32
+ def test_unified_diff
33
+ @repo.add_file('my_file.txt', 'file contents')
34
+ @repo.record('adds a file')
35
+
36
+ previous = Dir.pwd
37
+ Dir.chdir(@repo.url)
38
+ output = `darcs changes --xml`
39
+ hash = REXML::Document.new(output).root.elements['patch'].attributes['hash']
40
+
41
+ output = `darcs diff -u --match="hash #{hash}"`
42
+ Dir.chdir(previous)
43
+ assert output.match(/^diff/)
44
+ assert output.match(/^--- old/)
45
+ end
46
+
47
+ def teardown
48
+ @repo.destroy
49
+ end
50
+
51
+ end
@@ -0,0 +1,61 @@
1
+ # Motiro - A project tracking tool
2
+ # Copyright (C) 2006-2007 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
+ require 'rubygems'
19
+ require 'fileutils'
20
+
21
+ $:.push File.expand_path(File.dirname(__FILE__) + '/../lib')
22
+ $:.push File.expand_path(File.dirname(__FILE__) + '/../../app')
23
+ $:.push File.expand_path(File.dirname(__FILE__) + '/../../vendor')
24
+
25
+ require 'repoutils'
26
+ require 'darcs_repo'
27
+ require 'reporters/darcs_temp_repo'
28
+
29
+ require 'test/unit'
30
+
31
+ # What we expect from the `darcs' command line client
32
+ class RemoteDarcsTest < Test::Unit::TestCase
33
+
34
+ include RepoUtils
35
+
36
+ def setup
37
+ @repo = DarcsRepository.new
38
+ @tmp = find_root_dir('ldarcs')
39
+ @previous_dir = Dir.pwd
40
+ FileUtils.mkdir_p(@tmp)
41
+ Dir.chdir(@tmp)
42
+ `darcs init`
43
+ Dir.chdir(@previous_dir)
44
+ end
45
+
46
+ def test_pulling
47
+ @repo.add_file('my_file.txt', 'file contents')
48
+ @repo.record('adds a file')
49
+
50
+ Dir.chdir(@tmp)
51
+ `darcs pull -a #{@repo.url}`
52
+ assert `darcs changes`.match(/adds a file/)
53
+ end
54
+
55
+ def teardown
56
+ Dir.chdir(@previous_dir)
57
+ FileUtils.rm_rf(@tmp)
58
+ @repo.destroy
59
+ end
60
+
61
+ end
@@ -0,0 +1,53 @@
1
+ # Motiro - A project tracking tool
2
+ # Copyright (C) 2006-2007 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
+ require 'rubygems'
19
+
20
+ require 'platform'
21
+ require 'open4'
22
+ require 'popen4'
23
+
24
+ $:.push File.expand_path(File.dirname(__FILE__) + '/../lib')
25
+
26
+ require File.dirname(__FILE__) + '/../lib/webserver'
27
+
28
+ SERVER = WebServer.create_https_server
29
+
30
+ require 'test/unit'
31
+
32
+ # What we expect from the `svn' command line client
33
+ class SubversionTest < Test::Unit::TestCase
34
+
35
+ def test_accept_certificate_temporarily
36
+ ENV['LC_MESSAGES'] = 'C'
37
+ POpen4.popen4("svn log https://localhost:#{SERVER[:Port]}") do |_, err, sin|
38
+ sin.puts 't'
39
+ sin.close
40
+
41
+ 9.times do
42
+ err.gets
43
+ end
44
+
45
+ assert err.read(30) =~ /\(t\)/
46
+ end
47
+ end
48
+
49
+ def teardown
50
+ SERVER.shutdown
51
+ end
52
+
53
+ end
@@ -0,0 +1,25 @@
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+
3
+ svn_demo_add_trunk_change:
4
+ id: 1
5
+ headline_id: 3
6
+ summary: A /trunk
7
+ resource_kind: dir
8
+
9
+ svn_demo_add_branches_change:
10
+ id: 2
11
+ headline_id: 3
12
+ summary: A /branches
13
+ resource_kind: dir
14
+
15
+ svn_demo_add_tags_change:
16
+ id: 3
17
+ headline_id: 3
18
+ summary: A /tags
19
+ resource_kind: dir
20
+
21
+ dia_em_que_a_terra_parou_change:
22
+ id: 5
23
+ headline_id: 2
24
+ summary: M /trunk/my_small_file.txt
25
+ resource_kind: file
@@ -0,0 +1,45 @@
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+
3
+ gita:
4
+ id: 1
5
+ author: raulseixas
6
+ description: gita
7
+ happened_at: 2005-01-01 00:00:00
8
+ reported_by: subversion
9
+ rid: r12
10
+
11
+ dia_em_que_a_terra_parou:
12
+ id: 2
13
+ author: raulseixas
14
+ description: o dia em que a terra parou
15
+ happened_at: 2036-02-01 00:00:00
16
+ reported_by: subversion
17
+ rid: r16
18
+
19
+ svn_demo_headline:
20
+ id: 3
21
+ author: james
22
+ happened_at: 2006-03-23 11:10:04
23
+ reported_by: subversion
24
+ rid: r32
25
+ description: This is a subversion revision comment
26
+
27
+ The comment is a multiline comment that indicates the purpose
28
+ of the revision.
29
+
30
+ darcs_headline:
31
+ id: 4
32
+ author: bond
33
+ happened_at: 2007-01-19 17:24:45
34
+ reported_by: darcs
35
+ rid: 20070119172445-eac51-b3b78543778f54f5c691121ab4a8dc3179dc81e4
36
+ description: Modified a file
37
+
38
+ meeting_event:
39
+ id: 5
40
+ author: motiro_maintainer
41
+ description: Planning meeting
42
+ happened_at: 2006-04-04
43
+ reported_by: events
44
+ rid: e2
45
+
@@ -0,0 +1,98 @@
1
+ main_page:
2
+ id: 1
3
+ name: MainPage
4
+ original_author_id: 1000001
5
+ editors: ""
6
+ text: = Motiro =
7
+
8
+ This is project motiro
9
+
10
+ johns_page:
11
+ id: 2
12
+ original_author_id: 1000004
13
+ name: John_s
14
+ editors: john
15
+ text: This is John's page
16
+
17
+ bob_and_erics_page:
18
+ id: 3
19
+ name: Bob_and_Eric_s
20
+ original_author_id: 1000001 #bob
21
+ editors: bob eric
22
+ text: This is Bob and Eric's page
23
+
24
+ nobodys_page:
25
+ id: 4
26
+ name: Unclaimed
27
+ original_author_id:
28
+ editors: ""
29
+ text: This page was created before the wiki access control was in place
30
+
31
+ test_page:
32
+ id: 5
33
+ name: TestPage
34
+ kind: common
35
+ original_author_id: 1000001
36
+ editors: ""
37
+ title:
38
+ text: This is the page text
39
+
40
+ non_matching_title_page:
41
+ id: 6
42
+ name: NonMatchingTitlePage
43
+ kind: common
44
+ original_author_id: 1000001
45
+ editors: ""
46
+ title: The title does not match the name
47
+ text: This is the page text
48
+
49
+ list_last_modified_features_page:
50
+ id: 7
51
+ name: ListLastModifiedFeatures
52
+ kind: feature
53
+ original_author_id: 1000001
54
+ modified_at: 2033-12-27 16:47:00
55
+ last_editor_id: 1000001
56
+ editors: ""
57
+ title: List last modified features
58
+ text: Motiro should list the last modified feature suggestion pages on the
59
+ main page
60
+
61
+ provide_rss_feed_for_last_modified_pages_page:
62
+ id: 8
63
+ name: ProvideRSSFeedForLastModifiedPages
64
+ kind: feature
65
+ original_author_id: 1000001
66
+ modified_at: 2033-12-27 12:33:48
67
+ last_editor_id: 1000004
68
+ editors: ""
69
+ title: Provide RSS feed for last modified pages
70
+ text: There could be an RSS feed for the last modified pages
71
+
72
+ events_are_just_special_pages_too_page:
73
+ id: 9
74
+ name: EventsAreJustSpecialWikiPagesToo
75
+ kind: feature
76
+ original_author_id: 1000001
77
+ modified_at: 2033-12-25 18:43:31
78
+ last_editor_id: 1000005
79
+ editors: ""
80
+ title: Events are just special wiki pages too
81
+ text: Event descriptions can be treated just like other regular wiki pages,
82
+ in the same way that feature suggestion pages are
83
+
84
+ release_event:
85
+ id: 10
86
+ name: FourteenthRelease
87
+ kind: event
88
+ type: Event
89
+ original_author_id: 1000004 #john
90
+ modified_at: 2007-01-18 13:28:47
91
+ last_editor_id: 1000004 #john
92
+ editors: ""
93
+ happens_at: 2007-01-24
94
+ title: Fourteenth release
95
+ text: The 0.6.1 release will be a bug fixing one and will introduce editable
96
+ event pages. This is included as part of the everything is a wiki page
97
+ motto.
98
+
@@ -0,0 +1,31 @@
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+
3
+ # These fixtures are encoded using 'motiro' as salt. Please remember to keep
4
+ # consistency.
5
+
6
+ # For most cases just using User.sha1 to encode the passwords will do
7
+
8
+ bob:
9
+ id: 1000001
10
+ login: bob
11
+ password: b8ccc7b7f539f5ed5b557990935848e5a637d209 # test
12
+
13
+ john:
14
+ id: 1000004
15
+ login: john
16
+ password: 6b9094cf1f9d7d2b517c88116c757ed30180a55b #lennon
17
+
18
+ eric:
19
+ id: 1000005
20
+ login: eric
21
+ password: ba43ae2dac98d836fce3a55d42b5931fa0644631 # clapton
22
+
23
+ existingbob:
24
+ id: 1000002
25
+ login: existingbob
26
+ password: b8ccc7b7f539f5ed5b557990935848e5a637d209 # test
27
+
28
+ longbob:
29
+ id: 1000003
30
+ login: longbob
31
+ password: 54669dd88f2b12b0c65f19ecabde765d3e8c5e5a # longtest
@@ -0,0 +1,96 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+ require 'account_controller'
3
+
4
+ # Raise errors beyond the default web-based presentation
5
+ class AccountController; def rescue_action(e) raise e end; end
6
+
7
+ class AccountControllerTest < Test::Unit::TestCase
8
+
9
+ self.use_instantiated_fixtures = true
10
+
11
+ fixtures :users
12
+
13
+ def setup
14
+ @controller = AccountController.new
15
+ @request, @response = ActionController::TestRequest.new, ActionController::TestResponse.new
16
+ @request.host = "localhost"
17
+ end
18
+
19
+ def test_auth_bob
20
+ @request.session[:return_to] = "/bogus/location"
21
+
22
+ login_as 'bob', 'test'
23
+ assert(@response.has_session_object?(:user))
24
+
25
+ assert_equal @bob, @response.session[:user]
26
+
27
+ assert_redirected_to "/bogus/location"
28
+ end
29
+
30
+ def test_redirects_to_last_page
31
+ login_as 'bob', 'test', :return_to => '/my/previous/location'
32
+
33
+ assert_equal @bob, @response.session[:user]
34
+ assert_redirected_to '/my/previous/location'
35
+ end
36
+
37
+ def test_no_signup
38
+ begin
39
+ get :signup
40
+ fail 'Should not respond to signup'
41
+ rescue
42
+ # should happen
43
+ end
44
+ end
45
+
46
+ def test_invalid_login
47
+ login_as 'bob', 'not_correct'
48
+
49
+ assert(!@response.has_session_object?(:user))
50
+ end
51
+
52
+ def test_login_logoff
53
+ login_as 'bob', 'test'
54
+ assert_not_nil session[:user]
55
+
56
+ get :logout
57
+ assert(!@response.has_session_object?(:user))
58
+ end
59
+
60
+ def test_signup_and_login
61
+ signup_as 'paul', 'mccartney'
62
+ assert_not_nil session[:user]
63
+
64
+ get :logout
65
+ assert(!@response.has_session_object?(:user))
66
+
67
+ login_as 'paul', 'mccartney'
68
+ assert_not_nil session[:user]
69
+ end
70
+
71
+ def test_do_not_allow_signing_up_with_already_used_username
72
+ signup_as 'bob', 'dylan'
73
+ assert_nil session[:user]
74
+ end
75
+
76
+ def test_check_for_availability
77
+ post :availability, :desired_login => 'bob'
78
+ assert assigns(:login_not_available)
79
+
80
+ post :availability, :desired_login => 'paul'
81
+ assert !assigns(:login_not_available)
82
+ end
83
+
84
+ private
85
+
86
+ def login_as(login, password, opts={})
87
+ post :login, opts.update(:user => {:login => login, :password => password})
88
+ end
89
+
90
+ def signup_as(username, password)
91
+ post :signup, :user => { :login => username, :password => password,
92
+ :password_confirmation => password },
93
+ :return_to => '/'
94
+ end
95
+
96
+ end