summaryrefslogtreecommitdiff
path: root/test/models/page_test.rb
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-08-01 14:46:04 +0200
committererdgeist <erdgeist@erdgeist.org>2026-08-01 14:46:04 +0200
commit1384756b81c719f899359efc9125e80fae8614c0 (patch)
treec8141fedeb7a03f646111177585ac05321e5f981 /test/models/page_test.rb
parent52e260a4d7e3ac93c203bda716c37207d5f6cbbb (diff)
Allow aggregate to order by slug and paint chapters list more nicely
Diffstat (limited to 'test/models/page_test.rb')
-rw-r--r--test/models/page_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/models/page_test.rb b/test/models/page_test.rb
index 395b6315..b737e8b0 100644
--- a/test/models/page_test.rb
+++ b/test/models/page_test.rb
@@ -425,4 +425,17 @@ class PageTest < ActiveSupport::TestCase
425 assert_includes names, "updates/inside-post" 425 assert_includes names, "updates/inside-post"
426 assert_not_includes names, "outside-post" 426 assert_not_includes names, "outside-post"
427 end 427 end
428
429 test "an aggregate can order by node slug" do
430 parent = Node.root.children.create!(:slug => "slug_order_parent")
431 %w[zulu alpha Mike].each do |slug|
432 node = parent.children.create!(:slug => slug)
433 node.reload.draft.update!(:title => "T-#{slug}", :tag_list => "slug-order-test")
434 node.publish_draft!
435 end
436
437 names = Page.aggregate({ :tags => "slug-order-test",
438 :order_by => "slug" }).map { |p| p.node.slug }
439 assert_equal %w[alpha Mike zulu], names
440 end
428end 441end