motiro 0.6.4 → 0.6.5

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.
data/README CHANGED
@@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License
15
15
  along with this program; if not, write to the Free Software
16
16
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
17
  --------------------------------------------------------------------------------
18
- Motiro version 0.6.4 - April 2007
18
+ Motiro version 0.6.5 - May 2007
19
19
 
20
20
  Please refer to your preferred language README. Every text file below this
21
21
  directory is UTF-8 encoded. Please make sure to set up your reader accordingly.
@@ -20,7 +20,7 @@ class WikiController < ApplicationController
20
20
  layout :choose_layout
21
21
 
22
22
  before_filter :login_required, :except => [:show, :last, :history]
23
- before_filter :fetch_page, :drop_crumbs
23
+ before_filter :fetch_page, :fetch_revision
24
24
  before_filter :check_edit_access, :only => [:edit, :save]
25
25
 
26
26
  cache_sweeper :page_sweeper, :only => [:edit, :save]
@@ -42,18 +42,25 @@ class WikiController < ApplicationController
42
42
  end
43
43
 
44
44
  def fetch_page
45
- type = params[:page] ? params[:page][:type] : nil
46
- @page = find_page(params[:page_name], type)
47
- end
48
-
49
- def drop_crumbs
45
+ @page = find_page(params[:page_name])
50
46
  unless 'common' == @page.kind
51
47
  @crumbs <<{ @page.kind.pluralize.capitalize.t =>
52
48
  {:controller => 'report', :action => 'older',
53
49
  :reporter => @page.kind.pluralize}}
54
50
  end
55
51
  @crumbs <<{ @page.title => {:controller => 'wiki', :action => 'show',
56
- :page_name => @page.name} }
52
+ :page_name => @page.name} }
53
+ end
54
+
55
+ def fetch_revision
56
+ rev = params[:revision]
57
+ unless rev.nil?
58
+ @page = @page.revisions[rev.to_i - 1]
59
+ @page_revision_id = @page.id
60
+ @crumbs << { 'Revision %s' / rev =>
61
+ { :controller => 'wiki', :action => 'show',
62
+ :page_name => @page.name, :revision => rev} }
63
+ end
57
64
  end
58
65
 
59
66
  def check_edit_access
@@ -83,13 +90,6 @@ class WikiController < ApplicationController
83
90
  end
84
91
  end
85
92
 
86
- def show
87
- if params[:revision]
88
- @page = @page.revisions[params[:revision].to_i]
89
- @page_revision_id = @page.id
90
- end
91
- end
92
-
93
93
  def access_denied
94
94
  redirect_to :controller => 'wiki', :action => 'show',
95
95
  :page_name => params[:page_name]
@@ -107,9 +107,9 @@ private
107
107
  end
108
108
  end
109
109
 
110
- def find_page(name, type)
110
+ def find_page(name)
111
111
  @real_page_provider.find_by_name(name) ||
112
- @default_page_provider.find_by_name_and_type(name, type)
112
+ @default_page_provider.find_by_name(name)
113
113
  end
114
114
 
115
115
  end
data/app/core/version.rb CHANGED
@@ -1 +1 @@
1
- MOTIRO_VERSION = '0.6.4'
1
+ MOTIRO_VERSION = '0.6.5'
@@ -39,7 +39,7 @@ class WikiReporter < MotiroReporter
39
39
  klass.add(button_for_creating(klass.reporter_name.chop))
40
40
  end
41
41
 
42
- def latest_headlines
42
+ def latest_headlines(rid='')
43
43
  to_headlines @page_provider.find(:all, find_opts.merge(
44
44
  :limit => @settings.package_size))
45
45
  end
@@ -36,7 +36,7 @@ module ApplicationHelper
36
36
  :action => script_name) })
37
37
  end
38
38
 
39
- def pagetext(title, &block)
39
+ def pagetext(title, revision=nil, &block)
40
40
  content = capture(&block)
41
41
  b = Builder::XmlMarkup.new
42
42
  xml = b.div(:class => 'pagetext') do
@@ -51,7 +51,11 @@ module ApplicationHelper
51
51
  b.a(last.keys.first,
52
52
  :href => url_for(last.values.first.update(:only_path => true)))
53
53
  end unless params[:context] == 'partial'
