[#537] version of new WikiContents should be 0
This commit is contained in:
parent
a35d61bfb7
commit
bf14f35223
|
@ -59,12 +59,7 @@ class WikiContent < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def version
|
||||
unless last_journal
|
||||
# FIXME: This is code that caters for a case that should never happen in the normal code paths!!
|
||||
create_journal
|
||||
last_journal.update_attribute(:created_at, updated_on)
|
||||
end
|
||||
last_journal.version
|
||||
new_record? ? 0 : last_journal.version
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -80,4 +80,11 @@ class WikiContentTest < ActiveSupport::TestCase
|
|||
page.reload
|
||||
assert_equal 500.kilobyte, page.content.text.size
|
||||
end
|
||||
|
||||
test "new WikiContent is version 0" do
|
||||
page = WikiPage.new(:wiki => @wiki, :title => "Page")
|
||||
page.content = WikiContent.new(:text => "Content text", :author => User.find(1), :comments => "My comment")
|
||||
|
||||
assert_equal 0, page.content.version
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue