active_sort_order 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/lib/active_sort_order/concerns/sort_order_concern.rb +10 -8
- data/lib/active_sort_order/version.rb +1 -1
- data/test/dummy_app/db/test.sqlite3 +0 -0
- data/test/dummy_app/log/test.log +212 -0
- data/test/unit/errors_test.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 863fc9f8899a7aea2e126c5f482b1bb8d422513c644eaf26f4f58fbc52d82f6b
|
4
|
+
data.tar.gz: 81e3205c167c100991cbb2cf80a3528e6b4c471cfa63fa652d56572d5e981867
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f222b38e5900633eb6b2925a33e58d15425848183501b8ff5ab22010ad8fcd68ab2429dbf4de6302dae3155f49026330aa6c41c95fc52b777e13e257045cb7e8
|
7
|
+
data.tar.gz: 85f20d93e24af7b65ffb9371605e18d8729c0b4e2e34d1ad7283bc51beed78016e924a77a55a081d19e90af8c8e81b38d3a010b243de67547337947a1aa88c53
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
CHANGELOG
|
2
2
|
---------
|
3
3
|
|
4
|
-
- **Unreleased - [View Diff](https://github.com/westonganger/active_sort_order/compare/v0.9.
|
4
|
+
- **Unreleased - [View Diff](https://github.com/westonganger/active_sort_order/compare/v0.9.4...master)**
|
5
|
+
* Nothing yet
|
6
|
+
|
7
|
+
- **v0.9.4 - [View Diff](https://github.com/westonganger/active_sort_order/compare/v0.9.3...v0.9.4)**
|
8
|
+
* Improve error handling for sort_col_sql argument
|
9
|
+
|
10
|
+
- **v0.9.3 - [View Diff](https://github.com/westonganger/active_sort_order/compare/v0.9.2...v0.9.3)**
|
5
11
|
* Allow ability to sort on multiple fields
|
6
12
|
|
7
13
|
- **v0.9.2 - Apr 28, 2021 - [View Diff](https://github.com/westonganger/active_sort_order/compare/v0.9.1...v0.9.2)**
|
@@ -5,13 +5,19 @@ module ActiveSortOrder
|
|
5
5
|
included do
|
6
6
|
|
7
7
|
scope :sort_order, ->(sort_col_sql = nil, sort_direction_sql = nil, base_sort_order: true){
|
8
|
-
if sort_col_sql.
|
9
|
-
|
10
|
-
|
8
|
+
if !sort_col_sql.is_a?(Array)
|
9
|
+
sort_col_sql = [sort_col_sql].compact
|
10
|
+
end
|
11
|
+
|
12
|
+
sort_col_sql.each_with_index do |x, i|
|
13
|
+
if [String, Symbol].exclude?(x.class)
|
14
|
+
raise ArgumentError.new("Invalid first argument `sort_col_sql`, expecting a String or Symbol or Array")
|
11
15
|
else
|
12
|
-
sort_col_sql =
|
16
|
+
sort_col_sql[i] = x.to_s
|
13
17
|
end
|
18
|
+
end
|
14
19
|
|
20
|
+
if sort_col_sql.present?
|
15
21
|
### SORT DIRECTION HANDLING
|
16
22
|
if sort_direction_sql.is_a?(Symbol)
|
17
23
|
sort_direction_sql = sort_direction_sql.to_s.gsub('_', ' ')
|
@@ -41,10 +47,6 @@ module ActiveSortOrder
|
|
41
47
|
end
|
42
48
|
end
|
43
49
|
|
44
|
-
if !sort_col_sql.is_a?(Array)
|
45
|
-
sort_col_sql = [sort_col_sql]
|
46
|
-
end
|
47
|
-
|
48
50
|
sql_str = sort_col_sql.map{|x| "#{x} #{sort_direction_sql}" }.join(", ")
|
49
51
|
end
|
50
52
|
|
Binary file
|
data/test/dummy_app/log/test.log
CHANGED
@@ -540,3 +540,215 @@ ActiveSortOrderTest: test_override_base_sort_order_only
|
|
540
540
|
ActiveSortOrderTest: test_exposes_main_module
|
541
541
|
---------------------------------------------
|
542
542
|
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
543
|
+
[1m[35m (1.0ms)[0m [1m[34mSELECT sqlite_version(*)[0m
|
544
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ?[0m [["key", "schema_sha1"]]
|
545
|
+
[1m[35m (0.0ms)[0m [1m[34mSELECT sqlite_version(*)[0m
|
546
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
547
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
548
|
+
[1m[36mActiveRecord::InternalMetadata Load (0.1ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ?[0m [["key", "environment"], ["LIMIT", 1]]
|
549
|
+
[1m[35m (0.9ms)[0m [1m[31mDELETE FROM posts;[0m
|
550
|
+
[1m[35m (0.7ms)[0m [1m[33mUPDATE `sqlite_sequence` SET `seq` = 0 WHERE `name` = 'posts';[0m
|
551
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 1], ["b", 3], ["LIMIT", 1]]
|
552
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
553
|
+
[1m[36mPost Create (0.2ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 1], ["b", 3]]
|
554
|
+
[1m[36mTRANSACTION (0.6ms)[0m [1m[36mcommit transaction[0m
|
555
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 2], ["b", 2], ["LIMIT", 1]]
|
556
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
557
|
+
[1m[36mPost Create (0.2ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 2], ["b", 2]]
|
558
|
+
[1m[36mTRANSACTION (0.6ms)[0m [1m[36mcommit transaction[0m
|
559
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 3], ["b", 2], ["LIMIT", 1]]
|
560
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
561
|
+
[1m[36mPost Create (0.2ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 3], ["b", 2]]
|
562
|
+
[1m[36mTRANSACTION (0.5ms)[0m [1m[36mcommit transaction[0m
|
563
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 4], ["b", 1], ["LIMIT", 1]]
|
564
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
565
|
+
[1m[36mPost Create (0.2ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 4], ["b", 1]]
|
566
|
+
[1m[36mTRANSACTION (0.6ms)[0m [1m[36mcommit transaction[0m
|
567
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 5], ["b", 1], ["LIMIT", 1]]
|
568
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
569
|
+
[1m[36mPost Create (0.2ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 5], ["b", 1]]
|
570
|
+
[1m[36mTRANSACTION (0.5ms)[0m [1m[36mcommit transaction[0m
|
571
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
572
|
+
-----------------------------------------------
|
573
|
+
ActiveSortOrderTest: test_sort_direction_errors
|
574
|
+
-----------------------------------------------
|
575
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
576
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
577
|
+
-------------------------------------------------
|
578
|
+
ActiveSortOrderTest: test_sort_on_multiple_fields
|
579
|
+
-------------------------------------------------
|
580
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
581
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY b asc, a asc, posts.a ASC[0m
|
582
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY b desc, a desc, posts.a ASC[0m
|
583
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
584
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
585
|
+
---------------------------------------------
|
586
|
+
ActiveSortOrderTest: test_exposes_main_module
|
587
|
+
---------------------------------------------
|
588
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
589
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
590
|
+
----------------------------------------------------
|
591
|
+
ActiveSortOrderTest: test_class_base_sort_order_only
|
592
|
+
----------------------------------------------------
|
593
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
594
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.a ASC[0m
|
595
|
+
[1m[36mPostWithBaseOrderB Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.b ASC[0m
|
596
|
+
[1m[36mPostWithBaseOrderAAndB Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.a ASC, posts.b ASC[0m
|
597
|
+
[1m[36mPostWithBaseOrderBAndA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.b ASC, posts.a ASC[0m
|
598
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
599
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
600
|
+
-------------------------------------------------------------
|
601
|
+
ActiveSortOrderTest: test_class_method_base_sort_order_errors
|
602
|
+
-------------------------------------------------------------
|
603
|
+
[1m[36mTRANSACTION (0.1ms)[0m [1m[31mrollback transaction[0m
|
604
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
605
|
+
-------------------------------------------------------
|
606
|
+
ActiveSortOrderTest: test_override_base_sort_order_only
|
607
|
+
-------------------------------------------------------
|
608
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
609
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.b ASC[0m
|
610
|
+
[1m[36mPostWithBaseOrderA Load (0.0ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY "posts"."id" ASC[0m
|
611
|
+
[1m[36mPostWithBaseOrderA Load (0.0ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY "posts"."id" ASC[0m
|
612
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
613
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
614
|
+
-------------------------------------------------------
|
615
|
+
ActiveSortOrderTest: test_base_sort_order_default_value
|
616
|
+
-------------------------------------------------------
|
617
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
618
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
619
|
+
---------------------------------------------------------
|
620
|
+
ActiveSortOrderTest: test_argument_base_sort_order_errors
|
621
|
+
---------------------------------------------------------
|
622
|
+
[1m[36mTRANSACTION (0.1ms)[0m [1m[31mrollback transaction[0m
|
623
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
624
|
+
-----------------------------------------
|
625
|
+
ActiveSortOrderTest: test_exposes_version
|
626
|
+
-----------------------------------------
|
627
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
628
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
629
|
+
--------------------------------------------------
|
630
|
+
ActiveSortOrderTest: test_base_sort_order_and_sort
|
631
|
+
--------------------------------------------------
|
632
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
633
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.a DESC, posts.a ASC[0m
|
634
|
+
[1m[36mPostWithBaseOrderB Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.b DESC, posts.b ASC[0m
|
635
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
636
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
637
|
+
-----------------------------------------
|
638
|
+
ActiveSortOrderTest: test_sort_str_errors
|
639
|
+
-----------------------------------------
|
640
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
641
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
642
|
+
-----------------------------------
|
643
|
+
ActiveSortOrderTest: test_sort_only
|
644
|
+
-----------------------------------
|
645
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
646
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY a desc, posts.a ASC[0m
|
647
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.a DESC, posts.a ASC[0m
|
648
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
649
|
+
[1m[35m (0.7ms)[0m [1m[34mSELECT sqlite_version(*)[0m
|
650
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ?[0m [["key", "schema_sha1"]]
|
651
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT sqlite_version(*)[0m
|
652
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
653
|
+
[1m[35m (0.0ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
654
|
+
[1m[36mActiveRecord::InternalMetadata Load (0.1ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ?[0m [["key", "environment"], ["LIMIT", 1]]
|
655
|
+
[1m[35m (1.3ms)[0m [1m[31mDELETE FROM posts;[0m
|
656
|
+
[1m[35m (1.0ms)[0m [1m[33mUPDATE `sqlite_sequence` SET `seq` = 0 WHERE `name` = 'posts';[0m
|
657
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 1], ["b", 3], ["LIMIT", 1]]
|
658
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
659
|
+
[1m[36mPost Create (0.2ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 1], ["b", 3]]
|
660
|
+
[1m[36mTRANSACTION (0.6ms)[0m [1m[36mcommit transaction[0m
|
661
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 2], ["b", 2], ["LIMIT", 1]]
|
662
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
663
|
+
[1m[36mPost Create (0.2ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 2], ["b", 2]]
|
664
|
+
[1m[36mTRANSACTION (0.7ms)[0m [1m[36mcommit transaction[0m
|
665
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 3], ["b", 2], ["LIMIT", 1]]
|
666
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
667
|
+
[1m[36mPost Create (0.2ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 3], ["b", 2]]
|
668
|
+
[1m[36mTRANSACTION (0.7ms)[0m [1m[36mcommit transaction[0m
|
669
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 4], ["b", 1], ["LIMIT", 1]]
|
670
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
671
|
+
[1m[36mPost Create (0.2ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 4], ["b", 1]]
|
672
|
+
[1m[36mTRANSACTION (0.6ms)[0m [1m[36mcommit transaction[0m
|
673
|
+
[1m[36mPost Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" WHERE "posts"."a" = ? AND "posts"."b" = ? LIMIT ?[0m [["a", 5], ["b", 1], ["LIMIT", 1]]
|
674
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
675
|
+
[1m[36mPost Create (0.2ms)[0m [1m[32mINSERT INTO "posts" ("a", "b") VALUES (?, ?)[0m [["a", 5], ["b", 1]]
|
676
|
+
[1m[36mTRANSACTION (0.7ms)[0m [1m[36mcommit transaction[0m
|
677
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
678
|
+
--------------------------------------------------
|
679
|
+
ActiveSortOrderTest: test_base_sort_order_and_sort
|
680
|
+
--------------------------------------------------
|
681
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
682
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.a DESC, posts.a ASC[0m
|
683
|
+
[1m[36mPostWithBaseOrderB Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.b DESC, posts.b ASC[0m
|
684
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
685
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
686
|
+
-------------------------------------------------------------
|
687
|
+
ActiveSortOrderTest: test_class_method_base_sort_order_errors
|
688
|
+
-------------------------------------------------------------
|
689
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
690
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
691
|
+
-----------------------------------
|
692
|
+
ActiveSortOrderTest: test_sort_only
|
693
|
+
-----------------------------------
|
694
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
695
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY a desc, posts.a ASC[0m
|
696
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.a DESC, posts.a ASC[0m
|
697
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
698
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
699
|
+
-----------------------------------------
|
700
|
+
ActiveSortOrderTest: test_exposes_version
|
701
|
+
-----------------------------------------
|
702
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
703
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
704
|
+
-----------------------------------------------
|
705
|
+
ActiveSortOrderTest: test_sort_direction_errors
|
706
|
+
-----------------------------------------------
|
707
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
708
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
709
|
+
---------------------------------------------------------
|
710
|
+
ActiveSortOrderTest: test_argument_base_sort_order_errors
|
711
|
+
---------------------------------------------------------
|
712
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
713
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
714
|
+
-------------------------------------------------------
|
715
|
+
ActiveSortOrderTest: test_override_base_sort_order_only
|
716
|
+
-------------------------------------------------------
|
717
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
718
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.b ASC[0m
|
719
|
+
[1m[36mPostWithBaseOrderA Load (0.0ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY "posts"."id" ASC[0m
|
720
|
+
[1m[36mPostWithBaseOrderA Load (0.0ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY "posts"."id" ASC[0m
|
721
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
722
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
723
|
+
-------------------------------------------------
|
724
|
+
ActiveSortOrderTest: test_sort_on_multiple_fields
|
725
|
+
-------------------------------------------------
|
726
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
727
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY b asc, a asc, posts.a ASC[0m
|
728
|
+
[1m[36mPostWithBaseOrderA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY b desc, a desc, posts.a ASC[0m
|
729
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
730
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
731
|
+
-----------------------------------------
|
732
|
+
ActiveSortOrderTest: test_sort_str_errors
|
733
|
+
-----------------------------------------
|
734
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
735
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
736
|
+
---------------------------------------------
|
737
|
+
ActiveSortOrderTest: test_exposes_main_module
|
738
|
+
---------------------------------------------
|
739
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[31mrollback transaction[0m
|
740
|
+
[1m[36mTRANSACTION (0.0ms)[0m [1m[36mbegin transaction[0m
|
741
|
+
-------------------------------------------------------
|
742
|
+
ActiveSortOrderTest: test_base_sort_order_default_value
|
743
|
+
-------------------------------------------------------
|
744
|
+
[1m[36mTRANSACTION (0.3ms)[0m [1m[31mrollback transaction[0m
|
745
|
+
[1m[36mTRANSACTION (0.2ms)[0m [1m[36mbegin transaction[0m
|
746
|
+
----------------------------------------------------
|
747
|
+
ActiveSortOrderTest: test_class_base_sort_order_only
|
748
|
+
----------------------------------------------------
|
749
|
+
[1m[35m (0.7ms)[0m [1m[34mSELECT COUNT(*) FROM "posts"[0m
|
750
|
+
[1m[36mPostWithBaseOrderA Load (0.4ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.a ASC[0m
|
751
|
+
[1m[36mPostWithBaseOrderB Load (0.4ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.b ASC[0m
|
752
|
+
[1m[36mPostWithBaseOrderAAndB Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.a ASC, posts.b ASC[0m
|
753
|
+
[1m[36mPostWithBaseOrderBAndA Load (0.1ms)[0m [1m[34mSELECT "posts".* FROM "posts" ORDER BY posts.b ASC, posts.a ASC[0m
|
754
|
+
[1m[36mTRANSACTION (0.1ms)[0m [1m[31mrollback transaction[0m
|
data/test/unit/errors_test.rb
CHANGED
@@ -15,6 +15,8 @@ class ActiveSortOrderTest < ActiveSupport::TestCase
|
|
15
15
|
:foo,
|
16
16
|
nil,
|
17
17
|
"",
|
18
|
+
[],
|
19
|
+
[:foo],
|
18
20
|
]
|
19
21
|
|
20
22
|
valid.each do |v|
|
@@ -25,7 +27,6 @@ class ActiveSortOrderTest < ActiveSupport::TestCase
|
|
25
27
|
invalid = [
|
26
28
|
true,
|
27
29
|
false,
|
28
|
-
[],
|
29
30
|
Object.new,
|
30
31
|
]
|
31
32
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_sort_order
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Weston Ganger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|