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.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/forest_liana/actions_controller.rb +20 -18
  3. data/app/controllers/forest_liana/application_controller.rb +0 -9
  4. data/app/controllers/forest_liana/associations_controller.rb +2 -2
  5. data/app/controllers/forest_liana/resources_controller.rb +16 -6
  6. data/app/controllers/forest_liana/scopes_controller.rb +20 -0
  7. data/app/controllers/forest_liana/smart_actions_controller.rb +39 -6
  8. data/app/controllers/forest_liana/stats_controller.rb +5 -5
  9. data/app/services/forest_liana/apimap_sorter.rb +1 -0
  10. data/app/services/forest_liana/filters_parser.rb +8 -4
  11. data/app/services/forest_liana/has_many_dissociator.rb +2 -2
  12. data/app/services/forest_liana/has_many_getter.rb +2 -2
  13. data/app/services/forest_liana/leaderboard_stat_getter.rb +20 -14
  14. data/app/services/forest_liana/line_stat_getter.rb +5 -3
  15. data/app/services/forest_liana/permissions_checker.rb +42 -37
  16. data/app/services/forest_liana/permissions_formatter.rb +1 -1
  17. data/app/services/forest_liana/permissions_getter.rb +3 -6
  18. data/app/services/forest_liana/pie_stat_getter.rb +6 -3
  19. data/app/services/forest_liana/resource_getter.rb +6 -3
  20. data/app/services/forest_liana/resource_updater.rb +5 -2
  21. data/app/services/forest_liana/resources_getter.rb +6 -5
  22. data/app/services/forest_liana/scope_manager.rb +102 -0
  23. data/app/services/forest_liana/search_query_builder.rb +6 -3
  24. data/app/services/forest_liana/stat_getter.rb +2 -1
  25. data/app/services/forest_liana/token.rb +1 -0
  26. data/app/services/forest_liana/utils/beta_schema_utils.rb +1 -1
  27. data/app/services/forest_liana/value_stat_getter.rb +4 -2
  28. data/config/routes.rb +3 -1
  29. data/lib/forest_liana/bootstrapper.rb +4 -2
  30. data/lib/forest_liana/version.rb +1 -1
  31. data/spec/dummy/app/controllers/forest/islands_controller.rb +5 -0
  32. data/spec/dummy/config/routes.rb +4 -0
  33. data/spec/dummy/lib/forest_liana/collections/island.rb +7 -0
  34. data/spec/lib/forest_liana/bootstrapper_spec.rb +12 -0
  35. data/spec/requests/actions_controller_spec.rb +144 -23
  36. data/spec/requests/authentications_spec.rb +2 -1
  37. data/spec/requests/resources_spec.rb +2 -0
  38. data/spec/services/forest_liana/apimap_sorter_spec.rb +6 -4
  39. data/spec/services/forest_liana/filters_parser_spec.rb +1 -1
  40. data/spec/services/forest_liana/has_many_getter_spec.rb +116 -0
  41. data/spec/services/forest_liana/line_stat_getter_spec.rb +14 -6
  42. data/spec/services/forest_liana/permissions_checker_acl_disabled_spec.rb +45 -71
  43. data/spec/services/forest_liana/permissions_checker_acl_enabled_spec.rb +39 -63
  44. data/spec/services/forest_liana/permissions_checker_live_queries_spec.rb +3 -3
  45. data/spec/services/forest_liana/permissions_formatter_spec.rb +11 -11
  46. data/spec/services/forest_liana/pie_stat_getter_spec.rb +114 -0
  47. data/spec/services/forest_liana/resource_updater_spec.rb +116 -0
  48. data/spec/services/forest_liana/resources_getter_spec.rb +68 -1
  49. data/spec/services/forest_liana/scope_manager_spec.rb +232 -0
  50. data/spec/services/forest_liana/value_stat_getter_spec.rb +96 -0
  51. metadata +125 -118
  52. data/app/services/forest_liana/scope_validator.rb +0 -98
  53. data/test/services/forest_liana/has_many_getter_test.rb +0 -75
  54. data/test/services/forest_liana/pie_stat_getter_test.rb +0 -29
  55. data/test/services/forest_liana/resource_updater_test.rb +0 -86
  56. data/test/services/forest_liana/scope_validator_test.rb +0 -185
  57. 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