lesli_testing 1.2.4 → 1.3.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/coverage.rb +32 -35
- data/lib/lesli_testing/fixtures.rb +72 -0
- data/lib/lesli_testing/{reporters → minitest}/cli_reporter.rb +30 -2
- data/lib/lesli_testing/simplecov/profiles.rb +45 -0
- data/lib/lesli_testing/version.rb +1 -1
- data/lib/lesli_testing.rb +120 -31
- data/lib/minitest/lesli_testing_plugin.rb +2 -1
- data/readme.md +45 -20
- metadata +4 -4
- data/lib/lesli_testing/config.rb +0 -68
- data/lib/lesli_testing/loader.rb +0 -82
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bdacbd0fd03af65afdbaed58961bd85ecf8d1a1868af0f4aeddf9867245767c0
|
|
4
|
+
data.tar.gz: 789586b828f9bf72666eba3a017e58213d17ad1cca1ee398e109a3dcbd9db28f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a0a8abf6b75c318a8c8246c9b304926115d1105b5f667bcd33b245905501363dcb1fb042bb09f0240c17a5a738cd69032214cba941ac32f3a9e1dc589ec62df4
|
|
7
|
+
data.tar.gz: b0e95f307cf5422ec7425aaf0466da0024dcdafd743f371b8c26d9a9bb13751a161366f5696b284f0c7208842919564f2214a88e996b06a1206cfadc4387b55d
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
=begin
|
|
2
4
|
|
|
3
5
|
Lesli
|
|
@@ -30,43 +32,38 @@ Building a better future, one line of code at a time.
|
|
|
30
32
|
// ·
|
|
31
33
|
=end
|
|
32
34
|
|
|
35
|
+
|
|
36
|
+
# Load code coverage tools
|
|
37
|
+
require "simplecov"
|
|
38
|
+
require "simplecov-html"
|
|
39
|
+
require "simplecov-console"
|
|
40
|
+
require "simplecov-cobertura"
|
|
41
|
+
require_relative "simplecov/profiles"
|
|
42
|
+
|
|
43
|
+
|
|
33
44
|
module LesliTesting
|
|
34
45
|
module Coverage
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
SimpleCov::Formatter::
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"/db",
|
|
57
|
-
"/test",
|
|
58
|
-
"/test/dummy/",
|
|
59
|
-
"/lib/tasks",
|
|
60
|
-
"/vendor"
|
|
61
|
-
]
|
|
62
|
-
|
|
63
|
-
# Add your groups
|
|
64
|
-
add_group "Models", "app/models"
|
|
65
|
-
add_group "Services", "app/services"
|
|
66
|
-
add_group "Controllers", "app/controllers"
|
|
67
|
-
|
|
68
|
-
# Minimum expected coverage percentage
|
|
69
|
-
minimum_coverage min_coverage
|
|
46
|
+
class << self
|
|
47
|
+
|
|
48
|
+
def start(app_name, profile:"rails", min_coverage:90, missing_len:25)
|
|
49
|
+
|
|
50
|
+
# Add coverage formatters
|
|
51
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
|
|
52
|
+
SimpleCov::Formatter::CoberturaFormatter,
|
|
53
|
+
SimpleCov::Formatter::HTMLFormatter,
|
|
54
|
+
SimpleCov::Formatter::Console
|
|
55
|
+
])
|
|
56
|
+
|
|
57
|
+
# Define the limit to allow missing tested code
|
|
58
|
+
SimpleCov::Formatter::Console.missing_len = missing_len
|
|
59
|
+
|
|
60
|
+
SimpleCov.start "lesli_rails_#{profile}" do
|
|
61
|
+
|
|
62
|
+
command_name(app_name)
|
|
63
|
+
|
|
64
|
+
# Minimum expected coverage percentage
|
|
65
|
+
minimum_coverage(min_coverage)
|
|
66
|
+
end
|
|
70
67
|
end
|
|
71
68
|
end
|
|
72
69
|
end
|
|
@@ -0,0 +1,72 @@
|
|
|
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
|
+
module LesliTesting
|
|
34
|
+
module Fixtures
|
|
35
|
+
class << self
|
|
36
|
+
def load_fixtures_for_lesli()
|
|
37
|
+
|
|
38
|
+
if defined?(Lesli)
|
|
39
|
+
ActiveSupport.on_load(:active_support_test_case) do
|
|
40
|
+
# En Rails 8, usamos ActiveRecord::TestFixtures si está disponible
|
|
41
|
+
include ActiveRecord::TestFixtures if defined?(ActiveRecord::TestFixtures)
|
|
42
|
+
|
|
43
|
+
lesli_fixtures = Lesli::Engine.root.join("test", "fixtures").to_s
|
|
44
|
+
lesli_files = Lesli::Engine.root.join("test", "fixtures", "files").to_s
|
|
45
|
+
|
|
46
|
+
# Rails 8 usa fixture_paths (plural) como el estándar
|
|
47
|
+
# Pero para evitar el NoMethodError, lo asignamos de forma segura:
|
|
48
|
+
if respond_to?(:fixture_paths=)
|
|
49
|
+
# Combinamos las rutas existentes con la nueva del Engine
|
|
50
|
+
self.fixture_paths |= [ lesli_fixtures ]
|
|
51
|
+
else
|
|
52
|
+
# Fallback por si la carga de ActiveRecord se retrasa
|
|
53
|
+
class_attribute :fixture_paths, default: [ lesli_fixtures ]
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Los archivos adjuntos (Active Storage, etc)
|
|
57
|
+
self.file_fixture_path = lesli_files
|
|
58
|
+
|
|
59
|
+
# IMPORTANT: attach fixture sets to namespaced models BEFORE loading fixtures
|
|
60
|
+
self.set_fixture_class(
|
|
61
|
+
lesli_users: "Lesli::User",
|
|
62
|
+
lesli_accounts: "Lesli::Account"
|
|
63
|
+
)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def load_fixtures_for_engine(engine_module)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
@@ -1,6 +1,34 @@
|
|
|
1
|
+
=begin
|
|
1
2
|
|
|
2
|
-
|
|
3
|
-
|
|
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
|
|
4
32
|
|
|
5
33
|
module LesliTesting
|
|
6
34
|
module Reporters
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
SimpleCov.profiles.define "lesli_rails_app" do
|
|
34
|
+
load_profile "rails"
|
|
35
|
+
track_files "{app,lib,engines,gems}/**/*.rb"
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
SimpleCov.profiles.define "lesli_rails_engine" do
|
|
39
|
+
load_profile "rails"
|
|
40
|
+
add_filter %r{^/test/}
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
SimpleCov.profiles.define "lesli_rails_gem" do
|
|
44
|
+
load_profile "rails"
|
|
45
|
+
end
|
data/lib/lesli_testing.rb
CHANGED
|
@@ -1,37 +1,126 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
3
|
+
=begin
|
|
4
|
+
|
|
5
|
+
Lesli
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2026, Lesli Technologies, S. A.
|
|
8
|
+
|
|
9
|
+
This program is free software: you can redistribute it and/or modify
|
|
10
|
+
it under the terms of the GNU General Public License as published by
|
|
11
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
(at your option) any later version.
|
|
13
|
+
|
|
14
|
+
This program is distributed in the hope that it will be useful,
|
|
15
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
GNU General Public License for more details.
|
|
18
|
+
|
|
19
|
+
You should have received a copy of the GNU General Public License
|
|
20
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
|
21
|
+
|
|
22
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
|
23
|
+
|
|
24
|
+
Made with ♥ by LesliTech
|
|
25
|
+
Building a better future, one line of code at a time.
|
|
26
|
+
|
|
27
|
+
@contact hello@lesli.tech
|
|
28
|
+
@website https://www.lesli.tech
|
|
29
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
|
30
|
+
|
|
31
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
|
32
|
+
// ·
|
|
33
|
+
=end
|
|
34
|
+
|
|
35
|
+
|
|
33
36
|
require_relative "lesli_testing/version"
|
|
34
|
-
|
|
37
|
+
|
|
35
38
|
|
|
36
39
|
module LesliTesting
|
|
40
|
+
class Error < StandardError; end
|
|
41
|
+
|
|
42
|
+
class << self
|
|
43
|
+
|
|
44
|
+
attr_accessor :app_module;
|
|
45
|
+
attr_accessor :app_name;
|
|
46
|
+
attr_writer :options
|
|
47
|
+
|
|
48
|
+
def app(name, options = {})
|
|
49
|
+
configure(name, options.merge(coverage_profile: "app"))
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def engine(name, options = {})
|
|
53
|
+
configure(name, options.merge(coverage_profile: "engine"))
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def gem(name, options = {})
|
|
57
|
+
configure(name, options.merge(coverage_profile: "gem"))
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
private
|
|
61
|
+
|
|
62
|
+
def options
|
|
63
|
+
@options ||= options_default
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def options_default
|
|
67
|
+
{
|
|
68
|
+
coverage_profile: "app",
|
|
69
|
+
coverage_missing_len: 25,
|
|
70
|
+
coverage_min_coverage: 90
|
|
71
|
+
}
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def configure(name, options)
|
|
75
|
+
self.app_name = name
|
|
76
|
+
self.options = options_default.merge(options)
|
|
77
|
+
configure_gems()
|
|
78
|
+
configure_reporter()
|
|
79
|
+
configure_coverage()
|
|
80
|
+
configure_fixtures()
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def configure_coverage()
|
|
84
|
+
|
|
85
|
+
return unless ENV["COVERAGE"]
|
|
86
|
+
return if defined?(SimpleCov) && SimpleCov.running
|
|
87
|
+
|
|
88
|
+
# Start Coverage
|
|
89
|
+
LesliTesting::Coverage.start(
|
|
90
|
+
self.app_name,
|
|
91
|
+
profile: self.options[:coverage_profile],
|
|
92
|
+
missing_len: self.options[:coverage_missing_len],
|
|
93
|
+
min_coverage: self.options[:coverage_min_coverage]
|
|
94
|
+
)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Load test configuration and test helper modules
|
|
98
|
+
def configure_fixtures()
|
|
99
|
+
LesliTesting::Fixtures.load_fixtures_for_lesli()
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def configure_reporter
|
|
103
|
+
# Force Minitest to know about Lesli Minitest reporter plugin
|
|
104
|
+
unless Minitest.extensions.include?("lesli_testing")
|
|
105
|
+
Minitest.register_plugin("lesli_testing")
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def configure_gems
|
|
110
|
+
return if @tools_loaded
|
|
111
|
+
|
|
112
|
+
#require "minitest"
|
|
113
|
+
|
|
114
|
+
# Load minitest plugin
|
|
115
|
+
require "minitest/lesli_testing_plugin"
|
|
116
|
+
require "termline" unless defined?(Termline)
|
|
117
|
+
|
|
118
|
+
# Load helper files
|
|
119
|
+
require_relative "lesli_testing/testers"
|
|
120
|
+
require_relative "lesli_testing/fixtures"
|
|
121
|
+
require_relative "lesli_testing/coverage"
|
|
122
|
+
|
|
123
|
+
@tools_loaded = true
|
|
124
|
+
end
|
|
125
|
+
end
|
|
37
126
|
end
|
data/readme.md
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
### Quick start
|
|
12
12
|
|
|
13
|
+
<br />
|
|
14
|
+
|
|
13
15
|
|
|
14
16
|
**Install LesliTesting gem**
|
|
15
17
|
|
|
@@ -17,33 +19,32 @@
|
|
|
17
19
|
bundle add lesli_testing
|
|
18
20
|
```
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
<br />
|
|
23
|
+
|
|
24
|
+
**Include LesliTesting in your test_helper.rb file**
|
|
21
25
|
|
|
22
26
|
```ruby
|
|
23
|
-
|
|
24
|
-
# load lesli testing tools
|
|
25
|
-
require "lesli_testing/loader"
|
|
27
|
+
ENV["RAILS_ENV"] ||= "test"
|
|
26
28
|
|
|
27
29
|
|
|
28
|
-
#
|
|
29
|
-
|
|
30
|
+
# Load LesliTesting tools
|
|
31
|
+
require "lesli_testing"
|
|
30
32
|
|
|
31
33
|
|
|
32
|
-
#
|
|
33
|
-
LesliTesting.
|
|
34
|
+
# Configure leslitesting tools for a rails engine
|
|
35
|
+
LesliTesting.engine("LesliShield")
|
|
34
36
|
|
|
35
37
|
|
|
36
|
-
#
|
|
37
|
-
|
|
38
|
-
ActiveRecord::Migrator.migrations_paths = [ File.expand_path("../test/dummy/db/migrate", __dir__) ]
|
|
39
|
-
ActiveRecord::Migrator.migrations_paths << File.expand_path("../db/migrate", __dir__)
|
|
40
|
-
require "rails/test_help"
|
|
38
|
+
# Configure lesli testing tools for a rails app
|
|
39
|
+
LesliTesting.app("LesliBuilder")
|
|
41
40
|
|
|
42
41
|
|
|
43
|
-
#
|
|
44
|
-
LesliTesting.
|
|
42
|
+
# # Configure leslitesting tools for a ruby gem
|
|
43
|
+
LesliTesting.gem("LesliDate")
|
|
45
44
|
```
|
|
46
45
|
|
|
46
|
+
<br />
|
|
47
|
+
|
|
47
48
|
**Run your tests D:**
|
|
48
49
|
|
|
49
50
|
```shell
|
|
@@ -52,8 +53,14 @@ rails test
|
|
|
52
53
|
# or
|
|
53
54
|
|
|
54
55
|
COVERAGE=true rails test
|
|
56
|
+
|
|
57
|
+
# or run like github actions
|
|
58
|
+
|
|
59
|
+
COVERAGE=true CI=true rails test
|
|
55
60
|
```
|
|
56
61
|
|
|
62
|
+
<br />
|
|
63
|
+
|
|
57
64
|
**Result :D**
|
|
58
65
|
|
|
59
66
|
<div align="center">
|
|
@@ -63,6 +70,25 @@ COVERAGE=true rails test
|
|
|
63
70
|
</div>
|
|
64
71
|
|
|
65
72
|
<br />
|
|
73
|
+
|
|
74
|
+
### Options
|
|
75
|
+
|
|
76
|
+
The following options can be used to customize coverage behavior in `LesliTesting`.
|
|
77
|
+
|
|
78
|
+
| Option | Type | Default | Description |
|
|
79
|
+
| ----------------------- | ------- | ------: | ------------------------------------------ |
|
|
80
|
+
| `coverage_missing_len` | Integer | `25` | Minimum width for missing coverage output. |
|
|
81
|
+
| `coverage_min_coverage` | Integer | `40` | Minimum expected coverage percentage. |
|
|
82
|
+
|
|
83
|
+
**Example:**
|
|
84
|
+
|
|
85
|
+
```ruby
|
|
86
|
+
LesliTesting.configure(LesliShield, {
|
|
87
|
+
coverage_missing_len: 30,
|
|
88
|
+
coverage_min_coverage: 80
|
|
89
|
+
})
|
|
90
|
+
```
|
|
91
|
+
|
|
66
92
|
<br />
|
|
67
93
|
|
|
68
94
|
### Documentation
|
|
@@ -76,6 +102,7 @@ COVERAGE=true rails test
|
|
|
76
102
|
* [Email: hello@lesli.tech](hello@lesli.tech)
|
|
77
103
|
* [Website: https://www.lesli.tech](https://www.lesli.tech)
|
|
78
104
|
|
|
105
|
+
<br />
|
|
79
106
|
|
|
80
107
|
### License
|
|
81
108
|
-------
|
|
@@ -94,17 +121,15 @@ GNU General Public License for more details.
|
|
|
94
121
|
You should have received a copy of the GNU General Public License
|
|
95
122
|
along with this program. If not, see http://www.gnu.org/licenses/.
|
|
96
123
|
|
|
97
|
-
<br />
|
|
98
124
|
<hr />
|
|
99
125
|
<br />
|
|
100
126
|
<br />
|
|
101
127
|
|
|
102
128
|
<div align="center" class="has-text-centered">
|
|
103
|
-
<img width="
|
|
104
|
-
<
|
|
129
|
+
<img width="80" alt="Lesli logo" src="https://cdn.lesli.tech/lesli/brand/app-icon.svg" />
|
|
130
|
+
<h4 align="center" class="mt-0">
|
|
105
131
|
The Open-Source SaaS Development Framework for Ruby on Rails.
|
|
106
|
-
</
|
|
132
|
+
</h4>
|
|
107
133
|
</div>
|
|
108
134
|
|
|
109
135
|
<br />
|
|
110
|
-
<br />
|
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: 1.
|
|
4
|
+
version: 1.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- The Lesli Development Team
|
|
@@ -117,12 +117,12 @@ extensions: []
|
|
|
117
117
|
extra_rdoc_files: []
|
|
118
118
|
files:
|
|
119
119
|
- lib/lesli_testing.rb
|
|
120
|
-
- lib/lesli_testing/config.rb
|
|
121
120
|
- lib/lesli_testing/coverage.rb
|
|
122
121
|
- lib/lesli_testing/engine.rb
|
|
122
|
+
- lib/lesli_testing/fixtures.rb
|
|
123
123
|
- lib/lesli_testing/helpers/response_integration_helper.rb
|
|
124
|
-
- lib/lesli_testing/
|
|
125
|
-
- lib/lesli_testing/
|
|
124
|
+
- lib/lesli_testing/minitest/cli_reporter.rb
|
|
125
|
+
- lib/lesli_testing/simplecov/profiles.rb
|
|
126
126
|
- lib/lesli_testing/testers.rb
|
|
127
127
|
- lib/lesli_testing/version.rb
|
|
128
128
|
- lib/minitest/lesli_testing_plugin.rb
|
data/lib/lesli_testing/config.rb
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
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
|
-
module LesliTesting
|
|
34
|
-
module Config
|
|
35
|
-
def self.apply(engine_module = nil)
|
|
36
|
-
|
|
37
|
-
if defined?(Lesli)
|
|
38
|
-
# Load fixtures from Lesli
|
|
39
|
-
if ActiveSupport::TestCase.respond_to?(:fixture_paths=)
|
|
40
|
-
ActiveSupport::TestCase.fixture_paths = [ Lesli::Engine.root.join("test", "fixtures").to_s ]
|
|
41
|
-
ActionDispatch::IntegrationTest.fixture_paths = ActiveSupport::TestCase.fixture_paths
|
|
42
|
-
ActiveSupport::TestCase.file_fixture_path = Lesli::Engine.root.join("test", "fixtures", "files").to_s
|
|
43
|
-
|
|
44
|
-
# IMPORTANT: attach fixture sets to namespaced models BEFORE loading fixtures
|
|
45
|
-
ActiveSupport::TestCase.set_fixture_class(
|
|
46
|
-
lesli_users: "Lesli::User",
|
|
47
|
-
lesli_accounts: "Lesli::Account"
|
|
48
|
-
)
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
# Load dummy app for unit testing
|
|
53
|
-
# Run tests across all the engines: LESLI_INTEGRATION_TEST=true rails test
|
|
54
|
-
# Run tests for the current engine: rails test
|
|
55
|
-
if engine_module
|
|
56
|
-
|
|
57
|
-
# Load fixtures from the engine
|
|
58
|
-
if ActiveSupport::TestCase.respond_to?(:fixture_paths=)
|
|
59
|
-
ActiveSupport::TestCase.fixture_paths = [ engine_module.root.join("test", "fixtures").to_s ]
|
|
60
|
-
ActionDispatch::IntegrationTest.fixture_paths = ActiveSupport::TestCase.fixture_paths
|
|
61
|
-
ActiveSupport::TestCase.file_fixture_path = engine_module.root.join("test", "fixtures", "files").to_s
|
|
62
|
-
|
|
63
|
-
ActiveSupport::TestCase.fixtures :all
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
end
|
data/lib/lesli_testing/loader.rb
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
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/lesli_testing_plugin"
|
|
41
|
-
require_relative "reporters/cli_reporter"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
# Force Minitest to know about Lesli Minitest reporter plugin
|
|
45
|
-
unless Minitest.extensions.include?("lesli_testing")
|
|
46
|
-
Minitest.register_plugin("lesli_testing")
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
# Load test configuration and test helper modules
|
|
51
|
-
require_relative "coverage"
|
|
52
|
-
require_relative "testers"
|
|
53
|
-
require_relative "config"
|
|
54
|
-
|
|
55
|
-
module LesliTesting
|
|
56
|
-
class Error < StandardError; end
|
|
57
|
-
|
|
58
|
-
class << self
|
|
59
|
-
|
|
60
|
-
attr_accessor :engine_module;
|
|
61
|
-
|
|
62
|
-
def configure(engine_module = nil)
|
|
63
|
-
self.engine_module = engine_module
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def configure_coverage(options)
|
|
67
|
-
|
|
68
|
-
engine_name = self.engine_module ? self.engine_module.name : "RailsApp"
|
|
69
|
-
|
|
70
|
-
return if defined?(SimpleCov) && SimpleCov.running
|
|
71
|
-
|
|
72
|
-
# Start Coverage
|
|
73
|
-
LesliTesting::Coverage.start(engine_name, options[:min_coverage] || 40)
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
def configure_engine()
|
|
77
|
-
|
|
78
|
-
# Apply Minitest/Reporters/Paths
|
|
79
|
-
LesliTesting::Config.apply(self.engine_module)
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
end
|