Mercurial > hg > soundsoftware-site
comparison test/unit/wiki_page_test.rb @ 1517:dffacf8a6908 redmine-2.5
Update to Redmine SVN revision 13367 on 2.5-stable branch
author | Chris Cannam |
---|---|
date | Tue, 09 Sep 2014 09:29:00 +0100 |
parents | e248c7af89ec |
children |
comparison
equal
deleted
inserted
replaced
1516:b450a9d58aed | 1517:dffacf8a6908 |
---|---|
104 def test_destroy | 104 def test_destroy |
105 page = WikiPage.find(1) | 105 page = WikiPage.find(1) |
106 page.destroy | 106 page.destroy |
107 assert_nil WikiPage.find_by_id(1) | 107 assert_nil WikiPage.find_by_id(1) |
108 # make sure that page content and its history are deleted | 108 # make sure that page content and its history are deleted |
109 assert WikiContent.find_all_by_page_id(1).empty? | 109 assert_equal 0, WikiContent.where(:page_id => 1).count |
110 assert WikiContent.versioned_class.find_all_by_page_id(1).empty? | 110 assert_equal 0, WikiContent.versioned_class.where(:page_id => 1).count |
111 end | 111 end |
112 | 112 |
113 def test_destroy_should_not_nullify_children | 113 def test_destroy_should_not_nullify_children |
114 page = WikiPage.find(2) | 114 page = WikiPage.find(2) |
115 child_ids = page.child_ids | 115 child_ids = page.child_ids |
116 assert child_ids.any? | 116 assert child_ids.any? |
117 page.destroy | 117 page.destroy |
118 assert_nil WikiPage.find_by_id(2) | 118 assert_nil WikiPage.find_by_id(2) |
119 | 119 |
120 children = WikiPage.find_all_by_id(child_ids) | 120 children = WikiPage.where(:id => child_ids) |
121 assert_equal child_ids.size, children.size | 121 assert_equal child_ids.size, children.count |
122 children.each do |child| | 122 children.each do |child| |
123 assert_nil child.parent_id | 123 assert_nil child.parent_id |
124 end | 124 end |
125 end | 125 end |
126 | 126 |
127 def test_updated_on_eager_load | 127 def test_updated_on_eager_load |
128 page = WikiPage.with_updated_on.first(:order => 'id') | 128 page = WikiPage.with_updated_on.order('id').first |
129 assert page.is_a?(WikiPage) | 129 assert page.is_a?(WikiPage) |
130 assert_not_nil page.read_attribute(:updated_on) | 130 assert_not_nil page.read_attribute(:updated_on) |
131 assert_equal Time.gm(2007, 3, 6, 23, 10, 51), page.content.updated_on | 131 assert_equal Time.gm(2007, 3, 6, 23, 10, 51), page.content.updated_on |
132 assert_equal page.content.updated_on, page.updated_on | 132 assert_equal page.content.updated_on, page.updated_on |
133 assert_not_nil page.read_attribute(:version) | 133 assert_not_nil page.read_attribute(:version) |