lesli_testing 1.1.0 → 1.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 64fa5a23a5244e08277309981dfbf032758b801d3c29e6132d009662e0050a06
4
- data.tar.gz: '08f3fd4da24135ab61e84bf3c6d0ae6ef46a081e7159db1351f5a24df31de2b0'
3
+ metadata.gz: a1a8249474087d791bf470b3fe1b8f7e5aab1eaf16482f474157c1826657debc
4
+ data.tar.gz: fde6fbaf49ef6b37ce71af546a5d8e742da43c7dbd4ac672b99ad535270da0ae
5
5
  SHA512:
6
- metadata.gz: e82d47aa6744d3a4759e759d6037d86024d67bb2f48732d175b28071305e7f738c6da04d4dd93096fc526569f8a77e7e038d1f806f40b289a59214a9c374ebee
7
- data.tar.gz: 460536da88ff35bb2be4c5a252824aab1327ad1c23a6de2df2ce731dd9c3d64d199aca943e06b0fba91cc77f4a31c079f074e7b70d18cbce4d96903507c0d2e3
6
+ metadata.gz: ea2738aa8c621328badb95da25f722003b6439d997141fcaf228c0faab6680df7f4cd6c32aef9335ecf770c764d1c86de66db3511675276b86828735972dca68
7
+ data.tar.gz: b3cd476aaa207022654988df44d4f0515acab88a8b627064c98454655c18a545a1a28e5ac6459f048961092caad2d64a60da51ad22188dfd7a2f014c6939a6b4
@@ -33,9 +33,6 @@ Building a better future, one line of code at a time.
33
33
  module LesliTesting
34
34
  module Config
35
35
  def self.apply(engine_module = nil)
36
-
37
- # Workaround for color_pound_spec_reporter
38
- Object.const_set(:MiniTest, Minitest) unless defined?(MiniTest)
39
36
 
40
37
  # Load dummy app for unit testing
41
38
  # Run tests across all the engines: LESLI_INTEGRATION_TEST=true rails test
@@ -61,12 +58,6 @@ module LesliTesting
61
58
  ActiveSupport::TestCase.fixtures :all
62
59
  end
63
60
  end
64
-
65
- Minitest::Reporters.use!([
66
- Minitest::Reporters::DefaultReporter.new(color: true),
67
- Minitest::Reporters::JUnitReporter.new("coverage/reports"),
68
- ColorPoundSpecReporter.new
69
- ])
70
61
  end
71
62
  end
72
63
  end
@@ -54,7 +54,7 @@ module LesliTesting
54
54
  "/config",
55
55
  "/docs",
56
56
  "/db",
57
- "/lib/test",
57
+ "/lib",
58
58
  "/test",
59
59
  "/test/dummy/",
60
60
  "/vendor"
@@ -37,14 +37,18 @@ require "simplecov-cobertura"
37
37
 
38
38
 
39
39
  # Load test frameworks
40
- require "minitest/reporters"
41
- require "color_pound_spec_reporter"
40
+ require_relative "reporters/cli_reporter"
41
+ require "minitest/lesli_testing_plugin"
42
42
 
43
+ # Force Minitest to know about Lesli Minitest reporter plugin
44
+ unless Minitest.extensions.include?("lesli_testing")
45
+ Minitest.register_plugin("lesli_testing")
46
+ end
43
47
 
44
48
  # Load test configuration and test helper modules
45
- require_relative "config"
46
49
  require_relative "coverage"
47
50
  require_relative "testers"
51
+ require_relative "config"
48
52
 
49
53
  module LesliTesting
50
54
  class Error < StandardError; end
@@ -62,23 +66,8 @@ module LesliTesting
62
66
 
63
67
  def configure_tests!(engine_module = nil)
64
68
 
65
- # Notify
66
- show_welcome_message
67
-
68
69
  # Apply Minitest/Reporters/Paths
69
70
  LesliTesting::Config.apply(engine_module)
70
71
  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
72
  end
84
73
  end
@@ -0,0 +1,125 @@
1
+
2
+ # lib/lesli_testing/reporters/cli_reporter.rb
3
+ require "minitest"
4
+
5
+ module LesliTesting
6
+ module Reporters
7
+ class CliReporter < Minitest::StatisticsReporter
8
+ def start
9
+ super
10
+ Termline.m(
11
+ Termline::Style.colorize(" Running Lesli tests...", :blue),
12
+ Termline::Style.colorize(" -> For a better result run test over a clean database", :blue),
13
+ Termline::Style.colorize(" -> You can use: rake dev:db:reset", :blue)
14
+ )
15
+ Termline.br
16
+ end
17
+
18
+ def record(test)
19
+ super
20
+
21
+ assert_color = :green
22
+ assert_color = :yellow if test.assertions < 5
23
+ assert_color = :red if test.assertions < 2
24
+
25
+ parts = []
26
+ parts << Termline::Style.colorize('['+Time.now.strftime('%H:%M:%S:%L')+']', :gray)
27
+
28
+ case test.result_code
29
+ when "."
30
+ parts << Termline::Style.colorize("PASS", :green)
31
+ when "F"
32
+ parts << Termline::Style.colorize("FAIL", :red)
33
+ when "E"
34
+ parts << Termline::Style.colorize("ERROR", :red)
35
+ when "S"
36
+ parts << Termline::Style.colorize("SKIP", :yellow)
37
+ end
38
+
39
+ parts << '::'
40
+ parts << Termline::Style.colorize(test.klass, :blue)
41
+ parts << '->'
42
+ parts << Termline::Style.colorize(test.name, :skyblue)
43
+ parts << Termline::Style.colorize("(#{ test.assertions} asserts)", assert_color)
44
+ parts << Termline::Style.colorize("#{"(%.2fs)" % test.time}", :red) if test.time > 1
45
+
46
+ puts(parts.compact.join(" ").strip)
47
+ end
48
+
49
+ def report
50
+ super
51
+
52
+ total_tests = count.to_i
53
+ total_failures = failures.to_i
54
+ total_errors = errors.to_i
55
+ total_skips = skips.to_i
56
+ total_assertions = assertions.to_i
57
+ duration = total_time.to_f
58
+
59
+ passed = total_tests - total_failures - total_errors - total_skips
60
+ success_rate = total_tests.zero? ? 0 : ((passed.to_f / total_tests) * 100).round(1)
61
+ status = (total_failures.zero? && total_errors.zero?) ? "PASS" : "FAIL"
62
+
63
+ Termline.br 2
64
+
65
+ status_color = :blue
66
+ status_color = :red if status == 'FAIL'
67
+
68
+ failures_color = :blue
69
+ failures_color = :red if total_failures > 0
70
+
71
+ Termline::Msg.builder(status, tag:'STATUS . . . . . . . :', color: status_color, timestamp:nil)
72
+ Termline::Msg.builder(total_tests, tag:'TESTS. . . . . . . . :', color: :blue, timestamp:nil)
73
+ Termline::Msg.builder(passed, tag:'PASSED . . . . . . . :', color: :blue, timestamp:nil)
74
+ Termline::Msg.builder(total_failures, tag:'FAILURES . . . . . . :', color: failures_color, timestamp:nil)
75
+ Termline::Msg.builder(total_errors, tag:'ERRORS . . . . . . . :', color: :blue, timestamp:nil)
76
+ Termline::Msg.builder(total_skips, tag:'SKIPPED. . . . . . . :', color: :blue, timestamp:nil)
77
+ Termline::Msg.builder(total_assertions, tag:'ASSERTIONS . . . . . :', color: :blue, timestamp:nil)
78
+ Termline::Msg.builder("#{success_rate}%", tag:'SUCCESS RATE . . . . :', color: failures_color, timestamp:nil)
79
+ Termline::Msg.builder(format("%.2fs", duration),tag:'TIME . . . . . . . . :', color: :blue, timestamp:nil)
80
+
81
+ Termline.br 2
82
+
83
+ if status == "PASS"
84
+ Termline.success("Test suite passed")
85
+ else
86
+ Termline.danger("Test suite failed", tag:'FAILURE')
87
+ end
88
+
89
+ Termline.br
90
+
91
+ print_failure_details if total_failures.positive? || total_errors.positive?
92
+
93
+ end
94
+
95
+ private
96
+
97
+ def print_failure_details
98
+ failed_results = Array(results).select { |result| result.failure }
99
+
100
+ return if failed_results.empty?
101
+
102
+ failed_results.each_with_index do |result, index|
103
+ failure = result.failure
104
+ failure_tag = failure.is_a?(Minitest::Assertion) ? "FAILURE" : "ERROR"
105
+ failure_msg = "#{result.class}##{result.name} (#{result.assertions} asserts)"
106
+
107
+ Termline.br
108
+ Termline.line(6)
109
+ Termline.br
110
+
111
+ if failure.is_a?(Minitest::Assertion)
112
+ Termline::Msg.builder(failure_msg, tag: " #{Termline::Style.icon(:error)} #{failure_tag} #{index + 1}:", color: :red, timestamp:nil)
113
+ puts " #{Termline::Style.colorize('Location:', :yellow)} #{result.source_location.first} (line: #{result.source_location.second})"
114
+ puts " #{Termline::Style.colorize(result.failure.message.to_s.lines.first.strip, :green)}"
115
+ puts " #{Termline::Style.colorize(result.failure.message.to_s.lines.second.strip, :red)}"
116
+ else
117
+ Termline.warning(failure_msg, tag: failure_tag)
118
+ end
119
+ end
120
+
121
+ Termline.br
122
+ end
123
+ end
124
+ end
125
+ end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LesliTesting
4
- VERSION = "1.1.0"
5
- BUILD = "1773716607"
4
+ VERSION = "1.2.0"
5
+ BUILD = "1774226154"
6
6
  end
@@ -0,0 +1,11 @@
1
+ require "lesli_testing/reporters/cli_reporter"
2
+
3
+ module Minitest
4
+ def self.plugin_lesli_testing_options(opts, options)
5
+ end
6
+
7
+ def self.plugin_lesli_testing_init(options)
8
+ reporter.reporters.clear if reporter.respond_to?(:reporters)
9
+ reporter << LesliTesting::Reporters::CliReporter.new($stdout, options)
10
+ end
11
+ 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: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Lesli Development Team
@@ -10,117 +10,89 @@ cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
- name: minitest-reporters
14
- requirement: !ruby/object:Gem::Requirement
15
- requirements:
16
- - - ">="
17
- - !ruby/object:Gem::Version
18
- version: '0'
19
- type: :runtime
20
- prerelease: false
21
- version_requirements: !ruby/object:Gem::Requirement
22
- requirements:
23
- - - ">="
24
- - !ruby/object:Gem::Version
25
- version: '0'
26
- - !ruby/object:Gem::Dependency
27
- name: color_pound_spec_reporter
13
+ name: minitest
28
14
  requirement: !ruby/object:Gem::Requirement
29
15
  requirements:
30
- - - ">="
16
+ - - "~>"
31
17
  - !ruby/object:Gem::Version
32
- version: '0'
18
+ version: 6.0.0
33
19
  type: :runtime
34
20
  prerelease: false
35
21
  version_requirements: !ruby/object:Gem::Requirement
36
22
  requirements:
37
- - - ">="
23
+ - - "~>"
38
24
  - !ruby/object:Gem::Version
39
- version: '0'
25
+ version: 6.0.0
40
26
  - !ruby/object:Gem::Dependency
41
27
  name: simplecov
42
28
  requirement: !ruby/object:Gem::Requirement
43
29
  requirements:
44
- - - '='
30
+ - - "~>"
45
31
  - !ruby/object:Gem::Version
46
32
  version: 0.22.0
47
33
  type: :runtime
48
34
  prerelease: false
49
35
  version_requirements: !ruby/object:Gem::Requirement
50
36
  requirements:
