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 +4 -4
- data/Gemfile.lock +1 -1
- data/gemfiles/activerecord4_2.gemfile.lock +1 -1
- data/gemfiles/activerecord5_0.gemfile.lock +1 -1
- data/gemfiles/activerecord5_1.gemfile.lock +1 -1
- data/gemfiles/activerecord5_2.gemfile.lock +1 -1
- data/gemfiles/activerecord6_0.gemfile.lock +1 -1
- data/lib/brainstem/presenter.rb +1 -1
- data/lib/brainstem/version.rb +1 -1
- data/spec/brainstem/presenter_spec.rb +15 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e9525fa7be23bf9243bcda856506afc3ee2011c
|
4
|
+
data.tar.gz: ff5542a4d0eb4965677364a477ea53c9717e9e17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f432c131f41522c093db48efc27e1750071d43ac5f0166c365f8ca2ca6958e4c706bff3150ff0de5fb04ecfc0ef99e1c3f2065f609c9e9476d07f39f42e6e635
|
7
|
+
data.tar.gz: 5470b0dd0c46265edfb8c3229bc2a71bb3a4b8a277d560f4747f242e2e68784416ff566ab8979adc55acf9d6a2d89d5e3b583f83f0e1e253d762339f1b5db337
|
data/Gemfile.lock
CHANGED
data/lib/brainstem/presenter.rb
CHANGED
data/lib/brainstem/version.rb
CHANGED
@@ -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.
|
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-
|
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.
|
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
|