forest_liana 7.6.4 → 7.6.5
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/lib/forest_liana/bootstrapper.rb +4 -4
- data/lib/forest_liana/version.rb +1 -1
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/models/product.rb +1 -1
- data/spec/dummy/app/models/reference.rb +1 -1
- data/spec/dummy/app/models/sub_application_record.rb +3 -0
- data/spec/lib/forest_liana/bootstrapper_spec.rb +48 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 707b0b16c61c9b7fcccbe24bd1c751a4cc4329bb70f40b4a4e67507bd5fcecef
|
4
|
+
data.tar.gz: c3e41015202d8f246f2328edc4dd013dd7f8d6c26a5a4efc00e00c4eefb10a59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95a00b54abf9d30d2dc4d07ac26a70ae17900669fc5646bbb37fcc0a698eb2410b9750110ac2bafab64c56aa0ed0d0076c6eb3f8eec8eec65174408a67ac03f2
|
7
|
+
data.tar.gz: 5098267f47503d451160ad421cccfc1a6319331d28625cb25272a3c9882ddf88cd377c656b7bc0e997334a5e8fc7777890f50df957c89369f5c4a101307fbcf6
|
@@ -114,14 +114,14 @@ module ForestLiana
|
|
114
114
|
def fetch_model(model)
|
115
115
|
begin
|
116
116
|
if model.abstract_class?
|
117
|
-
model.
|
117
|
+
model.subclasses.each { |submodel| fetch_model(submodel) }
|
118
118
|
else
|
119
119
|
if is_sti_parent_model?(model)
|
120
|
-
model.
|
120
|
+
model.subclasses.each { |submodel_sti| fetch_model(submodel_sti) }
|
121
121
|
end
|
122
122
|
|
123
123
|
if analyze_model?(model)
|
124
|
-
ForestLiana.models << model
|
124
|
+
ForestLiana.models << model unless ForestLiana.models.include?(model)
|
125
125
|
end
|
126
126
|
end
|
127
127
|
rescue => exception
|
@@ -136,7 +136,7 @@ module ForestLiana
|
|
136
136
|
end
|
137
137
|
|
138
138
|
def create_factories
|
139
|
-
ForestLiana.models.
|
139
|
+
ForestLiana.models.map do |model|
|
140
140
|
ForestLiana::SerializerFactory.new.serializer_for(model)
|
141
141
|
ForestLiana::ControllerFactory.new.controller_for(model)
|
142
142
|
end
|
data/lib/forest_liana/version.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
class Reference <
|
1
|
+
class Reference < SubApplicationRecord
|
2
2
|
end
|
@@ -1,5 +1,9 @@
|
|
1
1
|
module ForestLiana
|
2
2
|
describe Bootstrapper do
|
3
|
+
before do
|
4
|
+
allow(ForestLiana).to receive(:env_secret).and_return(nil)
|
5
|
+
end
|
6
|
+
|
3
7
|
describe 'setup_forest_liana_meta' do
|
4
8
|
it "should put statistic data related to user stack on a dedicated object" do
|
5
9
|
expect(ForestLiana.meta[:stack])
|
@@ -9,6 +13,50 @@ module ForestLiana
|
|
9
13
|
end
|
10
14
|
end
|
11
15
|
|
16
|
+
describe 'models' do
|
17
|
+
let(:expected_models) do
|
18
|
+
[
|
19
|
+
Island,
|
20
|
+
Location,
|
21
|
+
Owner,
|
22
|
+
Product,
|
23
|
+
Reference,
|
24
|
+
Tree,
|
25
|
+
User
|
26
|
+
]
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should populate the models correctly' do
|
30
|
+
ForestLiana::Bootstrapper.new
|
31
|
+
rails_models = [ActiveRecord::InternalMetadata, ActiveRecord::SchemaMigration]
|
32
|
+
|
33
|
+
expect(ForestLiana.models).to match_array(ForestLiana.models.uniq)
|
34
|
+
expect(ForestLiana.models).to match_array(expected_models + rails_models)
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should generate serializers for all models' do
|
38
|
+
factory = instance_double(ForestLiana::SerializerFactory, serializer_for: nil)
|
39
|
+
allow(ForestLiana::SerializerFactory).to receive(:new).and_return(factory)
|
40
|
+
|
41
|
+
ForestLiana::Bootstrapper.new
|
42
|
+
|
43
|
+
expected_models.each do |model|
|
44
|
+
expect(factory).to have_received(:serializer_for).with(model).once
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'should generate controllers for all models' do
|
49
|
+
factory = instance_double(ForestLiana::ControllerFactory, controller_for: nil)
|
50
|
+
allow(ForestLiana::ControllerFactory).to receive(:new).and_return(factory)
|
51
|
+
|
52
|
+
ForestLiana::Bootstrapper.new
|
53
|
+
|
54
|
+
expected_models.each do |model|
|
55
|
+
expect(factory).to have_received(:controller_for).with(model).once
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
12
60
|
describe 'generate_action_hooks' do
|
13
61
|
schema = '{
|
14
62
|
"collections": [
|
@@ -102,7 +150,6 @@ module ForestLiana
|
|
102
150
|
|
103
151
|
|
104
152
|
it "Should return actions hooks empty for the island collection" do
|
105
|
-
allow(ForestLiana).to receive(:env_secret).and_return(nil)
|
106
153
|
bootstrapper = Bootstrapper.new
|
107
154
|
content = JSON.parse(schema)
|
108
155
|
bootstrapper.instance_variable_set(:@collections_sent, content['collections'])
|
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.6.
|
4
|
+
version: 7.6.5
|
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-06-
|
11
|
+
date: 2022-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -328,11 +328,13 @@ files:
|
|
328
328
|
- spec/dummy/app/controllers/application_controller.rb
|
329
329
|
- spec/dummy/app/controllers/forest/islands_controller.rb
|
330
330
|
- spec/dummy/app/helpers/application_helper.rb
|
331
|
+
- spec/dummy/app/models/application_record.rb
|
331
332
|
- spec/dummy/app/models/island.rb
|
332
333
|
- spec/dummy/app/models/location.rb
|
333
334
|
- spec/dummy/app/models/owner.rb
|
334
335
|
- spec/dummy/app/models/product.rb
|
335
336
|
- spec/dummy/app/models/reference.rb
|
337
|
+
- spec/dummy/app/models/sub_application_record.rb
|
336
338
|
- spec/dummy/app/models/tree.rb
|
337
339
|
- spec/dummy/app/models/user.rb
|
338
340
|
- spec/dummy/app/views/layouts/application.html.erb
|
@@ -627,11 +629,13 @@ test_files:
|
|
627
629
|
- spec/dummy/app/helpers/application_helper.rb
|
628
630
|
- spec/dummy/app/models/reference.rb
|
629
631
|
- spec/dummy/app/models/owner.rb
|
632
|
+
- spec/dummy/app/models/application_record.rb
|
630
633
|
- spec/dummy/app/models/location.rb
|
631
634
|
- spec/dummy/app/models/tree.rb
|
632
635
|
- spec/dummy/app/models/product.rb
|
633
636
|
- spec/dummy/app/models/user.rb
|
634
637
|
- spec/dummy/app/models/island.rb
|
638
|
+
- spec/dummy/app/models/sub_application_record.rb
|
635
639
|
- spec/dummy/app/views/layouts/application.html.erb
|
636
640
|
- spec/dummy/app/controllers/forest/islands_controller.rb
|
637
641
|
- spec/dummy/app/controllers/application_controller.rb
|