54
- b.h1(title)
54
+ b.div(:class => 'page-title') do
55
+ b.span(title, :class => 'page-title')
56
+ b << ' '
57
+ b.span(revision, :id => 'revision') unless revision.nil?
58
+ end
55
59
  b << content
56
60
  end
57
61
  concat(xml, block.binding)
@@ -17,10 +17,8 @@
17
17
 
18
18
  class DefaultPageProvider
19
19
 
20
- def find_by_name_and_type(name, type)
21
- class_name = type || 'Page'
22
- page = class_name.constantize.new(:name => name)
23
- return page
20
+ def find_by_name(name)
21
+ Page.new(:name => name)
24
22
  end
25
23
 
26
24
  end
@@ -1,3 +1,13 @@
1
1
  module WikiHelper
2
2
 
3
+ def page_history_link(page)
4
+ case page.revisions.size
5
+ when 0 then ''
6
+ when 1 then '| ' + 'Page has no history yet'.t
7
+ else '| ' + link_to('Page history (%d revisions)' / page.revisions.size,
8
+ :controller => 'wiki', :action => 'history',
9
+ :page_name => page.name)
10
+ end
11
+ end
12
+
3
13
  end
data/app/models/page.rb CHANGED
@@ -19,7 +19,7 @@ PLACE_HOLDER_TITLE = 'Insert page title here'
19
19
 
20
20
  class Page < ActiveRecord::Base
21
21
 
22
- has_many :revisions, :order => 'modified_at DESC, id DESC'
22
+ has_many :revisions, :order => 'modified_at, id'
23
23
 
24
24
  def original_author
25
25
  oldest(:last_editor)
@@ -60,9 +60,10 @@ class Page < ActiveRecord::Base
60
60
 
61
61
  def before_save
62
62
  if title == PLACE_HOLDER_TITLE.t
63
- revisions.first.title = title_from_kind
63
+ revisions.last.title = title_from_kind
64
64
  end
65
65
 
66
+ write_attribute(:modified_at, self.modified_at)
66
67
  write_attribute(:name, self.name)
67
68
  end
68
69
 
@@ -85,20 +86,21 @@ class Page < ActiveRecord::Base
85
86
  attrs['happens_at(3i)'].to_i)
86
87
  end
87
88
  unless revisions.size == 0 || original_author
88
- revisions.last.last_editor = author
89
- revisions.last.save
89
+ revisions.first.last_editor = author
90
+ revisions.first.save
90
91
  end
91
- rev = Revision.new(:last_editor => author, :modified_at => time)
92
+ rev = Revision.new(:last_editor => author, :modified_at => time,
93
+ :position => self.revisions.size + 1)
92
94
  rev.editors = if author.can_change_editors?(self)
93
95
  attrs[:editors]
94
96
  else
95
- revisions.first.editors
97
+ revisions.last.editors
96
98
  end
97
99
  self.kind = attrs[:kind] if attrs[:kind]
98
100
  self.happens_at = attrs[:happens_at] if attrs[:happens_at]
99
101
  rev.kind, rev.happens_at = self.kind, self.happens_at
100
102
  rev.title, rev.text = attrs[:title], attrs[:text]
101
- self.revisions.unshift(rev)
103
+ self.revisions << rev
102
104
 
103
105
  save
104
106
  self
@@ -131,15 +133,13 @@ private
131
133
  end
132
134
 
133
135
  def most_recent(attr)
134
- revisions.first && revisions.first.send(attr)
136
+ revisions.last && revisions.last.send(attr)
135
137
  end
136
138
 
137
139
  def oldest(attr)
138
- revisions.last && revisions.last.send(attr)
140
+ revisions.first && revisions.first.send(attr)
139
141
  end
140
142
 
141
- private
142
-
143
143
  def clean(text)
144
144
  text.tr('ãàáâäÃÀÁÂÄèéêëÈÉÊËĩìíîïĨÌÍÎÏÿýÝŸõòóôöÕÒÓÔÖũùúûüŨÙÚÛÜñńÑŃćçÇĆśŕ埌ŔĹŹ',
145
145
  'aaaaaAAAAAeeeeEEEEiiiiiIIIIIyyYYoooooOOOOOuuuuuUUUUUnnNNccCCsrlzSRLZ')
@@ -18,9 +18,9 @@
18
18
  class Revision < ActiveRecord::Base
19
19
  belongs_to :page
20
20
  belongs_to :last_editor, :class_name => 'User', :foreign_key => 'last_editor_id'
21
-
21
+
22
22
  #Delegate methods to parent page
23
- %w{name original_author}.each do |method|
23
+ %w{name original_author revisions}.each do |method|
24
24
  define_method(method) { page.send(method) }
25
25
  end
26
26
 
@@ -27,7 +27,7 @@ class DarcsReporter < MotiroReporter
27
27
  @connection = conn
28
28
  end
29
29
 
30
- def latest_headlines
30
+ def latest_headlines(rid='')
31
31
  @connection.pull
32
32
  parse_headlines(@connection.changes)
33
33
  end
@@ -23,7 +23,5 @@
23
23
  :action => 'edit',
24
24
  :page_name => @page.name } )%>
25
25
  <% end %>
26
- |
27
- <%= link_to('Page history'.t, :controller => 'wiki', :action => 'history',
28
- :page_name => @page.name) -%>
26
+ <%= page_history_link(@page) -%>
29
27
  </div>
@@ -9,9 +9,8 @@
9
9
  </tr>
10
10
  </thead>
11
11
  <tbody>
12
- <% i = 0 %>
13
- <% @page.revisions.each do |rev| %>
14
- <tr class="<%= i % 2 == 0 ? 'odd' : 'even' -%>">
12
+ <% @page.revisions.reverse.each do |rev| %>
13
+ <tr class="<%= rev.position % 2 == 0 ? 'odd' : 'even' -%>">
15
14
  <td class="date"><%= rev.modified_at-%></td>
16
15
  <td class="relative"><%= rev.modified_at.relative_to_now %></td>
17
16
  <td><%= rev.last_editor.login %></td>
@@ -19,9 +18,8 @@
19
18
  :href => server_url_for(:controller => 'wiki',
20
19
  :action => 'show',
21
20
  :page_name => @page.name,
22
- :revision => i) -%></td>
21
+ :revision => rev.position) -%></td>
23
22
  </tr>
24
- <% i += 1 %>
25
23
  <% end %>
26
24
  </tbody>
27
25
  </table>
@@ -1,4 +1,4 @@
1
- <% pagetext(@page.title) do %>
1
+ <% pagetext(@page.title, @page.respond_to?(:position) ? '(Revision %s)' / @page.position.to_s : nil) do %>
2
2
  <% cache(:controller=> 'wiki', :action => 'show',
3
3
  :page => @page.name, :locale_suffix => @locale,
4
4
  :revision => @page_revision_id) do %>
data/config/motiro.yml CHANGED
@@ -1,3 +1,8 @@
1
+ # motiro.yml: Configuration for your Motiro installation
2
+ #
3
+ # This is an YAML file, so leading whitespace does make a difference. Please
4
+ # make sure to KEEP THE EXISTING WHITESPACE when uncommenting lines.
5
+
1
6
  # package_size
2
7
  #
3
8
  # How many headlines should be shown for each reporter?
@@ -20,24 +25,24 @@ update_interval: 40
20
25
  # Subversion specific settings
21
26
  subversion:
22
27
 
23
- # subversion/repo
24
- #
25
- # Tells the reporter where to find your project's repository
26
- # Default: https://svn.sourceforge.net/svnroot/motiro
28
+ # subversion/repo
29
+ #
30
+ # Tells the reporter where to find your project's repository
31
+ # Default: https://svn.sourceforge.net/svnroot/motiro
27
32
  repo: https://svn.sourceforge.net/svnroot/motiro
28
33
 
29
- # subversion/{user,password}
30
- #
31
- # Credentials to use for authentication with Subversion server. Uncomment and set
32
- # them only if your server requires authorization for read access. Motiro's
33
- # doesn't so they are commented out here.
34
- # user: harry
35
- # password: harryssecret
34
+ # subversion/{user,password}
35
+ #
36
+ # Credentials to use for authentication with Subversion server. Uncomment and
37
+ # set them only if your server requires authorization for read access.
38
+ # Motiro's doesn't, so they are commented out here.
39
+ # user: harry
40
+ # password: harryssecret
36
41
 
37
42
  # Darcs specific settings
38
43
  # Uncomment the lines below to activate darcs reporting
39
44
  # darcs:
40
45
 
41
- # darcs/repo
42
- # Tells the reporter where to find the project's central repository
43
- # repo: http://motiro.sf.net/darcsrepos/trunk
46
+ # darcs/repo
47
+ # Tells the reporter where to find the project's central repository
48
+ # repo: http://motiro.sf.net/darcsrepos/trunk
@@ -0,0 +1,11 @@
1
+ class FixModificationDatesForOldPages < ActiveRecord::Migration
2
+
3
+ def self.up
4
+ Page.find(:all).each do |page|
5
+ page.save
6
+ end
7
+ end
8
+
9
+ def self.down; end
10
+
11
+ end
@@ -0,0 +1,11 @@
1
+ class DropTypeColumnFromPagesTable < ActiveRecord::Migration
2
+
3
+ def self.up
4
+ remove_column :pages, :type
5
+ end
6
+
7
+ def self.down;
8
+ raise IrreversibleMigration
9
+ end
10
+
11
+ end
@@ -0,0 +1,19 @@
1
+ class ProvideRevisionPosition < ActiveRecord::Migration
2
+
3
+ def self.up
4
+ add_column :revisions, :position, :integer
5
+ Page.find(:all).each do |pg|
6
+ position = 0
7
+ pg.revisions.each do |rev|
8
+ rev.position = position
9
+ rev.save
10
+ position += 1
11
+ end
12
+ end
13
+ end
14
+
15
+ def self.down;
16
+ remove_column :revisions, :position
17
+ end
18
+
19
+ end
@@ -0,0 +1,11 @@
1
+ class IncrementRevisionPositions < ActiveRecord::Migration
2
+
3
+ def self.up
4
+ execute('UPDATE revisions SET position = position + 1')
5
+ end
6
+
7
+ def self.down;
8
+ execute('UPDATE revisions SET position = position - 1')
9
+ end
10
+
11
+ end
Binary file
data/db/schema_version CHANGED
@@ -1 +1 @@
1
- 19
1
+ 23
@@ -74,5 +74,6 @@
74
74
  # Older headlines and history pages
75
75
  'Author' => 'Autor',
76
76
  'Page history for %s' => 'Histórico da página %s',
77
- 'Page history' => 'Histórico da página'
77
+ 'Page history' => 'Histórico da página',
78
+ '(Revision %s)' => '(Revisão %s)'
78
79
  }
@@ -54,11 +54,26 @@ div.channel div.pagetext, div.pagetext div.pagetext {
54
54
 
55
55
  div#crumbs {
56
56
  border-bottom: solid #d0d0d0 1px;
57
- margin-bottom: -1em;
58
57
  padding: .2em 0 .2em 0;
59
58
  color: #808080
60
59
  }
61
60
 
61
+ div.page-title {
62
+ margin-top: .4em;
63
+ margin-bottom: 1em;
64
+ }
65
+
66
+ span.page-title {
67
+ font-size: 2em;
68
+ font-weight: bold;
69
+ }
70
+
71
+ span#revision {
72
+ color: #808080;
73
+ font-size: 1em;
74
+ white-space: nowrap;
75
+ }
76
+
62
77
  #mainpage {
63
78
  margin: 4px 332px 4px 0;
64
79
  }
@@ -57,7 +57,7 @@ class SubversionAcceptanceTest < SeleniumTestCase
57
57
  wait_for_page_to_load(2000)
58
58
 
59
59
  assert_equal "Revision details - #{commit_title} (Motiro)", get_title
60
- assert_element_present "//h1[text() = 'Revision r1']"
60
+ assert_element_present "//span[@class='page-title' and text() = 'Revision r1']"
61
61
  assert_text_present commit_title
62
62
  assert_text_present 'This project dir will hold everything needed to build and'
63
63
  assert_text_present 'deploy our project from source code'
@@ -47,7 +47,6 @@ release_event:
47
47
  kind: event
48
48
  name: FourteenthRelease
49
49
  kind: event
50
- type: Event
51
50
  happens_at: 2007-01-24
52
51
  modified_at: 2007-01-18 13:28:47
53
52
 
@@ -7,6 +7,7 @@ page_creation:
7
7
  editors: ""
8
8
  title: This page has been created
9
9
  text: John entered some text here
10
+ position: 1
10
11
 
11
12
  page_edition:
12
13
  id: 2
@@ -17,6 +18,7 @@ page_edition:
17
18
  editors: ""
18
19
  title: This page has been edited since creation
19
20
  text: Eric changed the text that John entered
21
+ position: 2
20
22
 
21
23
  main_page_creation:
