lesli_testing 0.1.0 → 1.1.0
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/lesli_testing/config.rb +0 -1
- data/lib/lesli_testing/coverage.rb +8 -7
- data/lib/lesli_testing/loader.rb +84 -0
- data/lib/lesli_testing/testers.rb +60 -0
- data/lib/lesli_testing/version.rb +2 -1
- data/lib/lesli_testing.rb +0 -61
- metadata +3 -15
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 64fa5a23a5244e08277309981dfbf032758b801d3c29e6132d009662e0050a06
|
|
4
|
+
data.tar.gz: '08f3fd4da24135ab61e84bf3c6d0ae6ef46a081e7159db1351f5a24df31de2b0'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e82d47aa6744d3a4759e759d6037d86024d67bb2f48732d175b28071305e7f738c6da04d4dd93096fc526569f8a77e7e038d1f806f40b289a59214a9c374ebee
|
|
7
|
+
data.tar.gz: 460536da88ff35bb2be4c5a252824aab1327ad1c23a6de2df2ce731dd9c3d64d199aca943e06b0fba91cc77f4a31c079f074e7b70d18cbce4d96903507c0d2e3
|
data/lib/lesli_testing/config.rb
CHANGED
|
@@ -44,29 +44,30 @@ module LesliTesting
|
|
|
44
44
|
# Define the limit to allow missing tested code
|
|
45
45
|
SimpleCov::Formatter::Console.missing_len = 10
|
|
46
46
|
|
|
47
|
-
SimpleCov.start do
|
|
48
|
-
|
|
47
|
+
SimpleCov.start "rails" do
|
|
48
|
+
command_name engine_name
|
|
49
49
|
|
|
50
50
|
# Standard filters for all Lesli engines
|
|
51
51
|
add_filter [
|
|
52
52
|
"/app/assets",
|
|
53
53
|
"/app/jobs",
|
|
54
54
|
"/config",
|
|
55
|
+
"/docs",
|
|
55
56
|
"/db",
|
|
56
57
|
"/lib/test",
|
|
57
58
|
"/test",
|
|
59
|
+
"/test/dummy/",
|
|
58
60
|
"/vendor"
|
|
59
61
|
]
|
|
60
62
|
|
|
61
63
|
# Add your groups
|
|
62
64
|
add_group "Models", "app/models"
|
|
63
|
-
add_group "
|
|
64
|
-
add_group "Validators", "app/validators"
|
|
65
|
+
add_group "Services", "app/services"
|
|
65
66
|
add_group "Controllers", "app/controllers"
|
|
66
|
-
end
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
# Minimum expected coverage percentage
|
|
69
|
+
minimum_coverage min_coverage
|
|
70
|
+
end
|
|
70
71
|
end
|
|
71
72
|
end
|
|
72
73
|
end
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
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
|
+
|
|
32
|
+
|
|
33
|
+
# Load code coverage tools
|
|
34
|
+
require "simplecov"
|
|
35
|
+
require "simplecov-console"
|
|
36
|
+
require "simplecov-cobertura"
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
# Load test frameworks
|
|
40
|
+
require "minitest/reporters"
|
|
41
|
+
require "color_pound_spec_reporter"
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
# Load test configuration and test helper modules
|
|
45
|
+
require_relative "config"
|
|
46
|
+
require_relative "coverage"
|
|
47
|
+
require_relative "testers"
|
|
48
|
+
|
|
49
|
+
module LesliTesting
|
|
50
|
+
class Error < StandardError; end
|
|
51
|
+
|
|
52
|
+
class << self
|
|
53
|
+
|
|
54
|
+
def start_coverage!(engine_module = nil, options = {})
|
|
55
|
+
return if defined?(SimpleCov) && SimpleCov.running
|
|
56
|
+
|
|
57
|
+
name = engine_module ? engine_module.name : "RailsApp"
|
|
58
|
+
|
|
59
|
+
# Start Coverage
|
|
60
|
+
LesliTesting::Coverage.start(name, options[:min_coverage] || 40)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def configure_tests!(engine_module = nil)
|
|
64
|
+
|
|
65
|
+
# Notify
|
|
66
|
+
show_welcome_message
|
|
67
|
+
|
|
68
|
+
# Apply Minitest/Reporters/Paths
|
|
69
|
+
LesliTesting::Config.apply(engine_module)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
private
|
|
73
|
+
|
|
74
|
+
def show_welcome_message
|
|
75
|
+
L2.info(
|
|
76
|
+
"Running Lesli tests...",
|
|
77
|
+
"For a better result run test over a clean database",
|
|
78
|
+
"You can use: rake dev:db:reset"
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
L2.br
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
Lesli
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2026, 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
|
+
|
|
34
|
+
#
|
|
35
|
+
require_relative "helpers/response_integration_helper"
|
|
36
|
+
|
|
37
|
+
#
|
|
38
|
+
module LesliTesting
|
|
39
|
+
|
|
40
|
+
class IntegrationTester < ActionDispatch::IntegrationTest
|
|
41
|
+
include ResponseIntegrationHelper
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
class ViewTester < ActionView::TestCase
|
|
45
|
+
# We use a hook to include the helpers only when the class is used.
|
|
46
|
+
# This ensures Lesli core is fully loaded by Rails before we ask for the helpers.
|
|
47
|
+
def self.inherited(subclass)
|
|
48
|
+
super
|
|
49
|
+
subclass.class_eval do
|
|
50
|
+
include Lesli::HtmlHelper if defined?(Lesli::HtmlHelper)
|
|
51
|
+
include Lesli::SystemHelper if defined?(Lesli::SystemHelper)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Define the base classes inside the namespace
|
|
57
|
+
class ModelTester < ActiveSupport::TestCase
|
|
58
|
+
include ActiveSupport::Testing::TimeHelpers
|
|
59
|
+
end
|
|
60
|
+
end
|
data/lib/lesli_testing.rb
CHANGED
|
@@ -32,66 +32,5 @@
|
|
|
32
32
|
#
|
|
33
33
|
require_relative "lesli_testing/version"
|
|
34
34
|
|
|
35
|
-
# Load test frameworks
|
|
36
|
-
require "minitest/reporters"
|
|
37
|
-
require "color_pound_spec_reporter"
|
|
38
|
-
require "propshaft"
|
|
39
|
-
|
|
40
|
-
# Load code coverage tools
|
|
41
|
-
require "simplecov"
|
|
42
|
-
require "simplecov-console"
|
|
43
|
-
require "simplecov-cobertura"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
# Load test configuration and test helper modules
|
|
47
|
-
require_relative "lesli_testing/config"
|
|
48
|
-
require_relative "lesli_testing/coverage"
|
|
49
|
-
require_relative "lesli_testing/helpers/response_integration_helper"
|
|
50
|
-
|
|
51
35
|
module LesliTesting
|
|
52
|
-
class Error < StandardError; end
|
|
53
|
-
|
|
54
|
-
class IntegrationTester < ActionDispatch::IntegrationTest
|
|
55
|
-
include ResponseIntegrationHelper
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
class ViewTester < ActionView::TestCase
|
|
59
|
-
# We use a hook to include the helpers only when the class is used.
|
|
60
|
-
# This ensures Lesli core is fully loaded by Rails before we ask for the helpers.
|
|
61
|
-
def self.inherited(subclass)
|
|
62
|
-
super
|
|
63
|
-
subclass.class_eval do
|
|
64
|
-
include Lesli::HtmlHelper if defined?(Lesli::HtmlHelper)
|
|
65
|
-
include Lesli::SystemHelper if defined?(Lesli::SystemHelper)
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
# Define the base classes inside the namespace
|
|
71
|
-
class ModelTester < ActiveSupport::TestCase
|
|
72
|
-
include ActiveSupport::Testing::TimeHelpers
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
class << self
|
|
76
|
-
|
|
77
|
-
def init(engine_module = nil, options = {})
|
|
78
|
-
# 1. Start Coverage
|
|
79
|
-
name = engine_module ? engine_module.name : "RailsApp"
|
|
80
|
-
LesliTesting::Coverage.start(name, options[:min_coverage] || 40)
|
|
81
|
-
|
|
82
|
-
# 2. Apply Minitest/Reporters/Paths
|
|
83
|
-
LesliTesting::Config.apply(engine_module)
|
|
84
|
-
|
|
85
|
-
# 4. Notify
|
|
86
|
-
show_welcome_message
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
private
|
|
90
|
-
|
|
91
|
-
def show_welcome_message
|
|
92
|
-
puts "\n\e[34mRunning Lesli tests...\e[0m"
|
|
93
|
-
puts "For a better result run test over a clean database"
|
|
94
|
-
puts "You can use: \e[33mrake dev:db:reset test\e[0m\n\n"
|
|
95
|
-
end
|
|
96
|
-
end
|
|
97
36
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lesli_testing
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- The Lesli Development Team
|
|
@@ -121,20 +121,6 @@ dependencies:
|
|
|
121
121
|
- - ">="
|
|
122
122
|
- !ruby/object:Gem::Version
|
|
123
123
|
version: '0'
|
|
124
|
-
- !ruby/object:Gem::Dependency
|
|
125
|
-
name: propshaft
|
|
126
|
-
requirement: !ruby/object:Gem::Requirement
|
|
127
|
-
requirements:
|
|
128
|
-
- - ">="
|
|
129
|
-
- !ruby/object:Gem::Version
|
|
130
|
-
version: '0'
|
|
131
|
-
type: :runtime
|
|
132
|
-
prerelease: false
|
|
133
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
134
|
-
requirements:
|
|
135
|
-
- - ">="
|
|
136
|
-
- !ruby/object:Gem::Version
|
|
137
|
-
version: '0'
|
|
138
124
|
description: "Core testing utilities for the Lesli Platform, providing standardized
|
|
139
125
|
Minitest configuration, \ncoverage setup, and shared testing conventions across
|
|
140
126
|
engines and applications.\n"
|
|
@@ -152,6 +138,8 @@ files:
|
|
|
152
138
|
- lib/lesli_testing/config.rb
|
|
153
139
|
- lib/lesli_testing/coverage.rb
|
|
154
140
|
- lib/lesli_testing/helpers/response_integration_helper.rb
|
|
141
|
+
- lib/lesli_testing/loader.rb
|
|
142
|
+
- lib/lesli_testing/testers.rb
|
|
155
143
|
- lib/lesli_testing/version.rb
|
|
156
144
|
- license
|
|
157
145
|
- readme.md
|