Commit bf14f352 authored by Gregor Schmidt's avatar Gregor Schmidt Committed by Holger Just

[#537] version of new WikiContents should be 0

parent a35d61bf
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment