brainstem 2.3.0 → 2.3.1

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
  SHA1:
3
- metadata.gz: 6c4ef646937471e3b40be68a1ff71f4faf4cdd63
4
- data.tar.gz: 1fadd886ec5c7125858223abbe7be3d620dad232
3
+ metadata.gz: 1e9525fa7be23bf9243bcda856506afc3ee2011c
4
+ data.tar.gz: ff5542a4d0eb4965677364a477ea53c9717e9e17
5
5
  SHA512:
6
- metadata.gz: 076d515bc2db2839b04a764bffd19b4505a3c600cdd83819bb01cbae337bdc42f93802cdc13c662ca60a7d5e32f1dff3a8d9a0bde800021795888e48bbdda6fc
7
- data.tar.gz: 6bf6f7174b79e66141cd080463ec5a16f6ebd99bf9bbf1dace67a067c6f72530df4b9d992ce720ac824b63e37418f411e963aab72b7b3bf1cd71f227919d01c1
6
+ metadata.gz: f432c131f41522c093db48efc27e1750071d43ac5f0166c365f8ca2ca6958e4c706bff3150ff0de5fb04ecfc0ef99e1c3f2065f609c9e9476d07f39f42e6e635
7
+ data.tar.gz: 5470b0dd0c46265edfb8c3229bc2a71bb3a4b8a277d560f4747f242e2e68784416ff566ab8979adc55acf9d6a2d89d5e3b583f83f0e1e253d762339f1b5db337
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- brainstem (2.3.0)
4
+ brainstem (2.3.1)
5
5
  activerecord (>= 4.2)
6
6
  activesupport (>= 4.2)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- brainstem (2.3.0)
4
+ brainstem (2.3.1)
5
5
  activerecord (>= 4.2)
6
6
  activesupport (>= 4.2)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- brainstem (2.3.0)
4
+ brainstem (2.3.1)
5
5
  activerecord (>= 4.2)
6
6
  activesupport (>= 4.2)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- brainstem (2.3.0)
4
+ brainstem (2.3.1)
5
5
  activerecord (>= 4.2)
6
6
  activesupport (>= 4.2)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- brainstem (2.3.0)
4
+ brainstem (2.3.1)
5
5
  activerecord (>= 4.2)
6
6
  activesupport (>= 4.2)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- brainstem (2.3.0)
4
+ brainstem (2.3.1)
5
5
  activerecord (>= 4.2)
6
6
  activesupport (>= 4.2)
7
7
 
@@ -214,7 +214,7 @@ module Brainstem
214
214
  when nil
215
215
  scope
216
216
  else
217
- scope.reorder(order.to_s + " " + direction)
217
+ scope.reorder(Arel.sql(order.to_s + " " + direction))
218
218
  end
219
219
 
220
220
  fallback_deterministic_sort = assemble_primary_key_sort(scope)
@@ -1,3 +1,3 @@
1
1
  module Brainstem
2
- VERSION = "2.3.0"
2
+ VERSION = "2.3.1"
3
3
  end
@@ -1000,6 +1000,21 @@ describe Brainstem::Presenter do
1000
1000
  # match SQLite and MySQL quotes
1001
1001
  expect(sql).to match(/ORDER BY workspaces\.title asc, [`"]workspaces[`"]\.[`"]id[`"] ASC/i)
1002
1002
  end
1003
+
1004
+ context 'when sorting by associated models' do
1005
+ let(:scope) { Workspace.where(nil).joins(:tasks) }
1006
+ let(:order) { { 'order' => 'tasks:asc' } }
1007
+
1008
+ before do
1009
+ presenter_class.sort_order :tasks, 'COALECE(tasks.name, tasks.created_at)'
1010
+ end
1011
+
1012
+ it 'applies the named ordering in the given direction and adds the primary key as a fallback sort' do
1013
+ sql = presenter.apply_ordering_to_scope(scope, order).to_sql
1014
+ # match SQLite and MySQL quotes
1015
+ expect(sql).to match(/ORDER BY COALECE\(tasks\.name, tasks\.created_at\) asc, [`"]workspaces[`"]\.[`"]id[`"] ASC/i)
1016
+ end
1017
+ end
1003
1018
  end
1004
1019
 
1005
1020
  context 'and is a symbol' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brainstem
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mavenlink
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-09 00:00:00.000000000 Z
11
+ date: 2019-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -406,7 +406,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
406
406
  version: '0'
407
407
  requirements: []
408
408
  rubyforge_project:
409
- rubygems_version: 2.6.13
409
+ rubygems_version: 2.5.2
410
410
  signing_key:
411
411
  specification_version: 4
412
412
  summary: ActiveRecord presenters with a rich request API