lesli 5.0.21 → 5.0.23

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.
Files changed (156) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +4 -0
  3. data/app/assets/config/lesli_manifest.js +2 -2
  4. data/app/assets/images/lesli/brand/register-background.jpg +0 -0
  5. data/app/assets/stylesheets/lesli/application.css +192 -1
  6. data/app/controllers/lesli/abouts_controller.rb +12 -13
  7. data/app/controllers/lesli/application_controller.rb +1 -42
  8. data/app/controllers/lesli/application_lesli_controller.rb +8 -1
  9. data/app/controllers/lesli/apps_controller.rb +25 -0
  10. data/app/controllers/lesli/items/actions_controller.rb +122 -0
  11. data/app/{models/lesli/item/activity.rb → controllers/lesli/items/activities_controller.rb} +2 -2
  12. data/app/controllers/lesli/items/discussions_controller.rb +93 -0
  13. data/app/controllers/lesli/{system_controllers_controller.rb → resources_controller.rb} +3 -3
  14. data/app/controllers/lesli/shared/dashboards_controller.rb +11 -279
  15. data/app/helpers/lesli/customization_helper.rb +3 -3
  16. data/app/helpers/lesli/html_helper.rb +114 -2
  17. data/app/helpers/lesli/navigation_helper.rb +8 -25
  18. data/app/helpers/lesli/system_helper.rb +21 -4
  19. data/app/helpers/lesli/turbo_helper.rb +19 -2
  20. data/app/interfaces/lesli/requester_interface.rb +2 -29
  21. data/app/interfaces/lesli/responder_interface.rb +121 -61
  22. data/app/models/concerns/lesli/account_initializer.rb +13 -13
  23. data/{lib/rspec/factories/lesli_account.rb → app/models/concerns/lesli/account_logs.rb} +23 -9
  24. data/app/models/concerns/lesli/user_extensions.rb +33 -51
  25. data/app/models/lesli/account.rb +6 -5
  26. data/app/models/lesli/application_lesli_record.rb +14 -0
  27. data/app/models/lesli/items/action.rb +15 -0
  28. data/app/models/lesli/items/activity.rb +50 -0
  29. data/app/models/lesli/items/discussion.rb +15 -0
  30. data/app/models/lesli/{user/journal.rb → resource.rb} +9 -4
  31. data/app/models/lesli/role.rb +2 -17
  32. data/app/models/lesli/shared/dashboard.rb +1 -0
  33. data/app/models/lesli/user.rb +23 -77
  34. data/app/services/lesli/application_lesli_service.rb +21 -4
  35. data/app/{operators/lesli/controller_operator.rb → services/lesli/resource_service.rb} +92 -23
  36. data/app/services/lesli/role_service.rb +16 -10
  37. data/app/services/lesli/user_service.rb +28 -27
  38. data/app/views/lesli/abouts/welcome.html.erb +11 -11
  39. data/app/views/lesli/apps/show.html.erb +1 -1
  40. data/app/views/lesli/errors/not_found.html.erb +1 -1
  41. data/app/views/lesli/errors/unauthorized.html.erb +9 -11
  42. data/app/views/lesli/layouts/application-devise.html.erb +6 -9
  43. data/app/views/lesli/layouts/application-lesli.html.erb +9 -9
  44. data/app/views/lesli/layouts/application-public.html.erb +4 -18
  45. data/app/views/lesli/layouts/mailer.html.erb +1 -1
  46. data/app/views/lesli/partials/{_application-analytics.html.erb → _application-lesli-analytics.html.erb} +18 -9
  47. data/app/views/lesli/partials/{_application-lesli-scss.html.erb → _application-lesli-assets.html.erb} +9 -11
  48. data/{db/migrate/v1/0000110310_create_lesli_account_settings.rb → app/views/lesli/partials/_application-lesli-data.html.erb} +11 -7
  49. data/app/views/lesli/partials/{_application-head.html.erb → _application-lesli-head.html.erb} +2 -2
  50. data/app/views/lesli/partials/_application-lesli-header.html.erb +6 -6
  51. data/app/views/lesli/partials/_application-lesli-navigation.html.erb +3 -6
  52. data/app/views/lesli/partials/_application-lesli-notifications.html.erb +0 -1
  53. data/app/views/lesli/partials/turbo/_redirection.html.erb +5 -0
  54. data/app/views/lesli/{partials/_application-data.html.erb → shared/dashboards/edit.html.erb} +2 -6
  55. data/app/views/lesli/shared/dashboards/{_show.html.erb → show.html.erb} +3 -3
  56. data/config/brakeman.yml +55 -0
  57. data/config/importmap.rb +0 -3
  58. data/config/initializers/devise.rb +1 -2
  59. data/config/initializers/lesli.rb +27 -14
  60. data/config/initializers/lesli_migration_helpers.rb +0 -5
  61. data/config/locales/translations.en.yml +6 -2
  62. data/config/locales/translations.es.yml +5 -2
  63. data/config/locales/translations.fr.yml +1 -4
  64. data/config/locales/translations.it.yml +5 -2
  65. data/config/locales/translations.pt.yml +1 -4
  66. data/config/routes.rb +4 -6
  67. data/db/migrate/v1/{0000000310_create_lesli_users.rb → 0000000210_create_lesli_users.rb} +4 -0
  68. data/db/migrate/v1/{0000000210_create_lesli_roles.rb → 0000000310_create_lesli_roles.rb} +6 -0
  69. data/db/migrate/v1/{0000100110_create_lesli_system_controllers.rb → 0000000410_create_lesli_resources.rb} +8 -5
  70. data/db/seed/users.rb +1 -1
  71. data/db/seed/xyz.rb +3 -1
  72. data/lib/generators/lesli/spec/spec_generator.rb +0 -3
  73. data/lib/generators/lesli/view/view_generator.rb +0 -3
  74. data/lib/lesli/configuration.rb +1 -1
  75. data/{app/lib → lib}/lesli/courier.rb +40 -7
  76. data/lib/lesli/engine.rb +4 -5
  77. data/lib/lesli/{routing.rb → router.rb} +3 -2
  78. data/lib/lesli/version.rb +2 -2
  79. data/lib/lesli.rb +3 -2
  80. data/lib/migrate/common.rb +2 -0
  81. data/lib/migrate/items/action_structure.rb +2 -1
  82. data/lib/migrate/items/activity_structure.rb +12 -2
  83. data/lib/migrate/items/discussion_structure.rb +1 -1
  84. data/lib/scss/_apps.scss +1 -0
  85. data/lib/tasks/lesli/db.rake +5 -5
  86. data/lib/tasks/lesli/{controllers.rake → resources.rake} +4 -4
  87. data/lib/tasks/lesli_tasks.rake +13 -3
  88. data/lib/test/config.rb +111 -0
  89. data/{db/migrate/v1/0000130210_create_lesli_user_roles.rb → lib/test/helpers/response_integration_helper.rb} +12 -9
  90. data/{db/migrate/v1/0000100210_create_lesli_system_controller_actions.rb → lib/test/lesli.rb} +28 -9
  91. data/readme.md +61 -68
  92. metadata +49 -121
  93. data/app/helpers/lesli/assets_helper.rb +0 -110
  94. data/app/helpers/lesli/general_helper.rb +0 -96
  95. data/app/mailers/lesli/devise_mailer.rb +0 -67
  96. data/app/models/concerns/lesli/has_activities.rb +0 -29
  97. data/app/models/concerns/lesli/user_activities.rb +0 -163
  98. data/app/models/concerns/lesli/user_security.rb +0 -220
  99. data/app/models/lesli/account/detail.rb +0 -37
  100. data/app/models/lesli/account/log.rb +0 -57
  101. data/app/models/lesli/account/request.rb +0 -37
  102. data/app/models/lesli/descriptor/privilege.rb +0 -39
  103. data/app/models/lesli/descriptor.rb +0 -57
  104. data/app/models/lesli/role/action.rb +0 -73
  105. data/app/models/lesli/role/privilege.rb +0 -38
  106. data/app/models/lesli/system_controller/action.rb +0 -37
  107. data/app/models/lesli/system_controller.rb +0 -104
  108. data/app/models/lesli/user/activity.rb +0 -5
  109. data/app/models/lesli/user/detail.rb +0 -55
  110. data/app/models/lesli/user/request.rb +0 -38
  111. data/app/models/lesli/user/role.rb +0 -39
  112. data/app/models/lesli/user/session.rb +0 -79
  113. data/app/models/lesli/user/setting.rb +0 -46
  114. data/app/operators/lesli/role_operator.rb +0 -153
  115. data/app/services/lesli/role/action_service.rb +0 -75
  116. data/app/services/lesli/user/session_service.rb +0 -78
  117. data/app/validators/lesli/application_lesli_validator.rb +0 -67
  118. data/app/validators/lesli/users_validator.rb +0 -217
  119. data/app/views/lesli/emails/user_mailer/invitation.html.erb +0 -23
  120. data/app/views/lesli/partials/_application-lesli-annoouncements.html.erb +0 -49
  121. data/app/views/lesli/partials/_application-lesli-chatbox.html.erb +0 -35
  122. data/app/views/lesli/partials/_application-lesli-javascript.html.erb +0 -48
  123. data/app/views/lesli/partials/_application-lesli-panels.html.erb +0 -58
  124. data/app/views/lesli/partials/_application-public-footer.html.erb +0 -51
  125. data/app/views/lesli/partials/_application-public-javascript.html.erb +0 -49
  126. data/app/views/lesli/partials/_application-public-scss.html.erb +0 -35
  127. data/app/views/lesli/shared/dashboards/_edit.html.erb +0 -33
  128. data/app/views/lesli/wrappers/_application-devise-simple.erb +0 -59
  129. data/app/views/lesli/wrappers/_application-devise.html.erb +0 -76
  130. data/config/initializers/devise_rails_8_patch.rb +0 -8
  131. data/db/migrate/v1/0000110210_create_lesli_account_details.rb +0 -70
  132. data/db/migrate/v1/0000110410_create_lesli_account_activities.rb +0 -37
  133. data/db/migrate/v1/0000120210_create_lesli_role_actions.rb +0 -45
  134. data/db/migrate/v1/0000120310_create_lesli_role_privileges.rb +0 -45
  135. data/db/migrate/v1/0000130310_create_lesli_user_sessions.rb +0 -56
  136. data/db/migrate/v1/0000130410_create_lesli_user_activities.rb +0 -37
  137. data/db/migrate2/0000100510_create_lesli_account_locations.rb +0 -64
  138. data/db/migrate2/0000100610_create_lesli_account_currencies.rb +0 -48
  139. data/lib/assets/javascripts/lesli/i18n_js +0 -1095
  140. data/lib/migrate/shared/dashboard_structure.rb +0 -54
  141. data/lib/migrate/shared/setting_structure.rb +0 -20
  142. data/lib/rspec/config/spec_coverage.rb +0 -95
  143. data/lib/rspec/factories/lesli_role.rb +0 -62
  144. data/lib/rspec/factories/lesli_user.rb +0 -64
  145. data/lib/rspec/fixtures/files/lesli-icon.png +0 -0
  146. data/lib/rspec/fixtures/files/test_file_1.docx +0 -0
  147. data/lib/rspec/helpers/lesli_helper.rb +0 -54
  148. data/lib/rspec/helpers/rails_helper.rb +0 -134
  149. data/lib/rspec/helpers/response_request_helper.rb +0 -214
  150. data/lib/rspec/helpers/response_service_helper.rb +0 -66
  151. data/lib/rspec/helpers/spec_helper.rb +0 -99
  152. data/lib/rspec/lesli_api_tester.rb +0 -133
  153. data/lib/rspec/lesli_service_tester.rb +0 -46
  154. data/lib/rspec/testers/controller.rb +0 -63
  155. data/lib/rspec/testers/model.rb +0 -36
  156. data/lib/rspec/testers/request.rb +0 -93
