motiro 0.6.6 → 0.6.7

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 (40) hide show
  1. data/README +1 -1
  2. data/app/controllers/wiki_controller.rb +14 -1
  3. data/app/core/version.rb +1 -1
  4. data/app/core/wiki_reporter.rb +4 -17
  5. data/app/helpers/application_helper.rb +33 -0
  6. data/app/helpers/report_helper.rb +39 -0
  7. data/app/helpers/report_helper.rb.rej +46 -0
  8. data/app/helpers/wiki_helper.rb +1 -1
  9. data/app/models/change.rb +12 -41
  10. data/app/models/chunk.rb +56 -0
  11. data/app/models/page.rb +17 -0
  12. data/app/models/revision.rb +31 -0
  13. data/app/reporters/events_reporter.rb +0 -2
  14. data/app/views/report/show.rhtml +2 -2
  15. data/app/views/wiki/diff.rhtml +4 -0
  16. data/app/views/wiki/history.rhtml +32 -21
  17. data/app/views/wiki/history.rhtml.rej +63 -0
  18. data/config/motiro.yml +1 -1
  19. data/config/routes.rb +3 -0
  20. data/db/motirodb.sqlite.initial +0 -0
  21. data/db/translation/pt-BR.rb +6 -1
  22. data/db/translation/pt-BR.rb.rej +26 -0
  23. data/lib/diff_chunk_builder.rb +98 -0
  24. data/lib/tasks/packaging.rake +2 -1
  25. data/public/stylesheets/motiro.css +49 -18
  26. data/public/stylesheets/motiro.css.rej +37 -0
  27. data/public/wiki/history/OtherPage-en-us.xml +40 -0
  28. data/test/fixtures/pages.yml +1 -1
  29. data/test/fixtures/revisions.yml +15 -4
  30. data/test/functional/report_features_test.rb +7 -1
  31. data/test/functional/root_controller_test.rb +1 -1
  32. data/test/functional/wiki_controller_test.rb +44 -4
  33. data/test/unit/change_test.rb +29 -56
  34. data/test/unit/diff_chunk_builder_test.rb +269 -0
  35. data/test/unit/page_test.rb +46 -0
  36. data/test/unit/revision_test.rb +160 -0
  37. data/test/unit/wiki_reporter_test.rb +2 -1
  38. metadata +301 -283
  39. data/app/models/diff_table_builder.rb +0 -285
  40. data/test/unit/diff_table_builder_test.rb +0 -602
