motiro 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
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,62 @@
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 'live_mode_test'
19
+ require 'darcs_repo'
20
+
21
+ class DarcsAcceptanceTest < SeleniumTestCase
22
+
23
+ include LiveModeTestCase
24
+
25
+ def create_repository; DarcsRepository.new; end
26
+ def repo_type; 'darcs'; end
27
+
28
+ def test_shows_comment_title_and_author_on_front_page
29
+ patch_name = 'Created first project file'
30
+
31
+ @repo.add_file('fileA.txt', 'this is file A')
32
+ @repo.record(patch_name)
33
+
34
+ open '/'
35
+
36
+ assert_text_present patch_name
37
+ assert_text_present @repo.author.match(/@/).pre_match
38
+ end
39
+
40
+ def test_shows_full_text_on_details_page
41
+ patch_title = 'This is the patch title'
42
+ patch_text = patch_title + "\n\n" +
43
+ "This is a short description of some problems faced when " +
44
+ "making this patch and some pointers for future investigation"
45
+
46
+ @repo.add_file('fileB.txt', 'this is file B')
47
+ @repo.record(patch_text)
48
+
49
+ open '/'
50
+
51
+ assert_text_present patch_title
52
+ assert_text_not_present 'This is a short description'
53
+
54
+ click "//a[text() = '#{patch_title}']"
55
+ wait_for_page_to_load(2000)
56
+
57
+ assert_equal "Revision details - #{patch_title} (Motiro)", get_title
58
+ assert_text_present 'This is a short description of some problems faced'
59
+ assert_text_present 'for future investigation'
60
+ end
61
+
62
+ end
@@ -0,0 +1,47 @@
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 'live_mode_test'
19
+
20
+ class EventsAcceptanceTest < AcceptanceTestCase
21
+
22
+ fixtures :users, :headlines
23
+
24
+ def test_no_error_on_development_mode
25
+ open '/report/events?locale=en'
26
+ assert_text_present 'Scheduled events'
27
+ end
28
+
29
+ def test_event_addition_disabled_without_authentication
30
+ open('/en')
31
+ assert_element_present "//span[@class = 'disabled' and text() = 'Add']"
32
+ end
33
+
34
+ def test_edition_enabled_when_authenticated
35
+ #TODO refactor this to a declarative style
36
+ #see http://www.testing.com/cgi-bin/blog/2005/12/19
37
+ log_as(:bob)
38
+
39
+ assert_element_present "//div[@id='events']//a[text() = 'Add']"
40
+
41
+ click "//div[@id='events']//a[text() = 'Add']"
42
+ wait_for_page_to_load(1500)
43
+
44
+ assert_element_present "//select/option[text() = '2007']"
45
+ end
46
+
47
+ end
@@ -0,0 +1,92 @@
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 MainPageAcceptanceTest < SeleniumTestCase
19
+
20
+ fixtures :pages
21
+
22
+ def test_report_html
23
+ open '/report/subversion?locale=en'
24
+ assert_text_present 'Latest news from Subversion'
25
+ assert_element_present "//a[@href = '/feed/subversion/en']/img[starts-with(@src, '/images/rss.png')]"
26
+ end
27
+
28
+ def test_subversion_on_main
29
+ open('/en')
30
+ assert_element_present "//div[@id = 'subversion']"
31
+ assert get_text("//div[@id = 'subversion']").match(/Latest news from Subversion/)
32
+ end
33
+
34
+ def test_events_on_main
35
+ open('/en')
36
+ assert_element_present "//div[@id = 'events']"
37
+ assert get_text("//div[@id = 'events']").match(/Scheduled events/)
38
+ end
39
+
40
+ def test_planned_features_on_main
41
+ open('/en')
42
+ assert_element_present "//div[@id = 'nextrelease']"
43
+ assert get_text("//div[@id = 'nextrelease']").match(/Planned features/)
44
+ end
45
+
46
+ def test_shows_installation_sucessful_page_with_absent_main_page
47
+ Page.delete_all("name = 'MainPage'")
48
+
49
+ open('/en')
50
+ assert_text_present 'Congratulations! Motiro was installed correctly'
51
+ end
52
+
53
+ def test_switches_languages_when_not_logged_in
54
+ Page.delete_all("name = 'MainPage'")
55
+
56
+ open('/')
57
+ click "//a[@id='pt-BR']"
58
+ wait_for_page_to_load(1000)
59
+
60
+ assert_equal "Motiro: Bem-vindo", get_title
61
+ assert_text_present 'Usu' # TODO Usuário
62
+ assert_text_present 'Senha'
63
+ assert_text_present 'instalou o Motiro corretamente'
64
+ assert_text_present 'Editar (identifique-se, por favor)'
65
+ assert_text_present 'Eventos agendados'
66
+ assert_text_present 'ltimas not' # TODO Últimas notícias do Subversion
67
+ assert_text_present 'cias do Subversion'
68
+ assert_text_present 'Antigas'
69
+ assert_text_present 'Funcionalidades planejadas'
70
+
71
+ click "//a[@id='en']"
72
+ wait_for_page_to_load(1000)
73
+
74
+ assert_equal "Motiro: Welcome", get_title
75
+ assert_text_present 'User'
76
+ assert_text_present 'Password'
77
+ assert_text_present 'Congratulations! Motiro was installed correctly'
78
+ assert_text_present 'Edit (requires authentication)'
79
+ assert_text_present 'Scheduled events'
80
+ assert_text_present 'Latest news from Subversion'
81
+ assert_text_present 'Older'
82
+ assert_text_present 'Planned features'
83
+ end
84
+
85
+ def test_do_not_display_breadcrumbs_on_main_page
86
+ open('/')
87
+
88
+ assert_text_not_present 'You are here'
89
+ assert_text_not_present 'Home'
90
+ end
91
+
92
+ end
@@ -0,0 +1,319 @@
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 'live_mode_test'
19
+
20
+ class SubversionAcceptanceTest < SeleniumTestCase
21
+
22
+ include LiveModeTestCase
23
+
24
+ def test_short_headline
25
+ commit_msg = 'Created my project'
26
+
27
+ @repo.mkdir('myproject', commit_msg)
28
+
29
+ open '/report/subversion?locale=en'
30
+ assert_text_present @repo.username
31
+ assert_text_present commit_msg
32
+ end
33
+
34
+ def test_show_subversion_on_main_page_when_in_development_mode
35
+ commit_msg = 'Created another project'
36
+
37
+ @repo.mkdir('myproject', commit_msg)
38
+
39
+ open '/en'
40
+ assert_text_present 'Latest news from Subversion'
41
+ assert_text_present commit_msg
42
+ end
43
+
44
+ def test_records_revision_description
45
+ commit_title = 'I have created the project dir'
46
+ commit_msg = "#{commit_title}\n" +
47
+ "\n" +
48
+ "This project dir will hold everything needed to build and\n" +
49
+ "deploy our project from source code"
50
+ dir_name = 'myproject'
51
+
52
+ @repo.mkdir(dir_name, commit_msg)
53
+
54
+ open '/report/subversion?locale=en'
55
+ assert_text_present commit_title
56
+ click "//a[text() = \"#{commit_title}\"]"
57
+ wait_for_page_to_load(2000)
58
+
59
+ assert_equal "Revision details - #{commit_title} (Motiro)", get_title
60
+ assert_element_present "//h1[text() = 'Revision r1']"
61
+ assert_text_present commit_title
62
+ assert_text_present 'This project dir will hold everything needed to build and'
63
+ assert_text_present 'deploy our project from source code'
64
+
65
+ assert_element_present "//div[@id='summary']"
66
+ assert_text_present "A /#{dir_name}"
67
+ end
68
+
69
+ def test_shows_diff_output_when_adding_file
70
+ commit_title = 'I have added a file'
71
+ filename = 'a_file.txt'
72
+ file_contents = "These are the file contents"
73
+ diff_output = "@@ -0,0 +1 @@\n" +
74
+ "+#{file_contents}\n"
75
+
76
+ @repo.add_file(filename, file_contents)
77
+ @repo.commit(commit_title)
78
+
79
+ open '/report/subversion?locale=en'
80
+ click "//a[text() = '#{commit_title}']"
81
+ wait_for_page_to_load(2000)
82
+
83
+ assert_element_present "//a[text()='A /#{filename}']"
84
+ assert_element_present "//h2[text()='Changes to a_file.txt']"
85
+ assert_text_present file_contents
86
+ end
87
+
88
+ def test_shows_diff_output_when_modifying_file
89
+ test_shows_diff_output_when_adding_file
90
+ diff_output = "@@ -1 +1 @@\n" +
91
+ "-These are the file contents\n" +
92
+ "+These are the modified file contents\n"
93
+
94
+ commit_title = 'I have modified a file'
95
+ @repo.put_file('a_file.txt', "These are the modified file contents\n" )
96
+ @repo.commit(commit_title)
97
+
98
+ open '/report/subversion'
99
+ click "//a[text() = '#{commit_title}']"
100
+ wait_for_page_to_load(1500)
101
+
102
+ assert_text_present 'These are the file contents'
103
+ assert_text_present 'These are the modified file contents'
104
+ end
105
+
106
+ def test_showing_invalid_rid_shows_nice_error_message
107
+ commit_msg = 'Creating the project root'
108
+
109
+ @repo.mkdir('projectroot', commit_msg)
110
+
111
+ open '/report/subversion/r104?locale=en'
112
+ assert_equal "Motiro: Welcome", get_title
113
+ assert_text "//div[@id='notice']", 'The article r104 from the Subversion reporter could not be found'
114
+ end
115
+
116
+ def test_do_not_show_diff_section_when_adding_directories
117
+ commit_title = 'Creating the project trunk'
118
+
119
+ @repo.mkdir('trunk', commit_title)
120
+
121
+ open '/report/subversion?locale=en'
122
+ click "//a[text() = '#{commit_title}']"
123
+ wait_for_page_to_load(1000)
124
+
125
+ assert_element_not_present "//a[text() = 'A /trunk']"
126
+ assert_text_not_present "Changes to trunk"
127
+
128
+ end
129
+
130
+ # TODO what should be the behaviour when removing files?
131
+ # TODO on recorded mode, when something bad happens (like a connection
132
+ # timeout) during headline retrieval, the headlines are carved in
133
+ # stone that way and can't be fixed
134
+
135
+ def test_copy_file
136
+ @repo.add_file('file_number_one.txt', "the content here will be copied to file_number_two\n")
137
+ @repo.commit('added first file')
138
+
139
+ commit_title = 'files copied'
140
+ @repo.copy('file_number_one.txt', 'file_number_two.txt', commit_title)
141
+
142
+ open '/report/subversion?locale=en'
143
+ click "//a[text() = '#{commit_title}']"
144
+ wait_for_page_to_load(2000)
145
+ assert_text_present "Changes to file_number_two.txt"
146
+ assert_text_present "the content here will be copied to file_number_two"
147
+ end
148
+
149
+ def test_move_file
150
+ @repo.add_file('file_number_one.txt', "this file will be renamed to file_number_two\n")
151
+ @repo.commit('added first file')
152
+
153
+ commit_title = 'renamed file'
154
+ @repo.move('file_number_one.txt', 'file_number_two.txt', commit_title)
155
+
156
+ open '/report/subversion?locale=en'
157
+ click "//a[text() = '#{commit_title}']"
158
+ wait_for_page_to_load(2000)
159
+
160
+ assert_text_present "Changes to file_number_one.txt"
161
+ assert_text_present "this file will be renamed to file_number_two"
162
+ assert_text_present "Changes to file_number_two.txt"
163
+ assert_text_present "this file will be renamed to file_number_two"
164
+ end
165
+
166
+ def test_shows_only_one_diff_when_selected
167
+ @repo.add_file('file_one.txt', 'son, she said, have I got a little story for you')
168
+ @repo.add_file('file_two.txt', 'what you thought was your daddy was nothing but a...')
169
+
170
+ commit_title = 'added two files'
171
+ @repo.commit(commit_title)
172
+
173
+ open '/report/subversion'
174
+ click "//a[text() = '#{commit_title}']"
175
+ wait_for_page_to_load(1000)
176
+
177
+ click "//a[contains(text(), 'A /file_one.txt')]"
178
+
179
+ #TODO using IDs is a little counter-intuitive, maybe we could try text()
180
+ assert_visible "//div[@id='change17300898']"
181
+ assert_not_visible "//div[@id='change462869942']"
182
+
183
+ click "//a[contains(text(), 'A /file_two.txt')]"
184
+ assert_visible "//div[@id='change462869942']"
185
+ assert_not_visible "//div[@id='change17300898']"
186
+ end
187
+
188
+ def test_shows_diff_only_when_clicked
189
+ @repo.add_file('alive.txt', 'son, she said, have I got a little story for you')
190
+
191
+ commit_title = 'added alive.txt'
192
+ @repo.commit(commit_title)
193
+
194
+ open '/report/subversion'
195
+ click "//a[text() = '#{commit_title}']"
196
+ wait_for_page_to_load(1000)
197
+
198
+ assert_not_visible "//div[@id='changes']"
199
+ assert_not_visible "//div[@id='change-374147303']"
200
+
201
+ click "//a[contains(text(), 'A /alive.txt')]"
202
+
203
+ assert_visible "//div[@id='change-374147303']"
204
+ end
205
+
206
+ def test_translates_page_for_valid_revision_id
207
+ @repo.add_file('daughter.txt', 'alone, listless, breakfast table and an otherwise empty room')
208
+
209
+ commit_title = 'added daughter.txt'
210
+ @repo.commit(commit_title)
211
+
212
+ open '/report/subversion/r1?locale=en'
213
+
214
+ assert_equal "Revision details - #{commit_title} (Motiro)", get_title
215
+ assert_text_present 'Revision r1'
216
+ assert_element_present "//h2[text()='Changes to daughter.txt']"
217
+
218
+ click "//a[@id='pt-BR']"
219
+ wait_for_page_to_load(1000)
220
+
221
+ assert get_title =~ /Detalhes de revis.o - #{commit_title} \(Motiro\)/
222
+ # Revisão r1
223
+ assert_text_present 'Revis'
224
+ assert_text_present 'o r1'
225
+ # Alteraçõµes em dauther.txt
226
+ assert_text_present 'Altera'
227
+ assert_text_present 'es em daughter.txt'
228
+ end
229
+
230
+ def test_translates_page_for_inexistent_revision_id
231
+ @repo.add_file('daughter.txt', 'alone, listless, breakfast table and an otherwise empty room')
232
+
233
+ commit_title = 'added daughter.txt'
234
+ @repo.commit(commit_title)
235
+
236
+ open '/report/subversion/r30?locale=en'
237
+
238
+ assert_equal "Motiro: Welcome", get_title
239
+ assert_text "//div[@id='notice']", 'The article r30 from the Subversion reporter could not be found'
240
+
241
+ open '/report/subversion/r30?locale=pt-BR'
242
+
243
+ assert_text "//div[@id='notice']", /o foi poss/
244
+ assert_text "//div[@id='notice']", /vel encontrar o artigo r30 do rep/
245
+ end
246
+
247
+ def test_select_correct_translation_from_comment
248
+ @repo.add_file('wishlist.txt', 'I wish I was a neutron bomb, for once I could go off')
249
+
250
+ commit_comment = "letras da musica Wishlist do album Yield\n" +
251
+ "\n" +
252
+ "Este album foi originalmente lancado em 1998\n" +
253
+ "\n" +
254
+ "--- en -----------------------------------\n" +
255
+ "\n" +
256
+ "lyrics for the song Wishlist from the album Yield\n" +
257
+ "\n" +
258
+ "This album was originally released in 1998\n"
259
+
260
+ @repo.commit(commit_comment)
261
+
262
+ open '/report/subversion?locale=pt-BR'
263
+
264
+ assert_text_not_present('lyrics')
265
+
266
+ click '//a[text() = "letras da musica Wishlist do album Yield"]'
267
+ wait_for_page_to_load(2000)
268
+
269
+ assert_text_present("letras da musica Wishlist do album Yield")
270
+ assert_text_present('Este album foi originalmente lancado em 1998')
271
+ assert_text_not_present('this')
272
+ assert_text_not_present('originally released')
273
+
274
+ open '/report/subversion?locale=en'
275
+
276
+ assert_text_not_present('letras')
277
+ assert_text_not_present('musica')
278
+
279
+ click '//a[text() = "lyrics for the song Wishlist from the album Yield"]'
280
+ wait_for_page_to_load(2000)
281
+
282
+ assert_text_present("lyrics for the song Wishlist from the album Yield")
283
+ assert_text_present('This album was originally released in 1998')
284
+ assert_text_not_present('musica')
285
+ assert_text_not_present('Este')
286
+ assert_text_not_present('foi originalmente')
287
+ end
288
+
289
+ def test_formats_page_as_wiki_text
290
+ commit_msg = "This is the comment title\n" +
291
+ "\n" +
292
+ "This is the second paragraph"
293
+
294
+ @repo.mkdir('wikitest', commit_msg)
295
+
296
+ open '/report/subversion'
297
+ click "//a[text() = 'This is the comment title']"
298
+ wait_for_page_to_load(2000)
299
+
300
+ assert_element_present "//p[text() = 'This is the second paragraph']"
301
+ end
302
+
303
+ def test_shows_older_revisions
304
+ 1.upto 8 do |n|
305
+ @repo.mkdir("directory#{n}", "Created directory n#{n}")
306
+ end
307
+
308
+ open '/en'
309
+ click "//a[text() = 'Older']"
310
+ wait_for_page_to_load(2000)
311
+
312
+ assert_element_present "//a[text() = 'Created directory n1']"
313
+ assert_element_present "//a[text() = 'Created directory n2']"
314
+ assert_element_present "//a[text() = 'Created directory n5']"
315
+ assert_element_present "//a[text() = 'Created directory n7']"
316
+ assert_element_present "//a[text() = 'Created directory n8']"
317
+ end
318
+
319
+ end
@@ -0,0 +1,27 @@
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 File.dirname(__FILE__) + '/../test_helper'
19
+ require 'acceptance_test_case'
20
+
21
+ require File.join(File.dirname(__FILE__), 'main_page_test')
22
+ require File.join(File.dirname(__FILE__), 'subversion_test')
23
+ require File.join(File.dirname(__FILE__), 'events_test')
24
+ require File.join(File.dirname(__FILE__), 'wiki_test')
25
+ require File.join(File.dirname(__FILE__), 'darcs_test')
26
+ require File.join(File.dirname(__FILE__), 'account_test')
27
+