forest_liana 7.0.0.beta.2 → 7.0.0.beta.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/forest_liana/actions_controller.rb +20 -18
- data/app/controllers/forest_liana/application_controller.rb +0 -9
- data/app/controllers/forest_liana/associations_controller.rb +2 -2
- data/app/controllers/forest_liana/resources_controller.rb +16 -6
- data/app/controllers/forest_liana/scopes_controller.rb +20 -0
- data/app/controllers/forest_liana/smart_actions_controller.rb +39 -6
- data/app/controllers/forest_liana/stats_controller.rb +5 -5
- data/app/services/forest_liana/apimap_sorter.rb +1 -0
- data/app/services/forest_liana/filters_parser.rb +8 -4
- data/app/services/forest_liana/has_many_dissociator.rb +2 -2
- data/app/services/forest_liana/has_many_getter.rb +2 -2
- data/app/services/forest_liana/leaderboard_stat_getter.rb +20 -14
- data/app/services/forest_liana/line_stat_getter.rb +5 -3
- data/app/services/forest_liana/permissions_checker.rb +42 -37
- data/app/services/forest_liana/permissions_formatter.rb +1 -1
- data/app/services/forest_liana/permissions_getter.rb +3 -6
- data/app/services/forest_liana/pie_stat_getter.rb +6 -3
- data/app/services/forest_liana/resource_getter.rb +6 -3
- data/app/services/forest_liana/resource_updater.rb +5 -2
- data/app/services/forest_liana/resources_getter.rb +6 -5
- data/app/services/forest_liana/scope_manager.rb +102 -0
- data/app/services/forest_liana/search_query_builder.rb +6 -3
- data/app/services/forest_liana/stat_getter.rb +2 -1
- data/app/services/forest_liana/token.rb +1 -0
- data/app/services/forest_liana/utils/beta_schema_utils.rb +1 -1
- data/app/services/forest_liana/value_stat_getter.rb +4 -2
- data/config/routes.rb +3 -1
- data/lib/forest_liana/bootstrapper.rb +4 -2
- data/lib/forest_liana/version.rb +1 -1
- data/spec/dummy/app/controllers/forest/islands_controller.rb +5 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/lib/forest_liana/collections/island.rb +7 -0
- data/spec/lib/forest_liana/bootstrapper_spec.rb +12 -0
- data/spec/requests/actions_controller_spec.rb +144 -23
- data/spec/requests/authentications_spec.rb +2 -1
- data/spec/requests/resources_spec.rb +2 -0
- data/spec/services/forest_liana/apimap_sorter_spec.rb +6 -4
- data/spec/services/forest_liana/filters_parser_spec.rb +1 -1
- data/spec/services/forest_liana/has_many_getter_spec.rb +116 -0
- data/spec/services/forest_liana/line_stat_getter_spec.rb +14 -6
- data/spec/services/forest_liana/permissions_checker_acl_disabled_spec.rb +45 -71
- data/spec/services/forest_liana/permissions_checker_acl_enabled_spec.rb +39 -63
- data/spec/services/forest_liana/permissions_checker_live_queries_spec.rb +3 -3
- data/spec/services/forest_liana/permissions_formatter_spec.rb +11 -11
- data/spec/services/forest_liana/pie_stat_getter_spec.rb +114 -0
- data/spec/services/forest_liana/resource_updater_spec.rb +116 -0
- data/spec/services/forest_liana/resources_getter_spec.rb +68 -1
- data/spec/services/forest_liana/scope_manager_spec.rb +232 -0
- data/spec/services/forest_liana/value_stat_getter_spec.rb +96 -0
- metadata +125 -118
- data/app/services/forest_liana/scope_validator.rb +0 -98
- data/test/services/forest_liana/has_many_getter_test.rb +0 -75
- data/test/services/forest_liana/pie_stat_getter_test.rb +0 -29
- data/test/services/forest_liana/resource_updater_test.rb +0 -86
- data/test/services/forest_liana/scope_validator_test.rb +0 -185
- data/test/services/forest_liana/value_stat_getter_test.rb +0 -71
@@ -1,71 +0,0 @@
|
|
1
|
-
module ForestLiana
|
2
|
-
class ValueStatGetterTest < ActiveSupport::TestCase
|
3
|
-
test 'Value stat getter with a simple filter' do
|
4
|
-
stat = ValueStatGetter.new(BooleanField, {
|
5
|
-
type: "Value",
|
6
|
-
collection: "boolean_field",
|
7
|
-
timezone: "Europe/Paris",
|
8
|
-
aggregate: "Count",
|
9
|
-
filters: {
|
10
|
-
field: "field",
|
11
|
-
operator: 'equal',
|
12
|
-
value: "true"
|
13
|
-
}.to_json
|
14
|
-
})
|
15
|
-
|
16
|
-
stat.perform
|
17
|
-
assert stat.record.value[:countCurrent] == 0
|
18
|
-
end
|
19
|
-
|
20
|
-
test 'Value stat getter with a filter on a belongs_to integer field' do
|
21
|
-
stat = ValueStatGetter.new(BelongsToField, {
|
22
|
-
type: "Value",
|
23
|
-
collection: "belongs_to_field",
|
24
|
-
timezone: "Europe/Paris",
|
25
|
-
aggregate: "Count",
|
26
|
-
filters: {
|
27
|
-
field: "has_one_field:id",
|
28
|
-
operator: 'equal',
|
29
|
-
value: 3
|
30
|
-
}.to_json
|
31
|
-
})
|
32
|
-
|
33
|
-
stat.perform
|
34
|
-
assert stat.record.value[:countCurrent] == 1
|
35
|
-
end
|
36
|
-
|
37
|
-
test 'Value stat getter with a filter on a belongs_to boolean field' do
|
38
|
-
stat = ValueStatGetter.new(BelongsToField, {
|
39
|
-
type: "Value",
|
40
|
-
collection: "belongs_to_field",
|
41
|
-
timezone: "Europe/Paris",
|
42
|
-
aggregate: "Count",
|
43
|
-
filters: {
|
44
|
-
field: "has_one_field:checked",
|
45
|
-
operator: 'equal',
|
46
|
-
value: "false"
|
47
|
-
}.to_json
|
48
|
-
})
|
49
|
-
|
50
|
-
stat.perform
|
51
|
-
assert stat.record.value[:countCurrent] == 0
|
52
|
-
end
|
53
|
-
|
54
|
-
test 'Value stat getter with a filter on a belongs_to enum field' do
|
55
|
-
stat = ValueStatGetter.new(BelongsToField, {
|
56
|
-
type: "Value",
|
57
|
-
collection: "belongs_to_field",
|
58
|
-
timezone: "Europe/Paris",
|
59
|
-
aggregate: "Count",
|
60
|
-
filters: {
|
61
|
-
field: "has_one_field:status",
|
62
|
-
operator: 'equal',
|
63
|
-
value: "pending"
|
64
|
-
}.to_json
|
65
|
-
})
|
66
|
-
|
67
|
-
stat.perform
|
68
|
-
assert stat.record.value[:countCurrent] == 1
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|