Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

list order test

  • Loading branch information...
commit 75e7f1a077cdd17ceeaaeec00ab4655a673f3900 1 parent f5aed1c
@ruseel authored
Showing with 14 additions and 14 deletions.
  1. +14 −14 test/unit/topic_test.rb
View
28 test/unit/topic_test.rb
@@ -33,18 +33,18 @@ def admin
assert_equal one.boardish.inc_at_depth(0), two.boardish
end
- # test "list_order" do
- # one=Topic.create(subject: "one", body: "one")
- # two=Topic.create(subject: "two", body: "two")
- # one_one=Topic.create(subject: "one_one", body: "one_one", parent: one)
- # two_one=Topic.create(subject: "two_one", body: "two_one", parent: two)
- #
- # subjects = Topic.order("boardish desc").map(&:subject)
- #
- # assert_equal Boardish.from_array([1, 7, 7]), two.boardish
- # assert_equal Boardish.from_array([0, 7, 7]), one.boardish
- # assert_equal Boardish.from_array([0, 6, 7]), one_one.boardish
- #
- # assert_equal ["two", "two_one", "one", "one_one"], subjects
- # end
+ test "list_order" do
+ one=Topic.create(subject: "one", body: "one")
+ two=Topic.create(subject: "two", body: "two")
+ one_one=Topic.create(subject: "one_one", body: "one_one", parent: one)
+ two_one=Topic.create(subject: "two_one", body: "two_one", parent: two)
+
+ subjects = Topic.order("boardish desc").map(&:subject)
+
+ assert_equal Boardish.from_array([2, 7, 7]), two.boardish
+ assert_equal Boardish.from_array([1, 7, 7]), one.boardish
+ assert_equal Boardish.from_array([1, 6, 7]), one_one.boardish
+
+ assert_equal ["two", "two_one", "one", "one_one"], subjects
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.