22
24
  id: 3
@@ -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.4/
20
+ assert_tag :content => /Motiro version 0.6.5/
21
21
  end
22
22
 
23
23
 
@@ -174,13 +174,15 @@ class WikiControllerTest < Test::Unit::TestCase
174
174
  :value => 'Brand new page' }
175
175
  end
176
176
 
177
- def test_shows_page_title_as_level_one_header
177
+ def test_shows_page_title_with_page_title_class
178
178
  non_matching_title_page = pages('non_matching_title_page')
179
179
  get :show, :page_name => pages('test_page').name
180
- assert_tag :tag => 'h1', :content => 'Test page'
181
-
180
+ assert_tag :tag => 'span', :content => 'Test page',
181
+ :attributes => { :class => 'page-title' }
182
+
182
183
  get :show, :page_name => non_matching_title_page.name
183
- assert_tag :tag => 'h1', :content => non_matching_title_page.title
184
+ assert_tag :tag => 'span', :content => non_matching_title_page.title,
185
+ :attributes => { :class => 'page-title' }
184
186
  end
185
187
 
186
188
  def test_saves_last_editor_and_modification_date
@@ -255,6 +257,13 @@ class WikiControllerTest < Test::Unit::TestCase
255
257
  assert_xml_element "//div[@id = 'crumbs']/a[@href = '/wiki/show/#{test_page.name}' and text() = '#{test_page.title}']"
256
258
  end
257
259
 
260
+ def test_follows_breadcrumbs_trail_til_the_revision_number
261
+ page = pages('changed_page')
262
+ get :show, :page_name => page.name, :revision => '1'
263
+
264
+ assert_xml_element "//div[@id = 'crumbs']/a[@href = '/wiki/show/#{page.name}?revision=1' and text() = 'Revision 1']"
265
+ end
266
+
258
267
  def test_shows_breadcrumbs_trail_for_special_wiki_pages
259
268
  release_event = pages('release_event')
260
269
  get :show, :page_name => release_event.name
@@ -293,24 +302,50 @@ class WikiControllerTest < Test::Unit::TestCase
293
302
  get :show, :page_name => 'RevisedPage', :revision => '1'
294
303
  assert_tag :content => /Some very boring text/
295
304
 
296
- get :show, :page_name => 'RevisedPage', :revision => '0'
305
+ get :show, :page_name => 'RevisedPage', :revision => '2'
297
306
  assert_tag :content => /A little more exciting text/
298
307
  end
299
308
 
300
309
  def test_displays_old_text_when_showing_revisions
301
- get :show, :page_name => pages('changed_page').name, :revision => '0'
310
+ get :show, :page_name => pages('changed_page').name, :revision => '1'
311
+ assert_tag :content => revisions('page_creation').text
312
+
313
+ get :show, :page_name => pages('changed_page').name, :revision => '2'
302
314
  assert_tag :content => revisions('page_edition').text
315
+ end
303
316
 
317
+ def test_shows_version_number_for_page_revisions
304
318
  get :show, :page_name => pages('changed_page').name, :revision => '1'
305
- assert_tag :content => revisions('page_creation').text
319
+ assert_tag :content => '(Revision 1)'
320
+
321
+ get :show, :page_name => pages('changed_page').name, :revision => '2'
322
+ assert_tag :content => '(Revision 2)'
306
323
  end
307
-
324
+
325
+ def tests_shows_number_of_available_revisions
326
+ get :show, :page_name => pages('changed_page').name
327
+
328
+ assert_tag :content => 'Page history (2 revisions)'
329
+ end
330
+
331
+ def test_does_not_show_page_history_link_for_missing_or_edited_once_pages
332
+ get :show, :page_name => pages('test_page').name
333
+
334
+ assert_no_tag :content => 'Page history (1 revisions)'
335
+ assert_tag :content => /Page has no history yet/
336
+
337
+ get :show, :page_name => 'TestingBrandNewPage'
338
+
339
+ assert_no_tag :content => 'Page history (1 revisions)'
340
+ assert_no_tag :content => /Page has no history yet/
341
+ end
342
+
308
343
  private
309
344
 
310
345
  def log_as(user_name)
311
346
  @request.session[:user] = users(user_name)
312
347
  end
313
-
348
+
314
349
  def log_out
315
350
  @request.session[:user] = nil
316
351
  end
