forest_liana 7.5.0 → 7.5.1
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 +4 -4
- data/app/controllers/forest_liana/application_controller.rb +4 -0
- data/app/controllers/forest_liana/associations_controller.rb +6 -4
- data/app/controllers/forest_liana/resources_controller.rb +0 -4
- data/lib/forest_liana/version.rb +1 -1
- data/spec/dummy/app/models/owner.rb +1 -0
- data/spec/dummy/config/routes.rb +1 -0
- data/spec/dummy/lib/forest_liana/controllers/owner_trees_controller.rb +11 -0
- data/spec/requests/count_spec.rb +44 -2
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c97d05c2880b945fbcf8dedbdc4f6b5a131bd2554fbe6cc96893f138605ee251
|
|
4
|
+
data.tar.gz: 436dbead1e46549772e63a53d1b24effa6c0f66e49bb2b8829bded39b3c9efdc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ae51cf5c7bbbd52021d604f871de5f880a6de198fd08da6c09f9b1255925a5174e26a10baa2dfa59e6380970d7400dc3b75ac4376e32f9a6e9146f74e0572ff0
|
|
7
|
+
data.tar.gz: 297718c752c3d6522295a6a513ed89c679b20c57c3d66f6ee3997a32ed5f34fdbf6deaa4bbbaa8d062bd09689c5cc8aef33d895a741772e669cc1fadf455466b
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
module ForestLiana
|
|
2
2
|
class AssociationsController < ForestLiana::ApplicationController
|
|
3
3
|
if Rails::VERSION::MAJOR < 4
|
|
4
|
-
before_filter :find_resource
|
|
5
|
-
before_filter :find_association
|
|
4
|
+
before_filter :find_resource, except: :count
|
|
5
|
+
before_filter :find_association, except: :count
|
|
6
6
|
else
|
|
7
|
-
before_action :find_resource
|
|
8
|
-
before_action :find_association
|
|
7
|
+
before_action :find_resource, except: :count
|
|
8
|
+
before_action :find_association, except: :count
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def index
|
|
@@ -25,6 +25,8 @@ module ForestLiana
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def count
|
|
28
|
+
find_resource
|
|
29
|
+
find_association
|
|
28
30
|
begin
|
|
29
31
|
getter = HasManyGetter.new(@resource, @association, params, forest_user)
|
|
30
32
|
getter.count
|
data/lib/forest_liana/version.rb
CHANGED
data/spec/dummy/config/routes.rb
CHANGED
data/spec/requests/count_spec.rb
CHANGED
|
@@ -3,7 +3,8 @@ require 'rails_helper'
|
|
|
3
3
|
describe 'Requesting Owner', :type => :request do
|
|
4
4
|
before(:each) do
|
|
5
5
|
1.upto(10) do |i|
|
|
6
|
-
|
|
6
|
+
owner = Owner.create(name: "Owner #{i}")
|
|
7
|
+
Tree.create(name: "Tree #{i}", owner_id: owner.id)
|
|
7
8
|
end
|
|
8
9
|
end
|
|
9
10
|
|
|
@@ -52,13 +53,33 @@ describe 'Requesting Owner', :type => :request do
|
|
|
52
53
|
|
|
53
54
|
it 'should equal to 10' do
|
|
54
55
|
get '/forest/Owner/count', params: params, headers: headers
|
|
56
|
+
expect(response.body).to eq('{"count":10}')
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
describe 'count on relationships' do
|
|
61
|
+
params = {
|
|
62
|
+
fields: { 'Tree' => 'id,name,owner' },
|
|
63
|
+
page: { 'number' => '1', 'size' => '10' },
|
|
64
|
+
searchExtended: '0',
|
|
65
|
+
sort: '-id',
|
|
66
|
+
timezone: 'Europe/Paris'
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
it 'should respond 200' do
|
|
70
|
+
get '/forest/Owner/1/relationships/trees/count', params: params, headers: headers
|
|
55
71
|
expect(response.status).to eq(200)
|
|
56
72
|
end
|
|
73
|
+
|
|
74
|
+
it 'should equal to 1' do
|
|
75
|
+
get '/forest/Owner/1/relationships/trees/count', params: params, headers: headers
|
|
76
|
+
expect(response.body).to eq('{"count":1}')
|
|
77
|
+
end
|
|
57
78
|
end
|
|
58
79
|
|
|
59
80
|
describe 'deactivate_count_response' do
|
|
60
81
|
params = {
|
|
61
|
-
fields: { '
|
|
82
|
+
fields: { 'Owner' => 'id,name' },
|
|
62
83
|
page: { 'number' => '1', 'size' => '10' },
|
|
63
84
|
search: 'foo',
|
|
64
85
|
searchExtended: '0',
|
|
@@ -76,4 +97,25 @@ describe 'Requesting Owner', :type => :request do
|
|
|
76
97
|
expect(response.body).to eq('{"meta":{"count":"deactivated "}}')
|
|
77
98
|
end
|
|
78
99
|
end
|
|
100
|
+
|
|
101
|
+
describe 'deactivate_count_response' do
|
|
102
|
+
params = {
|
|
103
|
+
fields: { 'Tree' => 'id,name,owner' },
|
|
104
|
+
page: { 'number' => '1', 'size' => '10' },
|
|
105
|
+
search: 'foo',
|
|
106
|
+
searchExtended: '0',
|
|
107
|
+
sort: '-id',
|
|
108
|
+
timezone: 'Europe/Paris'
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
it 'should respond 200' do
|
|
112
|
+
get '/forest/Owner/1/relationships/trees/count', params: params, headers: headers
|
|
113
|
+
expect(response.status).to eq(200)
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
it 'should equal to deactivated response' do
|
|
117
|
+
get '/forest/Owner/1/relationships/trees/count', params: params, headers: headers
|
|
118
|
+
expect(response.body).to eq('{"meta":{"count":"deactivated "}}')
|
|
119
|
+
end
|
|
120
|
+
end
|
|
79
121
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: forest_liana
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 7.5.
|
|
4
|
+
version: 7.5.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sandro Munda
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-03-
|
|
11
|
+
date: 2022-03-31 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -372,6 +372,7 @@ files:
|
|
|
372
372
|
- spec/dummy/lib/forest_liana/collections/island.rb
|
|
373
373
|
- spec/dummy/lib/forest_liana/collections/location.rb
|
|
374
374
|
- spec/dummy/lib/forest_liana/collections/user.rb
|
|
375
|
+
- spec/dummy/lib/forest_liana/controllers/owner_trees_controller.rb
|
|
375
376
|
- spec/dummy/lib/forest_liana/controllers/owners_controller.rb
|
|
376
377
|
- spec/helpers/forest_liana/query_helper_spec.rb
|
|
377
378
|
- spec/helpers/forest_liana/schema_helper_spec.rb
|
|
@@ -667,6 +668,7 @@ test_files:
|
|
|
667
668
|
- spec/dummy/app/controllers/forest/islands_controller.rb
|
|
668
669
|
- spec/dummy/app/helpers/application_helper.rb
|
|
669
670
|
- spec/dummy/Rakefile
|
|
671
|
+
- spec/dummy/lib/forest_liana/controllers/owner_trees_controller.rb
|
|
670
672
|
- spec/dummy/lib/forest_liana/controllers/owners_controller.rb
|
|
671
673
|
- spec/dummy/lib/forest_liana/collections/user.rb
|
|
672
674
|
- spec/dummy/lib/forest_liana/collections/location.rb
|