Project

General

Profile

Defect #1071 » raise_wiki_content_size.patch

Rewritten patch from #1404 against r3182 - Thomas Lecavelier, 2009-12-18 23:52

View differences:

test/unit/wiki_content_test.rb (copie de travail)
assert_equal User.find(1), content.author
assert_equal content.text, content.versions.last.text
end
def test_very_big_create
body = "X" * 1.megabytes # 1MB of text, > 64K from naked TEXT mysql column in rails. Don't test 16MB to avoid mem starvation
page = WikiPage.new(:wiki => @wiki, :title => "Big big page")
page.content = WikiContent.new(:text => body, :author => User.find(1), :comments => "Eat that,i RDBMS")
page.save
page.reload
assert_equal body.length, WikiPage.find(page.id).content.text.length, "Wiki content truncated!"
end
def test_create_should_send_email_notification
Setting.notified_events = ['wiki_content_added']
db/migrate/20091218160716_enlarge_wiki_contents.rb (révision 0)
class EnlargeWikiContents < ActiveRecord::Migration
MAX_SIZE = 16.megabytes
def self.up
change_column :wiki_contents, :text, :text, :limit => MAX_SIZE
change_column :wiki_content_versions, :data, :binary, :limit => MAX_SIZE
end
def self.down
raise ActiveRecord::IrreversibleMigration
end
end
    (1-1/1)