@@ -1,54 +0,0 @@
1
- =begin
2
-
3
- Lesli
4
-
5
- Copyright (c) 2025, Lesli Technologies, S. A.
6
-
7
- This program is free software: you can redistribute it and/or modify
8
- it under the terms of the GNU General Public License as published by
9
- the Free Software Foundation, either version 3 of the License, or
10
- (at your option) any later version.
11
-
12
- This program is distributed in the hope that it will be useful,
13
- but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- GNU General Public License for more details.
16
-
17
- You should have received a copy of the GNU General Public License
18
- along with this program. If not, see http://www.gnu.org/licenses/.
19
-
20
- Lesli · Ruby on Rails SaaS Development Framework.
21
-
22
- Made with ♥ by LesliTech
23
- Building a better future, one line of code at a time.
24
-
25
- @contact hello@lesli.tech
26
- @website https://www.lesli.tech
27
- @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
-
29
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
- // ·
31
- =end
32
-
33
- module MigrationHelpers
34
- module Shared
35
- module DashboardStructure
36
- def create_table_lesli_shared_dashboards_10(engine)
37
-
38
- table_name, table_name_account = table_name_for_shared(engine, :dashboards)
39
-
40
- create_table table_name do |t|
41
- t.string :name
42
- t.boolean :default
43
- t.json :components
44
- t.datetime :deleted_at, index: true
45
- t.timestamps
46
- end
47
-
48
- add_reference(table_name, :user, foreign_key: { to_table: :lesli_users }, index: true)
49
- add_reference(table_name, :role, foreign_key: { to_table: :lesli_roles }, index: true)
50
- add_reference(table_name, :account, foreign_key: { to_table: table_name_account }, null: false)
51
- end
52
- end
53
- end
54
- end
@@ -1,20 +0,0 @@
1
-
2
- module MigrationHelpers
3
- module Shared
4
- module SettingStructure
5
- def create_table_lesli_shared_settings_10(engine)
6
-
7
- table_name, table_name_account = table_name_for_shared(engine, :settings)
8
-
9
- create_table table_name do |t|
10
- t.string :name
11
- t.string :value
12
- t.timestamps
13
- end
14
-
15
- add_reference(table_name, :user, foreign_key: { to_table: :lesli_users }, index: true)
16
- add_reference(table_name, :account, null: false, foreign_key: { to_table: table_name_account }, index: true)
17
- end
18
- end
19
- end
20
- end
@@ -1,95 +0,0 @@
1
- =begin
2
-
3
- Lesli
4
-
5
- Copyright (c) 2023, Lesli Technologies, S. A.
6
-
7
- This program is free software: you can redistribute it and/or modify
8
- it under the terms of the GNU General Public License as published by
9
- the Free Software Foundation, either version 3 of the License, or
10
- (at your option) any later version.
11
-
12
- This program is distributed in the hope that it will be useful,
13
- but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- GNU General Public License for more details.
16
-
17
- You should have received a copy of the GNU General Public License
18
- along with this program. If not, see http://www.gnu.org/licenses/.
19
-
20
- Lesli · Ruby on Rails Development Platform.
21
-
22
- Made with ♥ by https://www.lesli.tech
23
- Building a better future, one line of code at a time.
24
-
25
- @contact hello@lesli.tech
26
- @website https://www.lesli.tech
27
- @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
-
29
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
- // ·
31
- =end
32
-
33
-
34
- # Test coverage
35
- require "codecov"
36
- require "simplecov"
37
- require "simplecov-console"
38
- require "simplecov-cobertura"
39
-
40
-
41
- # COVERAGE=true rspec spec
42
- # run test coverage on demand only
43
- if ENV["COVERAGE"]
44
-
45
- # add console stats and html generator
46
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
47
- SimpleCov::Formatter::HTMLFormatter,
48
- SimpleCov::Formatter::Console
49
- ])
50
-
51
- # limit the number of missing lines
52
- SimpleCov::Formatter::Console.missing_len = 100
53
-
54
- # configure the files to track and ignore
55
- SimpleCov.start do
56
-
57
- # remove to track files in these folders
58
- add_filter "/spec"
59
- add_filter "/vendor"
60
-
61
- # temporary exceptions
62
- add_filter "/engines/Lesli/app/lib"
63
- add_filter "/engines/Lesli/app/models"
64
- add_filter "/engines/Lesli/app/helpers"
65
- add_filter "/engines/Lesli/app/mailers"
66
- add_filter "/engines/Lesli/app/services"
67
- add_filter "/engines/Lesli/app/operators"
68
- add_filter "/engines/Lesli/app/validators"
69
- add_filter "/engines/Lesli/app/controllers/lesli/interfaces"
70
- add_filter "/engines/Lesli/app/controllers/lesli/application_controller.rb"
71
- add_filter "/engines/Lesli/app/controllers/lesli/application_lesli_controller.rb"
72
- add_filter "/engines/Lesli/lib/rspec"
73
-
74
- add_filter "/engines/LesliShield"
75
- add_filter "/engines/LesliSupport"
76
- add_filter "/engines/LesliDashboard"
77
- add_filter "/engines/LesliAudit"
78
- end
79
-
80
- # execute test coverage after test suites
81
- # RSpec.configure do |config|
82
- # config.after(:suite) do
83
- # end
84
- # end
85
- end
86
-
87
-
88
- # Sentry codecov integration
89
- if ENV["CODECOV"]
90
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
91
- SimpleCov::Formatter::CoberturaFormatter,
92
- SimpleCov::Formatter::Codecov
93
- ])
94
- SimpleCov.start
95
- end
@@ -1,62 +0,0 @@
1
- =begin
2
-
3
- Lesli
4
-
5
- Copyright (c) 2023, Lesli Technologies, S. A.
6
-
7
- This program is free software: you can redistribute it and/or modify
8
- it under the terms of the GNU General Public License as published by
9
- the Free Software Foundation, either version 3 of the License, or
10
- (at your option) any later version.
11
-
12
- This program is distributed in the hope that it will be useful,
13
- but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- GNU General Public License for more details.
16
-
17
- You should have received a copy of the GNU General Public License
18
- along with this program. If not, see http://www.gnu.org/licenses/.
19
-
20
- Lesli · Your Smart Business Assistant.
21
-
22
- Made with ♥ by https://www.lesli.tech
23
- Building a better future, one line of code at a time.
24
-
25
- @contact hello@lesli.tech
26
- @website https://lesli.tech
27
- @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
-
29
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
- // ·
31
- =end
32
-
33
-
34
- FactoryBot.define do
35
-
36
- # Valid role creation
37
- factory :role, class: "Role" do
38
- name { Faker::Lorem.word }
39
- active { true }
40
- object_level_permission { Faker::Number.number(digits: 2) }
41
- account { Account.first }
42
- end
43
-
44
- # Invalid role
45
- factory :role_not_valid, class: "Role" do
46
- name { nil }
47
- active { nil }
48
- object_level_permission { 0 }
49
- account { Account.first }
50
- end
51
-
52
- # With default path
53
- factory :role_with_default_path, class: "Role" do
54
- name { Faker::Lorem.word }
55
- active { true }
56
- default_path { "/administration/account" }
57
- limit_to_path { true }
58
- object_level_permission { Faker::Number.number(digits: 2) }
59
- account { Account.first }
60
- end
61
-
62
- end
@@ -1,64 +0,0 @@
1
- =begin
2
-
3
- Lesli
4
-
5
- Copyright (c) 2023, Lesli Technologies, S. A.
6
-
7
- This program is free software: you can redistribute it and/or modify
8
- it under the terms of the GNU General Public License as published by
9
- the Free Software Foundation, either version 3 of the License, or
10
- (at your option) any later version.
11
-
12
- This program is distributed in the hope that it will be useful,
13
- but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- GNU General Public License for more details.
16
-
17
- You should have received a copy of the GNU General Public License
18
- along with this program. If not, see http://www.gnu.org/licenses/.
19
-
20
- Lesli · Your Smart Business Assistant.
21
-
22
- Made with ♥ by https://www.lesli.tech
23
- Building a better future, one line of code at a time.
24
-
25
- @contact hello@lesli.tech
26
- @website https://lesli.tech
27
- @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
-
29
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
- // ·
31
- =end
32
-
33
-
34
- # ·
35
- FactoryBot.define do
36
- factory :lesli_user, class: "Lesli::User" do
37
-
38
- active { true }
39
- email { Faker::Internet.email }
40
- salutation { ["mr", "mrs", "ms"][rand(2)] }
41
- first_name { Faker::Name.first_name }
42
- last_name { Faker::Name.last_name }
43
- telephone { Faker::PhoneNumber.phone_number }
44
-
45
- password { Devise.friendly_token }
46
-
47
- account_id { (Lesli::Account.first.nil? ? FactoryBot.create(:lesli_account) : Lesli::Account.first).id }
48
-
49
-
50
- transient do
51
- role_name { "owner" }
52
- end
53
-
54
- before(:create) do |user, evaluator|
55
- user.skip_confirmation!
56
- end
57
-
58
- after(:create) do |user, evaluator|
59
- user.confirm { true }
60
- user.roles.create(role: Lesli::Role.find_by(:name => evaluator.role_name))
61
- end
62
-
63
- end
64
- end
@@ -1,54 +0,0 @@
1
- =begin
2
-
3
- Lesli
4
-
5
- Copyright (c) 2023, Lesli Technologies, S. A.
6
-
7
- This program is free software: you can redistribute it and/or modify
8
- it under the terms of the GNU General Public License as published by
9
- the Free Software Foundation, either version 3 of the License, or
10
- (at your option) any later version.
11
-
12
- This program is distributed in the hope that it will be useful,
13
- but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- GNU General Public License for more details.
16
-
17
- You should have received a copy of the GNU General Public License
18
- along with this program. If not, see http://www.gnu.org/licenses/.
19
-
20
- Lesli · Ruby on Rails Development Platform.
21
-
22
- Made with ♥ by https://www.lesli.tech
23
- Building a better future, one line of code at a time.
24
-
25
- @contact hello@lesli.tech
26
- @website https://www.lesli.tech
27
- @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
-
29
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
- // ·
31
- =end
32
-
33
-
34
- # This module is mainly used as common helpers needed through
35
- # the Core or engines extracting functionalities that take long
36
- # to develop so we prefer to use it like a RSpec module helper
37
-
38
- module LesliHelper
39
-
40
- # @param path [String] the location of the file you want to load
41
- # @return [FILE] image/JSON/HTML/CSV...
42
- # @description This method will look for the file according to the
43
- # path given and return it so will be ready to use in the HTTP request
44
- # @example
45
- # RSpec.describe "POST:administration/account/files" do
46
- # subject(:file_example) { lesli_fixture_file("spec/fixtures/files/lesli-icon.png") }
47
- # it "..." do
48
- # puts "/administration/account/files", params: { file: file_example }
49
- # end
50
- # end
51
- def lesli_fixture_file path
52
- Rack::Test::UploadedFile.new(Rails.root.join(path))
53
- end
54
- end
@@ -1,134 +0,0 @@
1
- =begin
2
-
3
- Lesli
4
-
5
- Copyright (c) 2023, Lesli Technologies, S. A.
6
-
7
- This program is free software: you can redistribute it and/or modify
8
- it under the terms of the GNU General Public License as published by
9
- the Free Software Foundation, either version 3 of the License, or
10
- (at your option) any later version.
11
-
12
- This program is distributed in the hope that it will be useful,
13
- but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- GNU General Public License for more details.
16
-
17
- You should have received a copy of the GNU General Public License
18
- along with this program. If not, see http://www.gnu.org/licenses/.
19
-
20
- Lesli · Ruby on Rails Development Platform.
21
-
22
- Made with ♥ by https://www.lesli.tech
23
- Building a better future, one line of code at a time.
24
-
25
- @contact hello@lesli.tech
26
- @website https://www.lesli.tech
27
- @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
-
29
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
- // ·
31
- =end
32
-
33
-
34
- # ·
35
- ENV["RAILS_ENV"] ||= "test"
36
-
37
-
38
- # Prevent database truncation if the environment is production
39
- abort("The Rails environment is running in production mode!") if Rails.env.production?
40
-
41
-
42
- # ·
43
- require "L2"
44
- require "faker"
45
- require "rspec/rails"
46
- require Lesli::Engine.root.join("lib/rspec/helpers/spec_helper")
47
- require Lesli::Engine.root.join("lib/rspec/config/spec_coverage")
48
-
49
-
50
- # ·
51
- Dir.glob(Lesli::Engine.root.join("lib/rspec/factories/*.rb")).sort.each do |factory|
52
- require_dependency factory
53
- end
54
-
55
-
56
- # Add additional requires below this line. Rails is not loaded until this point!
57
-
58
- # Requires supporting ruby files with custom matchers and macros, etc, in
59
- # lib/rspec/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
60
- # run as spec files by default. This means that files in lib/rspec that end
61
- # in _spec.rb will both be required and run as specs, causing the specs to be
62
- # run twice. It is recommended that you do not name files matching this glob to
63
- # end with _spec.rb. You can configure this pattern with the --pattern
64
- # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
65
- #
66
- # The following line is provided for convenience purposes. It has the downside
67
- # of increasing the boot-up time by auto-requiring all files in the support
68
- # directory. Alternatively, in the individual `*_spec.rb` files, manually
69
- # require only the support files necessary.
70
- #
71
- # Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f }
72
-
73
- # This is not require as we use an updated version of the database and the schema is always up to date
74
-
75
- # Checks for pending migrations and applies them before tests are run.
76
- # If you are not using ActiveRecord, you can remove these lines.
77
- # begin
78
- # ActiveRecord::Migration.maintain_test_schema!
79
- # rescue ActiveRecord::PendingMigrationError => e
80
- # abort e.to_s.strip
81
- # end
82
-
83
-
84
- # ·
85
- RSpec.configure do |config|
86
-
87
- # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
88
- #config.fixture_path = "#{::Rails.root}/spec/fixtures"
89
- #config.fixture_paths << "#{::Rails.root}/spec/fixtures"
90
-
91
- # If you're not using ActiveRecord, or you'd prefer not to run each of your
92
- # examples within a transaction, remove the following line or assign false
93
- # instead of true.
94
- config.use_transactional_fixtures = false
95
-
96
- # RSpec Rails can automatically mix in different behaviours to your tests
97
- # based on their file location, for example enabling you to call `get` and
98
- # `post` in specs under `spec/controllers`.
99
- #
100
- # You can disable this behaviour by removing the line below, and instead
101
- # explicitly tag your specs with their type, e.g.:
102
- #
103
- # RSpec.describe UsersController, :type => :controller do
104
- # # ...
105
- # end
106
- #
107
- # The different available types are documented in the features, such as in
108
- # https://relishapp.com/rspec/rspec-rails/docs
109
- config.infer_spec_type_from_file_location!
110
-
111
- # Filter lines from Rails gems in backtraces.
112
- config.filter_rails_from_backtrace!
113
- # arbitrary gems may also be filtered via:
114
- # config.filter_gems_from_backtrace("gem name")
115
-
116
- end
117
-
118
-
119
- # ·
120
- L2.br(2)
121
-
122
-
123
- # Notify to user...
124
- L2.info(
125
- "Running RSpec tests...",
126
- "For a better result run test over a clean database",
127
- "You can use rake dev:db:reset test before rspec."
128
- )
129
-
130
- # Check if index of controllers exists (needed for authorization)
131
- if Lesli::SystemController.count <= 0
132
- L2.msg "Building controllers index..."
133
- Lesli::ControllerOperator.new.build
134
- end