@@ -71,7 +71,7 @@ class DarcsReporterTest < Test::Unit::TestCase
71
71
  def test_empty_change_log
72
72
  @darcs_changes = P_EMPTY
73
73
 
74
- hls = @reporter.latest_headlines
74
+ hls = @reporter.latest_headlines('')
75
75
 
76
76
  assert_equal 0, hls.size
77
77
  end
@@ -23,22 +23,13 @@ class DefaultPageProviderTest < Test::Unit::TestCase
23
23
  @provider = DefaultPageProvider.new
24
24
  end
25
25
 
26
- def test_nil_type_creates_common_page
27
- assert_equal Page, @provider.find_by_name_and_type('MainPage', nil).class
28
- end
29
-
30
- def test_event_type_creates_event_page
31
- klass = @provider.find_by_name_and_type('MainPage', 'Event').class
32
- assert_equal Event, klass
33
- end
34
-
35
26
  def test_provides_congratulations_page_for_main_page
36
- page_text = @provider.find_by_name_and_type('MainPage', nil).text
27
+ page_text = @provider.find_by_name('MainPage').text
37
28
  assert page_text.match(/Congratulations/)
38
29
  end
39
30
 
40
31
  def test_provides_you_can_edit_this_page_for_random_pages
41
- page_text = @provider.find_by_name_and_type('AnyPage', nil).text
32
+ page_text = @provider.find_by_name('AnyPage').text
42
33
  assert page_text.match(/nothing to be read here/)
43
34
  assert page_text.match(/But you can write something right now/)
44
35
  end
@@ -191,8 +191,8 @@ class PageTest < Test::Unit::TestCase
191
191
  :editors => '')
192
192
 
193
193
  assert_equal 2, page.revisions.size
194
- assert_equal 'Page revision number 2', page.revisions.first.text
195
- assert_equal 'Page revision number 1', page.revisions.last.text
194
+ assert_equal 'Page revision number 2', page.revisions.last.text
195
+ assert_equal 'Page revision number 1', page.revisions.first.text
196
196
  end
197
197
 
198
198
  def test_copies_previous_editors_list_when_not_provided
@@ -209,8 +209,8 @@ class PageTest < Test::Unit::TestCase
209
209
 
210
210
  def test_most_recent_revision_comes_first
211
211
  page = pages('changed_page')
212
- assert_equal revisions('page_creation'), page.revisions[1]
213
- assert_equal revisions('page_edition'), page.revisions[0]
212
+ assert_equal revisions('page_creation'), page.revisions[0]
213
+ assert_equal revisions('page_edition'), page.revisions[1]
214
214
  end
215
215
 
216
216
  def test_records_original_author_for_pages_without_author
@@ -239,8 +239,8 @@ class PageTest < Test::Unit::TestCase
239
239
  event.revise(bob, now, :happens_at => new_time)
240
240
 
241
241
  assert_equal new_time, event.happens_at
242
- assert_equal new_time, event.revisions.first.happens_at
243
- assert_equal old_time, event.revisions.last.happens_at
242
+ assert_equal new_time, event.revisions.last.happens_at
243
+ assert_equal old_time, event.revisions.first.happens_at
244
244
  end
245
245
 
246
246
  def test_rbab
@@ -252,7 +252,30 @@ class PageTest < Test::Unit::TestCase
252
252
  assert_equal date, page.happens_at
253
253
  end
254
254
 
255
- #TODO it seems that event pages do not get their happens_at attribute revised
255
+ def test_writes_modification_time_to_own_table_too
256
+ written_page = revise_brand_new_page(:title => 'Modified page',
257
+ :kind => 'common',
258
+ :text => 'Modified now')
259
+
260
+ assert_equal now, written_page.modified_at
261
+
262
+ read_page = Page.find_by_modified_at_and_name(now, 'ModifiedPage')
263
+
264
+ assert_not_nil read_page
265
+ assert_equal written_page, read_page
266
+ end
267
+
268
+ def test_numbers_revisions
269
+ page = create_page_with_one_revision
270
+
271
+ assert_equal 1, page.revisions.size
272
+ assert_equal 1, page.revisions[0].position
273
+
274
+ page.revise(bob, now, :text => 'Modified text')
275
+
276
+ assert_equal 2, page.revisions.size
277
+ assert_equal 2, page.revisions[1].position
278
+ end
256
279
 
257
280
  private
258
281