51
- - - '='
37
+ - - "~>"
52
38
  - !ruby/object:Gem::Version
53
39
  version: 0.22.0
54
40
  - !ruby/object:Gem::Dependency
55
41
  name: simplecov-console
56
42
  requirement: !ruby/object:Gem::Requirement
57
43
  requirements:
58
- - - '='
44
+ - - "~>"
59
45
  - !ruby/object:Gem::Version
60
- version: 0.9.4
46
+ version: 0.9.0
61
47
  type: :runtime
62
48
  prerelease: false
63
49
  version_requirements: !ruby/object:Gem::Requirement
64
50
  requirements:
65
- - - '='
51
+ - - "~>"
66
52
  - !ruby/object:Gem::Version
67
- version: 0.9.4
53
+ version: 0.9.0
68
54
  - !ruby/object:Gem::Dependency
69
55
  name: simplecov-cobertura
70
56
  requirement: !ruby/object:Gem::Requirement
71
57
  requirements:
72
- - - ">="
58
+ - - "~>"
73
59
  - !ruby/object:Gem::Version
74
- version: '0'
60
+ version: 3.1.0
75
61
  type: :runtime
76
62
  prerelease: false
77
63
  version_requirements: !ruby/object:Gem::Requirement
78
64
  requirements:
79
- - - ">="
65
+ - - "~>"
80
66
  - !ruby/object:Gem::Version
81
- version: '0'
67
+ version: 3.1.0
82
68
  - !ruby/object:Gem::Dependency
83
69
  name: brakeman
84
- requirement: !ruby/object:Gem::Requirement
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- version: '0'
89
- type: :runtime
90
- prerelease: false
91
- version_requirements: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - ">="
94
- - !ruby/object:Gem::Version
95
- version: '0'
96
- - !ruby/object:Gem::Dependency
97
- name: minitest
98
70
  requirement: !ruby/object:Gem::Requirement
99
71
  requirements:
100
72
  - - "~>"
101
73
  - !ruby/object:Gem::Version
102
- version: '5.0'
74
+ version: 8.0.0
103
75
  type: :runtime
104
76
  prerelease: false
105
77
  version_requirements: !ruby/object:Gem::Requirement
106
78
  requirements:
107
79
  - - "~>"
108
80
  - !ruby/object:Gem::Version
109
- version: '5.0'
81
+ version: 8.0.0
110
82
  - !ruby/object:Gem::Dependency
111
83
  name: letter_opener
112
84
  requirement: !ruby/object:Gem::Requirement
113
85
  requirements:
114
- - - ">="
86
+ - - "~>"
115
87
  - !ruby/object:Gem::Version
116
- version: '0'
88
+ version: 1.10.0
117
89
  type: :runtime
118
90
  prerelease: false
119
91
  version_requirements: !ruby/object:Gem::Requirement
120
92
  requirements:
121
- - - ">="
93
+ - - "~>"
122
94
  - !ruby/object:Gem::Version
123
- version: '0'
95
+ version: 1.10.0
124
96
  description: "Core testing utilities for the Lesli Platform, providing standardized
125
97
  Minitest configuration, \ncoverage setup, and shared testing conventions across
126
98
  engines and applications.\n"
@@ -130,20 +102,17 @@ executables: []
130
102
  extensions: []
131
103
  extra_rdoc_files: []
132
104
  files:
133
- - ".editorconfig"
134
- - Rakefile
135
- - docs/images/testing-logo.svg
136
- - lesli.txt
137
105
  - lib/lesli_testing.rb
138
106
  - lib/lesli_testing/config.rb
139
107
  - lib/lesli_testing/coverage.rb
140
108
  - lib/lesli_testing/helpers/response_integration_helper.rb
141
109
  - lib/lesli_testing/loader.rb
110
+ - lib/lesli_testing/reporters/cli_reporter.rb
142
111
  - lib/lesli_testing/testers.rb
143
112
  - lib/lesli_testing/version.rb
113
+ - lib/minitest/lesli_testing_plugin.rb
144
114
  - license