@@ -0,0 +1,26 @@
1
+ ***************
2
+ *** 71,80 ****
3
+ 'event description' => 'descrição de evento',
4
+ 'Who should be able to edit this page?' => 'Quem pode editar esta página?',
5
+ '(Usernames separated by spaces. Blank for everyone)' => '(Nomes de usuário separados por espaços. Em branco para todos.)',
6
+
7
+ # Older headlines and history pages
8
+ 'Author' => 'Autor',
9
+ 'Page history for %s' => 'Histórico da página %s',
10
+ 'Page history' => 'Histórico da página',
11
+ '(Revision %s)' => '(Revisão %s)'
12
+ }
13
+ --- 71,83 ----
14
+ 'event description' => 'descrição de evento',
15
+ 'Who should be able to edit this page?' => 'Quem pode editar esta página?',
16
+ '(Usernames separated by spaces. Blank for everyone)' => '(Nomes de usuário separados por espaços. Em branco para todos.)',
17
+ + '(Comparing revisions %s and %s)' => '(Diferenças entre as revisões %s e %s)',
18
+
19
+ # Older headlines and history pages
20
+ 'Author' => 'Autor',
21
+ + 'Page has no history yet' => 'Página ainda sem histórico',
22
+ 'Page history for %s' => 'Histórico da página %s',
23
+ + 'Page history (%s revisions)' => 'Histórico da página (%s revisões)',
24
+ 'Page history' => 'Histórico da página',
25
+ '(Revision %s)' => '(Revisão %s)'
26
+ }
@@ -0,0 +1,98 @@
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 DiffChunkBuilder
19
+
20
+ def initialize
21
+ @chunks = []
22
+ @unmatched_deletions = []
23
+ @old_line_num = @new_line_num = 1
24
+ needs_new_chunk!
25
+ end
26
+
27
+ def start_line(old_line_num, new_line_num=old_line_num)
28
+ consume_unmatched_deletions
29
+ needs_new_chunk!
30
+ @chunks << Separator.new(old_line_num - @old_line_num) unless @chunks.empty?
31
+ @old_line_num, @new_line_num = old_line_num, new_line_num
32
+ end
33
+
34
+ def push_deletion(text)
35
+ @unmatched_deletions << [text, @old_line_num]
36
+ @old_line_num += 1
37
+ end
38
+
39
+ def push_unchanged(text)
40
+ consume_unmatched_deletions
41
+ target_chunk_for(:unchanged) << Line.new(text, @old_line_num,
42
+ text, @new_line_num)
43
+ @old_line_num += 1
44
+ @new_line_num += 1
45
+ end
46
+
47
+ def push_addition(text)
48
+ unless @unmatched_deletions.empty?
49
+ chunk = target_chunk_for(:modification)
50
+ old_text, old_position = @unmatched_deletions.shift
51
+ chunk << Line.new(old_text, old_position, text, @new_line_num)
52
+ else
53
+ target_chunk_for(:addition) << Line.new(nil, @old_line_num,
54
+ text, @new_line_num)
55
+ end
56
+ @new_line_num += 1
57
+ end
58
+
59
+ def get_chunks
60
+ consume_unmatched_deletions
61
+ @chunks
62
+ end
63
+
64
+ private
65
+
66
+ def consume_unmatched_deletions
67
+ return if @unmatched_deletions.empty?
68
+ chunk = target_chunk_for(:deletion)
69
+ @unmatched_deletions.each do |old_text, old_position|
70
+ chunk << Line.new(old_text, old_position, nil, nil)
71
+ end
72
+ @unmatched_deletions = []
73
+ end
74
+
75
+ def needs_new_chunk!(need=true)
76
+ @should_create_new_chunk = need
77
+ end
78
+
79
+ def needs_new_chunk?
80
+ @should_create_new_chunk
81
+ end
82
+
83
+ ACCEPTABLE_PREVIOUS_ACTION = {:modification => [:modification],
84
+ :addition => [:addition, :modification],
85
+ :deletion => [:deletion, :modification],
86
+ :unchanged => [:unchanged]}
87
+
88
+ def target_chunk_for(action)
89
+ chunk = @chunks.last
90
+
91
+ @chunks << chunk = Chunk.new(action) if needs_new_chunk? ||
92
+ !ACCEPTABLE_PREVIOUS_ACTION[action].include?(chunk.action)
93
+
94
+ needs_new_chunk!(false)
95
+ chunk
96
+ end
97
+
98
+ end
@@ -49,7 +49,7 @@ unless MOTIRO_VERSION.include? 'dev'
49
49
  s.platform = Gem::Platform::RUBY
50
50
  s.executables = ['motiro']
51
51
 
52
- s.add_dependency("rails", "= 1.2.2")
52
+ s.add_dependency("rails", "= 1.2.3")
53
53
  s.add_dependency("mediacloth", ">= 0.0.2")
54
54
  s.add_dependency("daemons", ">= 1.0.4")
55
55
  s.add_dependency("Platform", ">= 0.4.0")
@@ -58,6 +58,7 @@ unless MOTIRO_VERSION.include? 'dev'
58
58
  s.add_dependency("sqlite3-ruby", ">= 1.2.1")
59
59
  s.add_dependency("flexmock", ">= 0.5")
60
60
  s.add_dependency("rails-app-installer", "= 0.2.0")
61
+ s.add_dependency("diff-lcs", ">= 1.1.2")
61
62
  end
62
63
 
63
64
  packaging = Rake::GemPackageTask.new(spec) do |p|
@@ -149,42 +149,73 @@ div.channel_toolbar {
149
149
  table.diff {
150
150
  border: solid gray;
151
151
  border-width: 1px 0 1px 0;
152
+ border-collapse: collapse;
152
153
  font-family: monospace;
153
- font-size: 0.72em;
154
+ font-size: 0.8em;
155
+ margin: 0 0 1em 0;
154
156
  }
155
157
 
156
158
  table.diff pre {
157
159
  margin: 0;
158
160
  padding: 0;
159
161
  text-align: left;
162
+ white-space: pre-wrap; /* CSS 3 */
163
+ white-space: -moz-pre-wrap; /* Mozilla, 1999+ */
164
+ white-space: -pre-wrap; /* Opera 4-6 */
165
+ white-space: -o-pre-wrap; /* Opera 7 */
166
+ word-wrap: break-word; /* IE 5.5+ */
160
167
  }
161
168
 
162
- table.diff tr {
163
- margin: 0 0 0 0;
164
- padding: 0 0 0 0;
165
- border: 0;
169
+ table.diff td {
170
+ padding: .05em .4em .05em .4em;
166
171
  }
167
172
 
168
- table.diff td {
169
- padding: 0 0.4em 0 0.4em;
173
+ table.diff col.line_number {
174
+ text-align: center;
175
+ border: solid gray;
176
+ border-width: 0 1px 0 1px;
170
177
  }
171
178
 
172
- table.diff td.left {
173
- border:solid;
174
- border-color: black gray black black;
179
+ table.diff col.left {
180
+ border-right: 1px solid gray;
181
+ width: 50%;
175
182
  }
176
183
 
177
- table.diff td.right {
178
- border:solid black;
184
+ table.diff col.right {
185
+ width: 50%;
179
186
  }
180
187
 
181
- table.diff td.line_number {
182
- text-align: center;
183
- border:solid gray;
184
- border-width: 0 1px 0 1px;
188
+ tbody.unchanged {
189
+ background: #FFF;
190
+ }
191
+
192
+ tbody.modification {
193
+ background: #ffffb8;
194
+ border: #606060 solid;
195
+ border-width: 1px 0 1px 0;
196
+ }
197
+
198
+ tbody.addition {
199
+ background: #b8ffb8;
200
+ border: #606060 solid;
201
+ border-width: 1px 0 1px 0;
202
+ }
203
+
204
+ tbody.deletion {
205
+ background: #ffb8b8;
206
+ border: #606060 solid;
207
+ border-width: 1px 0 1px 0;
208
+ }
209
+
210
+ tbody.separator {
211
+ background: #d0d0c4;
212
+ text-align: center;
213
+ border: #606060 solid;
214
+ border-width: 1px 0 1px 0;
185
215
  }
186
216
 
187
217
  table.oldernews {
218
+ margin: .8em 0;
188
219
  border-spacing: 0;
189
220
  text-align: left;
190
221
  font-size: .85em;
@@ -193,9 +224,9 @@ table.oldernews {
193
224
 
194
225
  table.oldernews tr.even { background-color: #fff; }
195
226
 
196
- table.oldernews tr.odd { background-color: #eee; }
227
+ table.oldernews tr.odd { background-color: #e0eeff; }
197
228
 
198
- table.oldernews thead { background-color: #d0d0d0; }
229
+ table.oldernews thead { background-color: #66a0e0; }
199
230
 
200
231
  table.oldernews tbody th { border: 1px #c9c9c9 solid; }
201
232
 
@@ -0,0 +1,37 @@
1
+ ***************
2
+ *** 182,187 ****
3
+ }
4
+
5
+ table.oldernews {
6
+ border-spacing: 0;
7
+ text-align: left;
8
+ font-size: .85em;
9
+ --- 183,189 ----
10
+ }
11
+
12
+ table.oldernews {
13
+ + margin: .8em 0;
14
+ border-spacing: 0;
15
+ text-align: left;
16
+ font-size: .85em;
17
+ ***************
18
+ *** 190,198 ****
19
+
20
+ table.oldernews tr.even { background-color: #fff; }
21
+
22
+ - table.oldernews tr.odd { background-color: #eee; }
23
+
24
+ - table.oldernews thead { background-color: #d0d0d0; }
25
+
26
+ table.oldernews tbody th { border: 1px #c9c9c9 solid; }
27
+
28
+ --- 192,200 ----
29
+
30
+ table.oldernews tr.even { background-color: #fff; }
31
+
32
+ + table.oldernews tr.odd { background-color: #e0eeff; }
33
+
34
+ + table.oldernews thead { background-color: #66a0e0; }
35
+
36
+ table.oldernews tbody th { border: 1px #c9c9c9 solid; }
37
+
@@ -0,0 +1,40 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
3
+ <channel>
4
+ <title>Changes to OtherPage</title>
5
+ <description/>
6
+ <link>http://localhost:3000/en-us</link>
7
+ <language>en-us</language>
8
+ <generator>Motiro</generator>
9
+ <pubDate>Wed, 04 Jul 2007 00:14:13 -0300</pubDate>
10
+ <ttl>60</ttl>
11
+ <item>
12
+ <title>Another page</title>
13
+ <description>&lt;p&gt;This is the modified English version.&lt;/p&gt;&lt;p&gt;And I have modified it once more, but that version was not recorded.&lt;/p&gt;</description>
14
+ <pubDate>Wed, 04 Jul 2007 00:14:13 -0300</pubDate>
15
+ <dc:creator>thiagoarrais</dc:creator>
16
+ <guid>http://localhost:3000/wiki/show/OtherPage?revision=4</guid>
17
+ </item>
18
+ <item>
19
+ <title>Another page</title>
20
+ <description>&lt;p&gt;This is the modified English version.&lt;/p&gt;&lt;p&gt;And I have modified it once more&lt;/p&gt;</description>
21
+ <pubDate>Thu, 14 Jun 2007 00:48:09 -0300</pubDate>
22
+ <dc:creator>thiagoarrais</dc:creator>
23
+ <guid>http://localhost:3000/wiki/show/OtherPage?revision=3</guid>
24
+ </item>
25
+ <item>
26
+ <title>Another page</title>
27
+ <description>&lt;p&gt;This is the modified English version&lt;/p&gt;</description>
28
+ <pubDate>Thu, 14 Jun 2007 00:47:45 -0300</pubDate>
29
+ <dc:creator>thiagoarrais</dc:creator>
30
+ <guid>http://localhost:3000/wiki/show/OtherPage?revision=2</guid>
31
+ </item>
32
+ <item>
33
+ <title>Another page</title>
34
+ <description>&lt;p&gt;This is the English version&lt;/p&gt;</description>
35
+ <pubDate>Wed, 13 Jun 2007 21:37:54 -0300</pubDate>
36
+ <dc:creator>thiagoarrais</dc:creator>
37
+ <guid>http://localhost:3000/wiki/show/OtherPage?revision=1</guid>
38
+ </item>
39
+ </channel>
40
+ </rss>
@@ -59,5 +59,5 @@ changed_page:
59
59
  multilanguage_page:
60
60
  id: 12
61
61
  name: MultiLanguagePage
62
- kind: common
62
+ kind: feature
63
63
  modified_at: 2007-06-14 12:06:38
@@ -137,11 +137,11 @@ release_event_creation:
137
137
  first_multilanguage_revision:
138
138
  id: 15
139
139
  page_id: 12
140
- kind: common
140
+ kind: feature
141
141
  modified_at: 2007-06-14 12:03:24
142
142
  last_editor_id: 1000004 #john
143
143
  editors: ""
144
- title: Multi-language page
144
+ title: Translated page
145
145
  text: This is the first English version
146
146
 
147
147
  Here is some '''bold''' text.
@@ -155,11 +155,11 @@ first_multilanguage_revision:
155
155
  second_multilanguage_revision:
156
156
  id: 16
157
157
  page_id: 12
158
- kind: common
158
+ kind: feature
159
159
  modified_at: 2007-06-14 12:06:38
160
160
  last_editor_id: 1000004 #john
161
161
  editors: ""
162
- title: Multi-language page
162
+ title: Translated page
163
163
  text: This is the second English version
164
164
 
165
165
  Here is some '''bold''' text.
@@ -169,3 +169,14 @@ second_multilanguage_revision:
169
169
  Esta é a segunda versão em português
170
170
 
171
171
  Aqui está um pouco de texto em '''negrito'''.
172
+
173
+ second_page_edition:
174
+ id: 17
175
+ page_id: 11
176
+ kind: common
177
+ modified_at: 2007-07-13 11:33:41
178
+ last_editor_id: 1000005 #eric
179
+ editors: ""
180
+ title: This page has been edited since creation
181
+ text: Eric changed the text that John entered. Twice.
182
+ position: 3
@@ -16,13 +16,14 @@
16
16
  # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
18
  require File.dirname(__FILE__) + '/../test_helper'
19
+ require 'report_controller'
19
20
 
20
21
  # Re-raise errors caught by the controller.
21
22
  class ReportController; def rescue_action(e) raise e end; end
22
23
 
23
24
  class ReportFeaturesTest < Test::Unit::TestCase
24
25
 
25
- fixtures :pages
26
+ fixtures :pages, :revisions
26
27
 
27
28
  def setup
28
29
  @controller = ReportController.new
@@ -35,4 +36,9 @@ class ReportFeaturesTest < Test::Unit::TestCase
35
36
  assert_xml_element "//link[text() = 'http://test.host/wiki/show/ListLastModifiedFeatures']"
36
37
  end
37
38
 
39
+ def test_shows_title_for_second_language
40
+ get :older, :reporter => 'features', :locale => 'pt-br'
41
+ assert_tag :content => /Translated page/
42
+ end
43
+
38
44
  end
@@ -17,7 +17,7 @@ class RootControllerTest < Test::Unit::TestCase
17
17
  def test_version_number
18
18
  get :index, :locale => 'en'
19
19
 
20
- assert_tag :content => /Motiro version 0.6.6/
20
+ assert_tag :content => /Motiro version 0.6.7/
21
21
  end
22
22
 
23
23
 
@@ -298,8 +298,7 @@ class WikiControllerTest < Test::Unit::TestCase
298
298
  assert_tag :tag => 'a', :attributes => {
299
299
  :href => @controller.url_for(
300
300
  :controller => 'wiki', :action => 'show',
301
- :page_name => 'RevisedPage', :revision => '1')},
302
- :content => /The title will be changed/
301
+ :page_name => 'RevisedPage', :revision => '1')}
303
302
  assert_tag :content => /The title was changed/
304
303
 
305
304
  get :show, :page_name => 'RevisedPage', :revision => '1'
@@ -326,9 +325,10 @@ class WikiControllerTest < Test::Unit::TestCase
326
325
  end
327
326
 
328
327
  def tests_shows_number_of_available_revisions
329
- get :show, :page_name => pages('changed_page').name
328
+ page = pages('changed_page')
329
+ get :show, :page_name => page.name
330
330
 
331
- assert_tag :content => 'Page history (2 revisions)'
331
+ assert_tag :content => "Page history (#{page.revisions.size} revisions)"
332
332
  end
333
333
 
334
334
  def test_does_not_show_page_history_link_for_missing_or_edited_once_pages
@@ -363,6 +363,46 @@ class WikiControllerTest < Test::Unit::TestCase
363
363
  assert_xml_element "//item/guid[text() = '#{@controller.url_for(:action => 'show', :page_name => page_name, :revision => '2')}'']"
364
364
  assert_xml_element "//item/guid[text() = '#{@controller.url_for(:action => 'show', :page_name => page_name, :revision => '1')}'']"
365
365
  end
366
+
367
+ def test_redirects_ugly_urls_to_pretty_ones
368
+ page_name = pages('changed_page').name
369
+ get :diff, :page_name => page_name, :btnCompare => 'Compare revisions',
370
+ :new_revision => 2, :old_revision=> 1
371
+
372
+ assert_redirected_to "/wiki/diff/#{page_name}/1/2"
373
+ follow_redirect
374
+
375
+ assert assigns(:old_revision)
376
+ end
377
+
378
+ def test_shows_error_message_when_unable_to_find_specified_revision
379
+ page = pages('changed_page')
380
+ n = page.revisions.size
381
+ get :diff, :page_name => page.name, :new_revision => n,
382
+ :old_revision => n + 1
383
+
384
+ assert_redirected_to :controller => 'wiki', :action => 'show',
385
+ :page_name => page.name
386
+ assert_equal "#{page.name} has no revision #{n + 1}", flash[:notice]
387
+
388
+ get :diff, :page_name => page.name,
389
+ :new_revision => n + 3, :old_revision => n
390
+
391
+ assert_redirected_to :controller => 'wiki', :action => 'show',
392
+ :page_name => page.name
393
+ assert_equal "#{page.name} has no revision #{n + 3}", flash[:notice]
394
+ end
395
+
396
+ def test_defaults_to_last_revision_diff
397
+ page = pages('changed_page')
398
+ n = page.revisions.size
399
+ get :history, :page_name => page.name
400
+
401
+ assert_xml_element "//input[@type='radio' and @name='old_revision' and @value='#{n - 1}' and @checked='checked']"
402
+ assert_xml_element "//input[@type='radio' and @name='new_revision' and @value='#{n}' and @checked='checked']"
403
+ assert_no_xml_element "//input[@name='old_revision' and @value!='#{n - 1}' and @checked='checked']"
404
+ assert_no_xml_element "//input[@name='new_revision' and @value!='#{n}' and @checked='checked']"
405
+ end
366
406
 
367
407
  private
368
408
 
@@ -19,41 +19,46 @@ require File.dirname(__FILE__) + '/../test_helper'
19
19
 
20
20
  class ChangeTest < Test::Unit::TestCase
21
21
 
22
- def test_render_diff_with_unset_diff
23
- change = Change.new(:summary => 'A /directory', :diff => nil)
24
-
25
- assert_equal '', change.render_diff
22
+ def test_unset_diff
23
+ assert_nil Change.new(:summary => 'A /directory', :diff => nil).chunked_diff
26
24
  end
27
25
 
28
- def test_render_diff_with_empty_diff
29
- change = Change.new(:summary => 'A /directory', :diff => '')
30
-
31
- assert_equal '', change.render_diff
26
+ def test_empty_diff
27
+ assert_nil Change.new(:summary => 'A /directory', :diff => '').chunked_diff
32
28
  end
33
29
 
34
- def test_render_diff_with_non_empty_diff
30
+ def test_parses_addition_only
35
31
  diff_output = "@@ -0,0 +1 @@\n" +
36
32
  "+These are the file_contents"
37
33
  change = Change.new(:summary => 'A /a_file.txt', :diff => diff_output)
38
-
39
- actual_rendered_output = change.render_diff
40
-
41
- md = actual_rendered_output.match /\A<div id='((\w|\d|-)+)' class='diff-window'><center><h2>Changes to a_file.txt<\/h2>/
42
-
43
- assert_not_nil md
44
-
45
- remain = md.post_match
46
-
47
- md = remain.match /<\/div>\Z/
48
-
49
- assert_not_nil md
34
+ #
35
+ # actual_rendered_output = change.render_diff
36
+ #
37
+ # md = actual_rendered_output.match /\A<div id='((\w|\d|-)+)' class='diff-window'><center><h2>Changes to a_file.txt<\/h2>/
38
+ #
39
+ # assert_not_nil md
40
+ #
41
+ # remain = md.post_match
42
+ #
43
+ # md = remain.match /<\/div>\Z/
44
+ #
45
+ # assert_not_nil md
46
+ chunks = change.chunked_diff
47
+
48
+ assert_equal 1, chunks.size
49
+ assert_equal :addition, chunks.first.action
50
+ assert_equal 1, chunks.first.lines.size
51
+ line = chunks.first.lines.first
52
+ assert_nil line.original_position
53
+ assert_nil line.original_text
54
+ assert_equal 1, line.modified_position
55
+ assert_equal 'These are the file_contents', line.modified_text
50
56
  end
51
57
 
52
58
  def test_passes_lines_numbers_to_differ
53
59
  FlexMock.use do |differ|
54
60
  differ.should_receive(:start_line).once.with(22, 34)
55
- differ.should_receive(:render_diff_table).once.
56
- and_return('rendered table')
61
+ differ.should_receive(:get_chunks).once.and_return('chunked diffs')
57
62
  differ.should_ignore_missing
58
63
 
59
64
  change = Change.new(:summary => 'A /a_file.txt',
@@ -61,42 +66,10 @@ class ChangeTest < Test::Unit::TestCase
61
66
  "+These are the file_contents")
62
67
 
63
68
  change.use_differ(differ)
64
- assert_equal 'rendered table', change.render_diff_table
69
+ assert_equal 'chunked diffs', change.chunked_diff
65
70
  end
66
71
  end
67
72
 
68
- def test_render_summary_with_unset_diff
69
- change = Change.new(:summary => 'A /directory', :diff => nil)
70
-
71
- assert_equal 'A /directory', change.render_summary
72
- end
73
-
74
- def test_render_summary_with_non_empty_diff
75
- diff_output = "@@ -0,0 +1 @@\n" +
76
- "+These are the file_contents"
77
- change = Change.new(:summary => 'A /a_file.txt', :diff => diff_output)
78
-
79
- actual_rendered_output = change.render_summary
80
-
81
- md = actual_rendered_output.match /\A<a href='\#' onClick="showOnly\('((\w|\d|-)+)'\)">A \/a_file.txt<\/a>\Z/
82
-
83
- assert_not_nil md
84
- end
85
-
86
- def test_renders_summary_and_diff_using_the_same_ref
87
- diff_output = "@@ -0,0 +1 @@\n" +
88
- "+These are the file_contents"
89
- change = Change.new(:summary => 'A /a_file.txt', :diff => diff_output)
90
-
91
- md = change.render_summary.match /\A<a href='\#' onClick="showOnly\('((\w|\d|-)+)'\)/
92
- summary_ref = md[1]
93
-
94
- md = change.render_diff.match /\A<div id='((\w|\d|-)+)'/
95
- diff_ref = md[1]
96
-
97
- assert_equal summary_ref, diff_ref
98
- end
99
-
100
73
  def test_simple_prefixed_qualified_resource_name
101
74
  change = Change.new(:summary => 'A /a_file.txt')
102
75
  assert_equal '/a_file.txt', change.qualified_resource_name