forest_liana 9.20.5 → 9.20.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a276e10f6f55ce7c4b4aedf82f58847599273e82fa86b001d02573ff56d70a59
4
- data.tar.gz: a8527baf9d848dbf81e3d989cd473718c859df54339df0e5172e795260b3410b
3
+ metadata.gz: ed69fd6aba8fea8a03a02738a6f9ca6e75ae334980e501470dbabe1d58c37497
4
+ data.tar.gz: a6439711199628972e57f782968244c096566919801510d2193e3d16fbe5d800
5
5
  SHA512:
6
- metadata.gz: 6516197269ef7e03df7e4c75f1c474147b9332b82945a8f688791f5e739e204dc5b443b572812f8394a93e15a7cad73e43d853056116a375c568f56db9dd99bd
7
- data.tar.gz: f1966c816f63eba307e6e318d7ada4f7e3bf9280360695d6eb95859e7122cfbf8fbc2d34e2a68a5ab5489203c44e4aece02fb4759c6931fd3ed9d3e589530d0f
6
+ metadata.gz: e6101bb2d0ea3dfe2b3944cdf5d2ca3391ecd26450653517dd30553ffd4075dcb0cb23b6659996303259f6bd931c8054a58986f9337adc5417f94df8f1aac8b2
7
+ data.tar.gz: 3de7e6bc1710e6e8f8e1c8b1857775091e7d5d707d57c9f7f4dd1a993c7fbac111e350a88d4623e90357b8815aaf74a1de6a01710c01a81bd039b465ca19f600
@@ -27,6 +27,11 @@ module ForestLiana
27
27
  def count
28
28
  find_resource
29
29
  find_association
30
+ # NOTICE: find_association renders a 404 (without halting) when the
31
+ # association name does not resolve; stop here instead of falling
32
+ # through and dereferencing a nil @association, which surfaced as
33
+ # a double-render / 500 rather than the intended 404.
34
+ return if performed?
30
35
  begin
31
36
  getter = HasManyGetter.new(@resource, @association, params, forest_user)
32
37
  getter.count
@@ -415,7 +415,7 @@ module ForestLiana
415
415
  case column.type
416
416
  when :boolean
417
417
  type = 'Boolean'
418
- when :datetime
418
+ when :datetime, :timestamptz, :timestamp
419
419
  type = 'Date'
420
420
  when :date
421
421
  type = 'Dateonly'
@@ -1,3 +1,3 @@
1
1
  module ForestLiana
2
- VERSION = "9.20.5"
2
+ VERSION = "9.20.7"
3
3
  end
@@ -74,6 +74,20 @@ describe 'Requesting Owner', :type => :request do
74
74
  end
75
75
  end
76
76
 
77
+ describe 'count on an unknown relationship' do
78
+ params = {
79
+ fields: { 'Tree' => 'id,name,owner' },
80
+ page: { 'number' => '1', 'size' => '10' },
81
+ searchExtended: '0',
82
+ timezone: 'Europe/Paris'
83
+ }
84
+
85
+ it 'should respond 404 instead of 500' do
86
+ get '/forest/Owner/5/relationships/unknown_things/count', params: params, headers: headers
87
+ expect(response.status).to eq(404)
88
+ end
89
+ end
90
+
77
91
  describe 'deactivate_count_response' do
78
92
  params = {
79
93
  fields: { 'Owner' => 'id,name' },
@@ -1,5 +1,25 @@
1
1
  module ForestLiana
2
2
  describe SchemaAdapter do
3
+ describe '#get_type_for' do
4
+ let(:adapter) { described_class.new(Tree) }
5
+
6
+ def column_of_type(type)
7
+ double('Column', name: 'some_column', type: type, array: false)
8
+ end
9
+
10
+ it 'maps a timestamptz column to the Date type' do
11
+ expect(adapter.send(:get_type_for, column_of_type(:timestamptz))).to eq 'Date'
12
+ end
13
+
14
+ it 'maps a timestamp column to the Date type' do
15
+ expect(adapter.send(:get_type_for, column_of_type(:timestamp))).to eq 'Date'
16
+ end
17
+
18
+ it 'still maps a datetime column to the Date type' do
19
+ expect(adapter.send(:get_type_for, column_of_type(:datetime))).to eq 'Date'
20
+ end
21
+ end
22
+
3
23
  describe 'perform' do
4
24
  context 'with polymorphic association' do
5
25
  it 'should define the association with the referenced models' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_liana
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.20.5
4
+ version: 9.20.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandro Munda