##// END OF EJS Templates
Fixed test case class name (#10852)....
Jean-Philippe Lang -
r10494:881a22d24873
parent child
Show More
@@ -1,68 +1,68
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2012 Jean-Philippe Lang
2 # Copyright (C) 2006-2012 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 require File.expand_path('../../test_helper', __FILE__)
18 require File.expand_path('../../test_helper', __FILE__)
19
19
20 class WikiContentTest < ActiveSupport::TestCase
20 class WikiContentVersionTest < ActiveSupport::TestCase
21 fixtures :projects, :users, :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions
21 fixtures :projects, :users, :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions
22
22
23 def setup
23 def setup
24 end
24 end
25
25
26 def test_destroy
26 def test_destroy
27 v = WikiContent::Version.find(2)
27 v = WikiContent::Version.find(2)
28
28
29 assert_difference 'WikiContent::Version.count', -1 do
29 assert_difference 'WikiContent::Version.count', -1 do
30 v.destroy
30 v.destroy
31 end
31 end
32 end
32 end
33
33
34 def test_destroy_last_version_should_revert_content
34 def test_destroy_last_version_should_revert_content
35 v = WikiContent::Version.find(3)
35 v = WikiContent::Version.find(3)
36
36
37 assert_no_difference 'WikiPage.count' do
37 assert_no_difference 'WikiPage.count' do
38 assert_no_difference 'WikiContent.count' do
38 assert_no_difference 'WikiContent.count' do
39 assert_difference 'WikiContent::Version.count', -1 do
39 assert_difference 'WikiContent::Version.count', -1 do
40 assert v.destroy
40 assert v.destroy
41 end
41 end
42 end
42 end
43 end
43 end
44 c = WikiContent.find(1)
44 c = WikiContent.find(1)
45 v = c.versions.last
45 v = c.versions.last
46 assert_equal 2, c.version
46 assert_equal 2, c.version
47 assert_equal v.version, c.version
47 assert_equal v.version, c.version
48 assert_equal v.comments, c.comments
48 assert_equal v.comments, c.comments
49 assert_equal v.text, c.text
49 assert_equal v.text, c.text
50 assert_equal v.author, c.author
50 assert_equal v.author, c.author
51 assert_equal v.updated_on, c.updated_on
51 assert_equal v.updated_on, c.updated_on
52 end
52 end
53
53
54 def test_destroy_all_versions_should_delete_page
54 def test_destroy_all_versions_should_delete_page
55 WikiContent::Version.find(1).destroy
55 WikiContent::Version.find(1).destroy
56 WikiContent::Version.find(2).destroy
56 WikiContent::Version.find(2).destroy
57 v = WikiContent::Version.find(3)
57 v = WikiContent::Version.find(3)
58
58
59 assert_difference 'WikiPage.count', -1 do
59 assert_difference 'WikiPage.count', -1 do
60 assert_difference 'WikiContent.count', -1 do
60 assert_difference 'WikiContent.count', -1 do
61 assert_difference 'WikiContent::Version.count', -1 do
61 assert_difference 'WikiContent::Version.count', -1 do
62 assert v.destroy
62 assert v.destroy
63 end
63 end
64 end
64 end
65 end
65 end
66 assert_nil WikiPage.find_by_id(1)
66 assert_nil WikiPage.find_by_id(1)
67 end
67 end
68 end
68 end
General Comments 0
You need to be logged in to leave comments. Login now