diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-08-01 14:46:04 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-08-01 14:46:04 +0200 |
| commit | 1384756b81c719f899359efc9125e80fae8614c0 (patch) | |
| tree | c8141fedeb7a03f646111177585ac05321e5f981 /test | |
| parent | 52e260a4d7e3ac93c203bda716c37207d5f6cbbb (diff) | |
Allow aggregate to order by slug and paint chapters list more nicely
Diffstat (limited to 'test')
| -rw-r--r-- | test/controllers/users_controller_test.rb | 4 | ||||
| -rw-r--r-- | test/models/page_test.rb | 13 |
2 files changed, 15 insertions, 2 deletions
diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb index d7d8b9a6..2dd0759a 100644 --- a/test/controllers/users_controller_test.rb +++ b/test/controllers/users_controller_test.rb | |||
| @@ -13,8 +13,8 @@ class UsersControllerTest < ActionController::TestCase | |||
| 13 | login_as :aaron | 13 | login_as :aaron |
| 14 | get :index | 14 | get :index |
| 15 | assert_response :success | 15 | assert_response :success |
| 16 | assert_select "button[type=submit]", I18n.t("users.user.deactivate") | 16 | assert_select "button[type=submit][aria-label=?]", I18n.t("users.user.deactivate") |
| 17 | assert_select "a", I18n.t("admin.common.show") | 17 | assert_select "a[aria-label=?]", I18n.t("admin.common.show") |
| 18 | end | 18 | end |
| 19 | 19 | ||
| 20 | test "get new when logged in as admin" do | 20 | test "get new when logged in as admin" do |
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 | ||
| 428 | end | 441 | end |
