@@ -1,16 +1,16 | |||
|
1 |
# |
|
|
2 |
# Copyright (C) 2006-20 |
|
|
1 | # Redmine - project management software | |
|
2 | # Copyright (C) 2006-2011 Jean-Philippe Lang | |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 |
# |
|
|
8 | # | |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 |
# |
|
|
13 | # | |
|
14 | 14 | # 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. |
@@ -24,13 +24,13 class WikiContentTest < ActiveSupport::TestCase | |||
|
24 | 24 | @wiki = Wiki.find(1) |
|
25 | 25 | @page = @wiki.pages.first |
|
26 | 26 | end |
|
27 | ||
|
27 | ||
|
28 | 28 | def test_create |
|
29 |
page = WikiPage.new(:wiki => @wiki, :title => "Page") |
|
|
29 | page = WikiPage.new(:wiki => @wiki, :title => "Page") | |
|
30 | 30 | page.content = WikiContent.new(:text => "Content text", :author => User.find(1), :comments => "My comment") |
|
31 | 31 | assert page.save |
|
32 | 32 | page.reload |
|
33 | ||
|
33 | ||
|
34 | 34 | content = page.content |
|
35 | 35 | assert_kind_of WikiContent, content |
|
36 | 36 | assert_equal 1, content.version |
@@ -40,14 +40,14 class WikiContentTest < ActiveSupport::TestCase | |||
|
40 | 40 | assert_equal User.find(1), content.author |
|
41 | 41 | assert_equal content.text, content.versions.last.text |
|
42 | 42 | end |
|
43 | ||
|
43 | ||
|
44 | 44 | def test_create_should_send_email_notification |
|
45 | 45 | Setting.notified_events = ['wiki_content_added'] |
|
46 | 46 | ActionMailer::Base.deliveries.clear |
|
47 |
page = WikiPage.new(:wiki => @wiki, :title => "A new page") |
|
|
47 | page = WikiPage.new(:wiki => @wiki, :title => "A new page") | |
|
48 | 48 | page.content = WikiContent.new(:text => "Content text", :author => User.find(1), :comments => "My comment") |
|
49 | 49 | assert page.save |
|
50 | ||
|
50 | ||
|
51 | 51 | assert_equal 1, ActionMailer::Base.deliveries.size |
|
52 | 52 | end |
|
53 | 53 | |
@@ -60,26 +60,26 class WikiContentTest < ActiveSupport::TestCase | |||
|
60 | 60 | assert_equal version_count+1, content.version |
|
61 | 61 | assert_equal version_count+1, content.versions.length |
|
62 | 62 | end |
|
63 | ||
|
63 | ||
|
64 | 64 | def test_update_should_send_email_notification |
|
65 | 65 | Setting.notified_events = ['wiki_content_updated'] |
|
66 | 66 | ActionMailer::Base.deliveries.clear |
|
67 | 67 | content = @page.content |
|
68 | 68 | content.text = "My new content" |
|
69 | 69 | assert content.save |
|
70 | ||
|
70 | ||
|
71 | 71 | assert_equal 1, ActionMailer::Base.deliveries.size |
|
72 | 72 | end |
|
73 | ||
|
73 | ||
|
74 | 74 | def test_fetch_history |
|
75 | 75 | assert !@page.content.versions.empty? |
|
76 | 76 | @page.content.versions.each do |version| |
|
77 | 77 | assert_kind_of String, version.text |
|
78 | 78 | end |
|
79 | 79 | end |
|
80 | ||
|
80 | ||
|
81 | 81 | def test_large_text_should_not_be_truncated_to_64k |
|
82 |
page = WikiPage.new(:wiki => @wiki, :title => "Big page") |
|
|
82 | page = WikiPage.new(:wiki => @wiki, :title => "Big page") | |
|
83 | 83 | page.content = WikiContent.new(:text => "a" * 500.kilobyte, :author => User.find(1)) |
|
84 | 84 | assert page.save |
|
85 | 85 | page.reload |
General Comments 0
You need to be logged in to leave comments.
Login now