145
115
  - readme.md
146
- - sig/lesli_testing.rbs
147
116
  homepage: https://www.lesli.dev/
148
117
  licenses:
149
118
  - GPL-3.0-or-later
data/.editorconfig DELETED
@@ -1,20 +0,0 @@
1
- # Lesli
2
- # For more information read the license file including with this software.
3
-
4
- # top-most EditorConfig file
5
- root = true
6
-
7
- # Unix-style newlines with a newline ending every file
8
- [*]
9
- end_of_line = lf
10
- insert_final_newline = true
11
-
12
- [*.{rake,rb,ts,vue,js,json,yml,scss,styl,css,html,haml,erb,md,thor,mjml,.gemspec,.template}]
13
- indent_style = space
14
- indent_size = 4
15
- charset = utf-8
16
-
17
- [.github/*.{yml}]
18
- indent_size = 2
19
-
20
- # EditorConfig is awesome: https://EditorConfig.org
data/Rakefile DELETED
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
- require "minitest/test_task"
5
-
6
- Minitest::TestTask.create
7
-
8
- task default: :test
@@ -1,21 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="none">
2
- <rect x="64" y="20" width="320" height="420" rx="20" fill="#E2E8F0" />
3
-
4
- <rect x="110" y="80" width="230" height="15" rx="7.5" fill="#475569" />
5
- <rect x="110" y="115" width="230" height="15" rx="7.5" fill="#475569" />
6
- <rect x="110" y="150" width="120" height="15" rx="7.5" fill="#475569" />
7
-
8
- <rect x="90" y="210" width="85" height="85" rx="12" fill="#A855F7" />
9
- <path d="M110 252 l15 15 l30 -30" stroke="#fff" stroke-width="12" fill="none" stroke-linecap="round" stroke-linejoin="round" />
10
- <rect x="200" y="225" width="120" height="12" rx="6" fill="#475569" />
11
- <rect x="200" y="255" width="80" height="12" rx="6" fill="#475569" />
12
-
13
- <rect x="90" y="325" width="85" height="85" rx="12" fill="#22C55E" />
14
- <path d="M110 367 l15 15 l30 -30" stroke="#fff" stroke-width="12" fill="none" stroke-linecap="round" stroke-linejoin="round" />
15
- <rect x="200" y="340" width="120" height="12" rx="6" fill="#475569" />
16
- <rect x="200" y="370" width="80" height="12" rx="6" fill="#475569" />
17
-
18
- <path d="M305 230 h110 a15 15 0 0 1 15 15 v10 a15 15 0 0 1 -15 15 h-110 a15 15 0 0 1 -15 -15 v-10 a15 15 0 0 1 15 -15" fill="#3B82F6" />
19
- <path d="M320 270 v150 a50 50 0 0 0 100 0 v-150" fill="#60A5FA" />
20
- <rect x="340" y="300" width="60" height="110" rx="30" fill="#EAB308" />
21
- </svg>
data/lesli.txt DELETED
@@ -1,28 +0,0 @@
1
- Lesli
2
-
3
- Copyright (c) 2025, Lesli Technologies, S. A.
4
-
5
- This program is free software: you can redistribute it and/or modify
6
- it under the terms of the GNU General Public License as published by
7
- the Free Software Foundation, either version 3 of the License, or
8
- (at your option) any later version.
9
-
10
- This program is distributed in the hope that it will be useful,
11
- but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- GNU General Public License for more details.
14
-
15
- You should have received a copy of the GNU General Public License
16
- along with this program. If not, see http://www.gnu.org/licenses/.
17
-
18
- Lesli · Ruby on Rails SaaS Development Framework.
19
-
20
- Made with ♥ by LesliTech
21
- Building a better future, one line of code at a time.
22
-
23
- @contact hello@lesli.tech
24
- @website https://www.lesli.tech
25
- @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
26
-
27
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
28
- // ·
@@ -1,4 +0,0 @@
1
- module LesliTesting
2
- VERSION: String
3
- # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
- end