activerecord-hierarchical_query 1.4.2 → 1.4.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 69600d117213b4b5a7955315a7c93f6101d64f5e438accf02c239ddae3759389
4
- data.tar.gz: 8c076d833d60d83e065bab8f081683765d71e824e45ad79ae8db10a85d55086f
3
+ metadata.gz: '08114c6cb19f90e4d95e49040d5ebad5392b9a06f364b7a9d623e15cef18379d'
4
+ data.tar.gz: b6c88c4147010c528a4c8d97109710997b1594931aa6f0d9eda29f0cb851b06b
5
5
  SHA512:
6
- metadata.gz: e967554f13dff63c9a98400d99364c96b28bbc343368e0a181655b44622da3173a4096bbe5f2de78af05d40056c6ef9135f5d1762374666dfb47d288f369efcd
7
- data.tar.gz: 4f08d730fada5e0188ccb502cffa4151dcc351a2aa63061e1d634ea3c469bb876e47b2fdd886587f34e63d51abe70d23338e04dab34477ecb5a9a436479679fb
6
+ metadata.gz: a19a846408d55495b83515064cb69824c69e18768398349146c7d50a62a5ed958ee21ec099b0d331431d650a9847f0c8156acf53fd9a7e85cdb8f62eb7cf375f
7
+ data.tar.gz: 75415a7c1fcd97b92c387a06edf9e2e6effc160f82ab6ba017b43128f414a1dc5fd69a583317e6d5ec881b802beb4d2c3588f0f77bef0596efd2a13bffd9672e
data/README.md CHANGED
@@ -1,6 +1,5 @@
1
1
  # ActiveRecord::HierarchicalQuery
2
2
 
3
- [![Build Status](https://travis-ci.org/take-five/activerecord-hierarchical_query.png?branch=master)](https://travis-ci.org/take-five/activerecord-hierarchical_query)
4
3
  [![Code Climate](https://codeclimate.com/github/take-five/activerecord-hierarchical_query.png)](https://codeclimate.com/github/take-five/activerecord-hierarchical_query)
5
4
  [![Coverage Status](https://coveralls.io/repos/take-five/activerecord-hierarchical_query/badge.png)](https://coveralls.io/r/take-five/activerecord-hierarchical_query)
6
5
  [![Gem Version](https://badge.fury.io/rb/activerecord-hierarchical_query.png)](http://badge.fury.io/rb/activerecord-hierarchical_query)
@@ -27,12 +27,10 @@ module ActiveRecord
27
27
  order_values.each do |value|
28
28
  Array.wrap(as_orderings(value)).each do |ordering|
29
29
  @values << ordering
30
-
31
- yield ordering
32
30
  end
33
31
  end
34
32
 
35
- @values
33
+ @values.each(&block)
36
34
  end
37
35
 
38
36
  # Returns order expression to be inserted into SELECT clauses of both
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module HierarchicalQuery
3
- VERSION = '1.4.2'
3
+ VERSION = '1.4.4'
4
4
  end
5
5
  end
@@ -120,11 +120,6 @@ describe ActiveRecord::HierarchicalQuery do
120
120
  assert_ordered_by_name_desc { order_siblings(name: :desc) }
121
121
  end
122
122
 
123
- it 'orders rows by String' do
124
- assert_ordered_by_name_desc { order_siblings('name desc') }
125
- assert_ordered_by_name_asc { order_siblings('name asc') }
126
- end
127
-
128
123
  it 'orders rows by Arel::Nodes::Ordering' do
129
124
  assert_ordered_by_name_desc { order_siblings(table[:name].desc) }
130
125
  end
@@ -153,6 +148,26 @@ describe ActiveRecord::HierarchicalQuery do
153
148
  expect(relation.to_sql).not_to match /row_number/i
154
149
  end
155
150
  end
151
+
152
+ context 'when ordering by String' do
153
+ it 'orders rows by one column' do
154
+ assert_ordered_by_name_desc { order_siblings('name desc') }
155
+ assert_ordered_by_name_asc { order_siblings('name asc') }
156
+ end
157
+
158
+ it 'orders rows by multiple columns' do
159
+ root.update!(name: "Root", trait_id: "a")
160
+ child_2.update!(name: 'Same Name', trait_id: 'a')
161
+ child_3.update!(name: 'Same Name', trait_id: 'b')
162
+ root2 = klass.create(name: "Root", trait_id: "b")
163
+
164
+ expect(
165
+ klass.join_recursive do |b|
166
+ b.connect_by(id: :parent_id).start_with(parent_id: nil).order_siblings('name asc, trait_id desc')
167
+ end
168
+ ).to eq [root2, root, child_1, child_3, child_2, child_4, child_5]
169
+ end
170
+ end
156
171
  end
157
172
 
158
173
  describe 'LIMIT and OFFSET clauses' do
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-hierarchical_query
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexei Mikhailov
8
8
  - Zach Aysan
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-11-23 00:00:00.000000000 Z
12
+ date: 2023-06-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -40,7 +40,7 @@ dependencies:
40
40
  version: '0.21'
41
41
  - - "<"
42
42
  - !ruby/object:Gem::Version
43
- version: '1.5'
43
+ version: '1.6'
44
44
  type: :runtime
45
45
  prerelease: false
46
46
  version_requirements: !ruby/object:Gem::Requirement
@@ -50,7 +50,7 @@ dependencies:
50
50
  version: '0.21'
51
51
  - - "<"
52
52
  - !ruby/object:Gem::Version
53
- version: '1.5'
53
+ version: '1.6'
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: bundler
56
56
  requirement: !ruby/object:Gem::Requirement
@@ -121,7 +121,7 @@ dependencies:
121
121
  - - "~>"
122
122
  - !ruby/object:Gem::Version
123
123
  version: '0.16'
124
- description:
124
+ description:
125
125
  email:
126
126
  - amikhailov83@gmail.com
127
127
  - zachaysan@gmail.com
@@ -154,7 +154,7 @@ homepage: https://github.com/take-five/activerecord-hierarchical_query
154
154
  licenses:
155
155
  - MIT
156
156
  metadata: {}
157
- post_install_message:
157
+ post_install_message:
158
158
  rdoc_options: []
159
159
  require_paths:
160
160
  - lib
@@ -169,8 +169,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  - !ruby/object:Gem::Version
170
170
  version: '0'
171
171
  requirements: []
172
- rubygems_version: 3.4.0.dev
173
- signing_key:
172
+ rubygems_version: 3.4.1
173
+ signing_key:
174
174
  specification_version: 4
175
175
  summary: Recursively traverse trees using a single SQL query
176
176
  test_files: