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,602 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+ require 'diff_table_builder'
3
+
4
+ class DiffTableBuilderTest < Test::Unit::TestCase
5
+
6
+ def setup
7
+ @builder = DiffTableBuilder.new
8
+ end
9
+
10
+ def test_renders_addition_only
11
+ @builder.push_addition 'I have added this'
12
+
13
+ expected_diff_table =
14
+ "<table class='diff 'cellspacing='0'>\n" +
15
+ " <tr style='background: #FFF'>\n" +
16
+ " <td class='line_number'>&nbsp;</td>\n" +
17
+ " <td class='left' " +
18
+ "style='border-width: 1px 1px 1px 1px;'>&nbsp;</td>\n" +
19
+ " <td class='right changed' " +
20
+ "style='border-width: 1px 1px 1px 0;'>" +
21
+ "<pre>I have added this</pre>" +
22
+ "</td>\n" +
23
+ " <td class='line_number'>1</td>\n" +
24
+ " </tr>\n" +
25
+ "</table>"
26
+
27
+ assert_equal expected_diff_table, @builder.render_diff_table
28
+ end
29
+
30
+ def test_renders_deletion_only
31
+ @builder.push_deletion 'I have removed this'
32
+
33
+ expected_diff_table =
34
+ "<table class='diff 'cellspacing='0'>\n" +
35
+ " <tr style='background: #FFF'>\n" +
36
+ " <td class='line_number'>1</td>\n" +
37
+ " <td class='left changed' " +
38
+ "style='border-width: 1px 1px 1px 1px;'>" +
39
+ "<pre>I have removed this</pre>" +
40
+ "</td>\n" +
41
+ " <td class='right' " +
42
+ "style='border-width: 1px 1px 1px 0;'>&nbsp;</td>\n" +
43
+ " <td class='line_number'>&nbsp;</td>\n" +
44
+ " </tr>\n" +
45
+ "</table>"
46
+
47
+ assert_equal expected_diff_table, @builder.render_diff_table
48
+ end
49
+
50
+ def test_matches_alterning_addition_and_deletion
51
+ @builder.push_deletion 'I have removed this'
52
+ @builder.push_addition 'I have added this'
53
+
54
+ expected_diff_table =
55
+ "<table class='diff 'cellspacing='0'>\n" +
56
+ " <tr style='background: #FFF'>\n" +
57
+ " <td class='line_number'>1</td>\n" +
58
+ " <td class='left changed' " +
59
+ "style='border-width: 1px 1px 1px 1px;'>" +
60
+ "<pre>I have removed this</pre>" +
61
+ "</td>\n" +
62
+ " <td class='right changed' " +
63
+ "style='border-width: 1px 1px 1px 0;'>" +
64
+ "<pre>I have added this</pre>" +
65
+ "</td>\n" +
66
+ " <td class='line_number'>1</td>\n" +
67
+ " </tr>\n" +
68
+ "</table>"
69
+
70
+ assert_equal expected_diff_table, @builder.render_diff_table
71
+ end
72
+
73
+ def test_multiline_modification
74
+ @builder.push_deletion 'This is the first old line'
75
+ @builder.push_deletion 'This is the second old line'
76
+ @builder.push_addition 'This is the first new line'
77
+ @builder.push_addition 'This is the second new line'
78
+
79
+ expected_diff_table =
80
+ "<table class='diff 'cellspacing='0'>\n" +
81
+ " <tr style='background: #FFF'>\n" +
82
+ " <td class='line_number'>1</td>\n" +
83
+ " <td class='left changed' " +
84
+ "style='border-width: 1px 1px 0 1px;'>" +
85
+ "<pre>This is the first old line</pre>" +
86
+ "</td>\n" +
87
+ " <td class='right changed' " +
88
+ "style='border-width: 1px 1px 0 0;'>" +
89
+ "<pre>This is the first new line</pre>" +
90
+ "</td>\n" +
91
+ " <td class='line_number'>1</td>\n" +
92
+ " </tr>\n" +
93
+ " <tr style='background: #FFF'>\n" +
94
+ " <td class='line_number'>2</td>\n" +
95
+ " <td class='left changed' " +
96
+ "style='border-width: 0 1px 1px 1px;'>" +
97
+ "<pre>This is the second old line</pre>" +
98
+ "</td>\n" +
99
+ " <td class='right changed' " +
100
+ "style='border-width: 0 1px 1px 0;'>" +
101
+ "<pre>This is the second new line</pre>" +
102
+ "</td>\n" +
103
+ " <td class='line_number'>2</td>\n" +
104
+ " </tr>\n" +
105
+ "</table>"
106
+
107
+ assert_equal expected_diff_table, @builder.render_diff_table
108
+ end
109
+
110
+ def test_more_adds_than_deletes
111
+ @builder.push_deletion 'This is the first old line'
112
+ @builder.push_addition 'This is the first new line'
113
+ @builder.push_addition 'This is the second new line'
114
+ @builder.push_unchanged 'This line remains the same'
115
+
116
+ expected_diff_table =
117
+ "<table class='diff 'cellspacing='0'>\n" +
118
+ " <tr style='background: #FFF'>\n" +
119
+ " <td class='line_number'>1</td>\n" +
120
+ " <td class='left changed' " +
121
+ "style='border-width: 1px 1px 1px 1px;'>" +
122
+ "<pre>This is the first old line</pre>" +
123
+ "</td>\n" +
124
+ " <td class='right changed' " +
125
+ "style='border-width: 1px 1px 0 0;'>" +
126
+ "<pre>This is the first new line</pre>" +
127
+ "</td>\n" +
128
+ " <td class='line_number'>1</td>\n" +
129
+ " </tr>\n" +
130
+ " <tr style='background: #FFF'>\n" +
131
+ " <td class='line_number'>&nbsp;</td>\n" +
132
+ " <td class='left' " +
133
+ "style='border-width: 0 1px 0 0;'>&nbsp;" +
134
+ "</td>\n" +
135
+ " <td class='right changed' " +
136
+ "style='border-width: 0 1px 1px 1px;'>" +
137
+ "<pre>This is the second new line</pre>" +
138
+ "</td>\n" +
139
+ " <td class='line_number'>2</td>\n" +
140
+ " </tr>\n" +
141
+ " <tr style='background: #FFF'>\n" +
142
+ " <td class='line_number'>2</td>\n" +
143
+ " <td class='left' style='border-width: 0 1px 0 0;'>" +
144
+ "<pre>This line remains the same</pre>" +
145
+ "</td>\n" +
146
+ " <td class='right' style='border-width: 0 0 0 0;'>" +
147
+ "<pre>This line remains the same</pre>" +
148
+ "</td>\n" +
149
+ " <td class='line_number'>3</td>\n" +
150
+ " </tr>\n" +
151
+ "</table>"
152
+
153
+ assert_equal expected_diff_table, @builder.render_diff_table
154
+ end
155
+
156
+ def test_less_adds_than_deletes
157
+ @builder.push_deletion 'This is the first old line'
158
+ @builder.push_deletion 'This is the second old line'
159
+ @builder.push_addition 'This is the first new line'
160
+ @builder.push_unchanged 'This line remains the same'
161
+
162
+ expected_diff_table =
163
+ "<table class='diff 'cellspacing='0'>\n" +
164
+ " <tr style='background: #FFF'>\n" +
165
+ " <td class='line_number'>1</td>\n" +
166
+ " <td class='left changed' " +
167
+ "style='border-width: 1px 1px 0 1px;'>" +
168
+ "<pre>This is the first old line</pre>" +
169
+ "</td>\n" +
170
+ " <td class='right changed' " +
171
+ "style='border-width: 1px 1px 1px 0;'>" +
172
+ "<pre>This is the first new line</pre>" +
173
+ "</td>\n" +
174
+ " <td class='line_number'>1</td>\n" +
175
+ " </tr>\n" +
176
+ " <tr style='background: #FFF'>\n" +
177
+ " <td class='line_number'>2</td>\n" +
178
+ " <td class='left changed' " +
179
+ "style='border-width: 0 1px 1px 1px;'>" +
180
+ "<pre>This is the second old line</pre>" +
181
+ "</td>\n" +
182
+ " <td class='right' " +
183
+ "style='border-width: 0 0 0 1px;'>&nbsp;</td>\n" +
184
+ " <td class='line_number'>&nbsp;</td>\n" +
185
+ " </tr>\n" +
186
+ " <tr style='background: #FFF'>\n" +
187
+ " <td class='line_number'>3</td>\n" +
188
+ " <td class='left' style='border-width: 0 1px 0 0;'>" +
189
+ "<pre>This line remains the same</pre>" +
190
+ "</td>\n" +
191
+ " <td class='right' style='border-width: 0 0 0 0;'>" +
192
+ "<pre>This line remains the same</pre>" +
193
+ "</td>\n" +
194
+ " <td class='line_number'>2</td>\n" +
195
+ " </tr>\n" +
196
+ "</table>"
197
+
198
+ assert_equal expected_diff_table, @builder.render_diff_table
199
+ end
200
+
201
+ def test_some_code_kept
202
+ @builder.start_line 6
203
+
204
+ @builder.push_unchanged 'div.channel-title {'
205
+ @builder.push_deletion ' font: normal 8pt Verdana,sans-serif;'
206
+ @builder.push_addition ' font: bold 10pt Verdana,sans-serif;'
207
+ @builder.push_unchanged ' margin:0 0 0 0;'
208
+
209
+ expected_diff_table =
210
+ "<table class='diff 'cellspacing='0'>\n" +
211
+ " <tr style='background: #FFF'>\n" +
212
+ " <td class='line_number'>6</td>\n" +
213
+ " <td class='left' style='border-width: 0 1px 0 0;'>" +
214
+ "<pre>div.channel-title {</pre>" +
215
+ "</td>\n" +
216
+ " <td class='right' style='border-width: 0 0 0 0;'>" +
217
+ "<pre>div.channel-title {</pre>" +
218
+ "</td>\n" +
219
+ " <td class='line_number'>6</td>\n" +
220
+ " </tr>\n" +
221
+ " <tr style='background: #FFF'>\n" +
222
+ " <td class='line_number'>7</td>\n" +
223
+ " <td class='left changed' " +
224
+ "style='border-width: 1px 1px 1px 1px;'>" +
225
+ "<pre> font: normal 8pt Verdana,sans-serif;</pre>" +
226
+ "</td>\n" +
227
+ " <td class='right changed' " +
228
+ "style='border-width: 1px 1px 1px 0;'>" +
229
+ "<pre> font: bold 10pt Verdana,sans-serif;</pre>" +
230
+ "</td>\n" +
231
+ " <td class='line_number'>7</td>\n" +
232
+ " </tr>\n" +
233
+ " <tr style='background: #FFF'>\n" +
234
+ " <td class='line_number'>8</td>\n" +
235
+ " <td class='left' style='border-width: 0 1px 0 0;'>" +
236
+ "<pre> margin:0 0 0 0;</pre>" +
237
+ "</td>\n" +
238
+ " <td class='right' style='border-width: 0 0 0 0;'>" +
239
+ "<pre> margin:0 0 0 0;</pre>" +
240
+ "</td>\n" +
241
+ " <td class='line_number'>8</td>\n" +
242
+ " </tr>\n" +
243
+ "</table>"
244
+
245
+ assert_equal expected_diff_table, @builder.render_diff_table
246
+ end
247
+
248
+ def test_esparse_changes
249
+ @builder.start_line 6
250
+
251
+ @builder.push_unchanged 'div.channel-title {'
252
+ @builder.push_deletion ' font: normal 8pt Verdana,sans-serif;'
253
+ @builder.push_addition ' font: bold 10pt Verdana,sans-serif;'
254
+ @builder.push_unchanged ' margin:0 0 0 0;'
255
+
256
+ @builder.start_line 13
257
+
258
+ @builder.push_unchanged 'div.channel-body-outer {'
259
+ @builder.push_deletion ' padding: 0 9px 0 9px;'
260
+ @builder.push_addition ' padding: 0 8px 0 8px;'
261
+ @builder.push_unchanged '}'
262
+
263
+ expected_diff_table =
264
+ "<table class='diff 'cellspacing='0'>\n" +
265
+ " <tr style='background: #FFF'>\n" +
266
+ " <td class='line_number'>6</td>\n" +
267
+ " <td class='left' style='border-width: 0 1px 0 0;'>" +
268
+ "<pre>div.channel-title {</pre>" +
269
+ "</td>\n" +
270
+ " <td class='right' style='border-width: 0 0 0 0;'>" +
271
+ "<pre>div.channel-title {</pre>" +
272
+ "</td>\n" +
273
+ " <td class='line_number'>6</td>\n" +
274
+ " </tr>\n" +
275
+ " <tr style='background: #FFF'>\n" +
276
+ " <td class='line_number'>7</td>\n" +
277
+ " <td class='left changed' " +
278
+ "style='border-width: 1px 1px 1px 1px;'>" +
279
+ "<pre> font: normal 8pt Verdana,sans-serif;</pre>" +
280
+ "</td>\n" +
281
+ " <td class='right changed' " +
282
+ "style='border-width: 1px 1px 1px 0;'>" +
283
+ "<pre> font: bold 10pt Verdana,sans-serif;</pre>" +
284
+ "</td>\n" +
285
+ " <td class='line_number'>7</td>\n" +
286
+ " </tr>\n" +
287
+ " <tr style='background: #FFF'>\n" +
288
+ " <td class='line_number'>8</td>\n" +
289
+ " <td class='left' style='border-width: 0 1px 0 0;'>" +
290
+ "<pre> margin:0 0 0 0;</pre>" +
291
+ "</td>\n" +
292
+ " <td class='right' style='border-width: 0 0 0 0;'>" +
293
+ "<pre> margin:0 0 0 0;</pre>" +
294
+ "</td>\n" +
295
+ " <td class='line_number'>8</td>\n" +
296
+ " </tr>\n" +
297
+ " <tr>\n" +
298
+ " <td style='border:solid gray; " +
299
+ "border-width: 1px 0 1px 0;'>&nbsp;</td>\n" +
300
+ " <td style='border:solid gray; " +
301
+ "border-width: 1px 0 1px 0;'>&nbsp;</td>\n" +
302
+ " <td style='border:solid gray; " +
303
+ "border-width: 1px 0 1px 0;'>&nbsp;</td>\n" +
304
+ " <td style='border:solid gray; " +
305
+ "border-width: 1px 0 1px 0;'>&nbsp;</td>\n" +
306
+ " </tr>\n" +
307
+ " <tr style='background: #FFF'>\n" +
308
+ " <td class='line_number'>13</td>\n" +
309
+ " <td class='left' style='border-width: 0 1px 0 0;'>" +
310
+ "<pre>div.channel-body-outer {</pre>" +
311
+ "</td>\n" +
312
+ " <td class='right' style='border-width: 0 0 0 0;'>" +
313
+ "<pre>div.channel-body-outer {</pre>" +
314
+ "</td>\n" +
315
+ " <td class='line_number'>13</td>\n" +
316
+ " </tr>\n" +
317
+ " <tr style='background: #FFF'>\n" +
318
+ " <td class='line_number'>14</td>\n" +
319
+ " <td class='left changed' " +
320
+ "style='border-width: 1px 1px 1px 1px;'>" +
321
+ "<pre> padding: 0 9px 0 9px;</pre>" +
322
+ "</td>\n" +
323
+ " <td class='right changed' " +
324
+ "style='border-width: 1px 1px 1px 0;'>" +
325
+ "<pre> padding: 0 8px 0 8px;</pre>" +
326
+ "</td>\n" +
327
+ " <td class='line_number'>14</td>\n" +
328
+ " </tr>\n" +
329
+ " <tr style='background: #FFF'>\n" +
330
+ " <td class='line_number'>15</td>\n" +
331
+ " <td class='left' style='border-width: 0 1px 0 0;'>" +
332
+ "<pre>}</pre>" +
333
+ "</td>\n" +
334
+ " <td class='right' style='border-width: 0 0 0 0;'>" +
335
+ "<pre>}</pre>" +
336
+ "</td>\n" +
337
+ " <td class='line_number'>15</td>\n" +
338
+ " </tr>\n" +
339
+ "</table>"
340
+
341
+ assert_equal expected_diff_table, @builder.render_diff_table
342
+ end
343
+
344
+ def test_unmatching_line_numbers
345
+ @builder.start_line(6, 6)
346
+
347
+ @builder.push_unchanged 'div.channel-title {'
348
+ @builder.push_deletion ' font: normal 8pt Verdana,sans-serif;'
349
+ @builder.push_addition ' font: bold 10pt Verdana,sans-serif;'
350
+ @builder.push_addition ' margin:0 0 0 0;'
351
+
352
+ @builder.start_line(13, 14)
353
+
354
+ @builder.push_unchanged 'div.channel-body-outer {'
355
+ @builder.push_deletion ' padding: 0 9px 0 9px;'
356
+ @builder.push_addition ' padding: 0 8px 0 8px;'
357
+ @builder.push_unchanged '}'
358
+
359
+ expected_diff_table =
360
+ "<table class='diff 'cellspacing='0'>\n" +
361
+ " <tr style='background: #FFF'>\n" +
362
+ " <td class='line_number'>6</td>\n" +
363
+ " <td class='left' style='border-width: 0 1px 0 0;'>" +
364
+ "<pre>div.channel-title {</pre>" +
365
+ "</td>\n" +
366
+ " <td class='right' style='border-width: 0 0 0 0;'>" +
367
+ "<pre>div.channel-title {</pre>" +
368
+ "</td>\n" +
369
+ " <td class='line_number'>6</td>\n" +
370
+ " </tr>\n" +
371
+ " <tr style='background: #FFF'>\n" +
372
+ " <td class='line_number'>7</td>\n" +
373
+ " <td class='left changed' " +
374
+ "style='border-width: 1px 1px 1px 1px;'>" +
375
+ "<pre> font: normal 8pt Verdana,sans-serif;</pre>" +
376
+ "</td>\n" +
377
+ " <td class='right changed' " +
378
+ "style='border-width: 1px 1px 0 0;'>" +
379
+ "<pre> font: bold 10pt Verdana,sans-serif;</pre>" +
380
+ "</td>\n" +
381
+ " <td class='line_number'>7</td>\n" +
382
+ " </tr>\n" +
383
+ " <tr style='background: #FFF'>\n" +
384
+ " <td class='line_number'>&nbsp;</td>\n" +
385
+ " <td class='left' style='border-width: 0 1px 0 0;'>&nbsp;" +
386
+ "</td>\n" +
387
+ " <td class='right changed' " +
388
+ "style='border-width: 0 1px 1px 1px;'>" +
389
+ "<pre> margin:0 0 0 0;</pre>" +
390
+ "</td>\n" +
391
+ " <td class='line_number'>8</td>\n" +
392
+ " </tr>\n" +
393
+ " <tr>\n" +
394
+ " <td style='border:solid gray; " +
395
+ "border-width: 1px 0 1px 0;'>&nbsp;</td>\n" +
396
+ " <td style='border:solid gray; " +
397
+ "border-width: 1px 0 1px 0;'>&nbsp;</td>\n" +
398
+ " <td style='border:solid gray; " +
399
+ "border-width: 1px 0 1px 0;'>&nbsp;</td>\n" +
400
+ " <td style='border:solid gray; " +
401
+ "border-width: 1px 0 1px 0;'>&nbsp;</td>\n" +
402
+ " </tr>\n" +
403
+ " <tr style='background: #FFF'>\n" +
404
+ " <td class='line_number'>13</td>\n" +
405
+ " <td class='left' style='border-width: 0 1px 0 0;'>" +
406
+ "<pre>div.channel-body-outer {</pre>" +
407
+ "</td>\n" +
408
+ " <td class='right' style='border-width: 0 0 0 0;'>" +
409
+ "<pre>div.channel-body-outer {</pre>" +
410
+ "</td>\n" +
411
+ " <td class='line_number'>14</td>\n" +
412
+ " </tr>\n" +
413
+ " <tr style='background: #FFF'>\n" +
414
+ " <td class='line_number'>14</td>\n" +
415
+ " <td class='left changed' " +
416
+ "style='border-width: 1px 1px 1px 1px;'>" +
417
+ "<pre> padding: 0 9px 0 9px;</pre>" +
418
+ "</td>\n" +
419
+ " <td class='right changed' " +
420
+ "style='border-width: 1px 1px 1px 0;'>" +
421
+ "<pre> padding: 0 8px 0 8px;</pre>" +
422
+ "</td>\n" +
423
+ " <td class='line_number'>15</td>\n" +
424
+ " </tr>\n" +
425
+ " <tr style='background: #FFF'>\n" +
426
+ " <td class='line_number'>15</td>\n" +
427
+ " <td class='left' style='border-width: 0 1px 0 0;'>" +
428
+ "<pre>}</pre>" +
429
+ "</td>\n" +
430
+ " <td class='right' style='border-width: 0 0 0 0;'>" +
431
+ "<pre>}</pre>" +
432
+ "</td>\n" +
433
+ " <td class='line_number'>16</td>\n" +
434
+ " </tr>\n" +
435
+ "</table>"
436
+
437
+ assert_equal expected_diff_table, @builder.render_diff_table
438
+ end
439
+
440
+ def test_escapes_html
441
+ @builder.push_unchanged ' <h1><%= h(@headline.title) -%></h1>'
442
+ expected_diff_table =
443
+ "<table class='diff 'cellspacing='0'>\n" +
444
+ " <tr style='background: #FFF'>\n" +
445
+ " <td class='line_number'>1</td>\n" +
446
+ " <td class='left' style='border-width: 0 1px 0 0;'>" +
447
+ "<pre> &lt;h1&gt;&lt;%= h(@headline.title) -%&gt;&lt;/h1&gt;</pre>" +
448
+ "</td>\n" +
449
+ " <td class='right' style='border-width: 0 0 0 0;'>" +
450
+ "<pre> &lt;h1&gt;&lt;%= h(@headline.title) -%&gt;&lt;/h1&gt;</pre>" +
451
+ "</td>\n" +
452
+ " <td class='line_number'>1</td>\n" +
453
+ " </tr>\n" +
454
+ "</table>"
455
+
456
+ assert_equal expected_diff_table, @builder.render_diff_table
457
+ end
458
+
459
+ def test_escapes_empty_lines
460
+ @builder.push_addition ''
461
+ @builder.push_addition ' def test_escapes_empty_lines'
462
+ expected_diff_table =
463
+ expected_diff_table =
464
+ "<table class='diff 'cellspacing='0'>\n" +
465
+ " <tr style='background: #FFF'>\n" +
466
+ " <td class='line_number'>&nbsp;</td>\n" +
467
+ " <td class='left' " +
468
+ "style='border-width: 1px 1px 1px 1px;'>&nbsp;</td>\n" +
469
+ " <td class='right changed' " +
470
+ "style='border-width: 1px 1px 0 0;'>&nbsp;</td>\n" +
471
+ " <td class='line_number'>1</td>\n" +
472
+ " </tr>\n" +
473
+ " <tr style='background: #FFF'>\n" +
474
+ " <td class='line_number'>&nbsp;</td>\n" +
475
+ " <td class='left' " +
476
+ "style='border-width: 0 1px 0 0;'>&nbsp;</td>\n" +
477
+ " <td class='right changed' " +
478
+ "style='border-width: 0 1px 1px 1px;'>" +
479
+ "<pre> def test_escapes_empty_lines</pre>" +
480
+ "</td>\n" +
481
+ " <td class='line_number'>2</td>\n" +
482
+ " </tr>\n" +
483
+ "</table>"
484
+
485
+ assert_equal expected_diff_table, @builder.render_diff_table
486
+ end
487
+
488
+ def test_inserts_break_between_addition_and_unchanged_starting_from_top
489
+ @builder.start_line(1, 1)
490
+ @builder.push_unchanged ""
491
+ @builder.push_addition "import java.io.IOException;"
492
+ @builder.start_line(51, 62)
493
+ @builder.push_unchanged "\t\t}"
494
+
495
+ expected_diff_table =
496
+ "<table class='diff 'cellspacing='0'>\n" +
497
+ " <tr style='background: #FFF'>\n" +
498
+ " <td class='line_number'>1</td>\n" +
499
+ " <td class='left' style='border-width: 0 1px 0 0;'>&nbsp;</td>\n" +
500
+ " <td class='right' style='border-width: 0 0 0 0;'>&nbsp;</td>\n" +
501
+ " <td class='line_number'>1</td>\n" +
502
+ " </tr>\n" +
503
+ " <tr style='background: #FFF'>\n" +
504
+ " <td class='line_number'>&nbsp;</td>\n" +
505
+ " <td class='left' style='border-width: 1px 1px 1px 1px;'>&nbsp;</td>\n" +
506
+ " <td class='right changed' style='border-width: 1px 1px 1px 0;'><pre>import java.io.IOException;</pre></td>\n" +
507
+ " <td class='line_number'>2</td>\n" +
508
+ " </tr>\n" +
509
+ " <tr>\n" +
510
+ " <td style='border:solid gray; border-width: 1px 0 1px 0;'>&nbsp;</td>\n" +
511
+ " <td style='border:solid gray; border-width: 1px 0 1px 0;'>&nbsp;</td>\n" +
512
+ " <td style='border:solid gray; border-width: 1px 0 1px 0;'>&nbsp;</td>\n" +
513
+ " <td style='border:solid gray; border-width: 1px 0 1px 0;'>&nbsp;</td>\n" +
514
+ " </tr>\n" +
515
+ " <tr style='background: #FFF'>\n" +
516
+ " <td class='line_number'>51</td>\n" +
517
+ " <td class='left' style='border-width: 0 1px 0 0;'><pre>\t\t}</pre></td>\n" +
518
+ " <td class='right' style='border-width: 0 0 0 0;'><pre>\t\t}</pre></td>\n" +
519
+ " <td class='line_number'>62</td>\n" +
520
+ " </tr>\n" +
521
+ "</table>"
522
+
523
+ assert_equal expected_diff_table, @builder.render_diff_table
524
+ end
525
+
526
+ def test_inserts_break_between_unchanged_and_addition_starting_from_top
527
+ @builder.start_line(1, 1)
528
+ @builder.push_addition "added line"
529
+ @builder.push_unchanged "old line number 1"
530
+ @builder.start_line(51, 62)
531
+ @builder.push_addition "new line 62"
532
+
533
+ expected_diff_table =
534
+ "<table class='diff 'cellspacing='0'>\n" +
535
+ " <tr style='background: #FFF'>\n" +
536
+ " <td class='line_number'>&nbsp;</td>\n" +
537
+ " <td class='left' style='border-width: 1px 1px 1px 1px;'>&nbsp;</td>\n" +
538
+ " <td class='right changed' style='border-width: 1px 1px 1px 0;'><pre>added line</pre></td>\n" +
539
+ " <td class='line_number'>1</td>\n" +
540
+ " </tr>\n" +
541
+ " <tr style='background: #FFF'>\n" +
542
+ " <td class='line_number'>1</td>\n" +
543
+ " <td class='left' style='border-width: 0 1px 0 0;'><pre>old line number 1</pre></td>\n" +
544
+ " <td class='right' style='border-width: 0 0 0 0;'><pre>old line number 1</pre></td>\n" +
545
+ " <td class='line_number'>2</td>\n" +
546
+ " </tr>\n" +
547
+ " <tr>\n" +
548
+ " <td style='border:solid gray; border-width: 1px 0 1px 0;'>&nbsp;</td>\n" +
549
+ " <td style='border:solid gray; border-width: 1px 0 1px 0;'>&nbsp;</td>\n" +
550
+ " <td style='border:solid gray; border-width: 1px 0 1px 0;'>&nbsp;</td>\n" +
551
+ " <td style='border:solid gray; border-width: 1px 0 1px 0;'>&nbsp;</td>\n" +
552
+ " </tr>\n" +
553
+ " <tr style='background: #FFF'>\n" +
554
+ " <td class='line_number'>&nbsp;</td>\n" +
555
+ " <td class='left' style='border-width: 1px 1px 1px 1px;'>&nbsp;</td>\n" +
556
+ " <td class='right changed' style='border-width: 1px 1px 1px 0;'><pre>new line 62</pre></td>\n" +
557
+ " <td class='line_number'>62</td>\n" +
558
+ " </tr>\n" +
559
+ "</table>"
560
+
561
+ assert_equal expected_diff_table, @builder.render_diff_table
562
+ end
563
+
564
+ def test_inserts_break_between_two_unchangeds_starting_from_top
565
+ @builder.start_line(1, 1)
566
+ @builder.push_addition "added line"
567
+ @builder.push_unchanged "old line number 1"
568
+ @builder.start_line(50, 56)
569
+ @builder.push_unchanged "\t\t"
570
+
571
+ expected_diff_table =
572
+ "<table class='diff 'cellspacing='0'>\n" +
573
+ " <tr style='background: #FFF'>\n" +
574
+ " <td class='line_number'>&nbsp;</td>\n" +
575
+ " <td class='left' style='border-width: 1px 1px 1px 1px;'>&nbsp;</td>\n" +
576
+ " <td class='right changed' style='border-width: 1px 1px 1px 0;'><pre>added line</pre></td>\n" +
577
+ " <td class='line_number'>1</td>\n" +
578
+ " </tr>\n" +
579
+ " <tr style='background: #FFF'>\n" +
580
+ " <td class='line_number'>1</td>\n" +
581
+ " <td class='left' style='border-width: 0 1px 0 0;'><pre>old line number 1</pre></td>\n" +
582
+ " <td class='right' style='border-width: 0 0 0 0;'><pre>old line number 1</pre></td>\n" +
583
+ " <td class='line_number'>2</td>\n" +
584
+ " </tr>\n" +
585
+ " <tr>\n" +
586
+ " <td style='border:solid gray; border-width: 1px 0 1px 0;'>&nbsp;</td>\n" +
587
+ " <td style='border:solid gray; border-width: 1px 0 1px 0;'>&nbsp;</td>\n" +
588
+ " <td style='border:solid gray; border-width: 1px 0 1px 0;'>&nbsp;</td>\n" +
589
+ " <td style='border:solid gray; border-width: 1px 0 1px 0;'>&nbsp;</td>\n" +
590
+ " </tr>\n" +
591
+ " <tr style='background: #FFF'>\n" +
592
+ " <td class='line_number'>50</td>\n" +
593
+ " <td class='left' style='border-width: 0 1px 0 0;'><pre>\t\t</pre></td>\n" +
594
+ " <td class='right' style='border-width: 0 0 0 0;'><pre>\t\t</pre></td>\n" +
595
+ " <td class='line_number'>56</td>\n" +
596
+ " </tr>\n" +
597
+ "</table>"
598
+
599
+ assert_equal expected_diff_table, @builder.render_diff_table
600
+ end
601
+
602
+ end