summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-09-28 18:39:07 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-09-28 18:39:07 +0000
commit2d78003c87099fb6a832025027701e9456727727 (patch)
tree555f64d08425a12b2ebda16f5dea3ac41cee979f /test
parent63bc3d4f89a688681f83a49b1eb8f4d320f8ac03 (diff)
downloadredmine-2d78003c87099fb6a832025027701e9456727727.tar.gz
redmine-2d78003c87099fb6a832025027701e9456727727.zip
Replaces a piggy back query with an association for loading wiki pages updates.
git-svn-id: http://svn.redmine.org/redmine/trunk@14625 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/wiki_page_test.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/test/unit/wiki_page_test.rb b/test/unit/wiki_page_test.rb
index 68e77a2e5..5fb184175 100644
--- a/test/unit/wiki_page_test.rb
+++ b/test/unit/wiki_page_test.rb
@@ -144,13 +144,13 @@ class WikiPageTest < ActiveSupport::TestCase
end
end
- def test_updated_on_eager_load
- page = WikiPage.with_updated_on.order('id').first
- assert page.is_a?(WikiPage)
- assert_not_nil page.read_attribute(:updated_on)
- assert_equal Time.gm(2007, 3, 6, 23, 10, 51), page.content.updated_on
- assert_equal page.content.updated_on, page.updated_on
- assert_not_nil page.read_attribute(:version)
+ def test_with_updated_on_scope_should_preload_updated_on_and_version
+ page = WikiPage.with_updated_on.where(:id => 1).first
+ # make the assertions fail if attributes are not preloaded
+ WikiContent.update_all(:updated_on => '2001-01-01 10:00:00', :version => 1)
+
+ assert_equal Time.gm(2007, 3, 6, 23, 10, 51), page.updated_on
+ assert_equal 3, page.version
end
def test_descendants