lesli_testing 1.4.1 → 1.4.2

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.
data/readme.md CHANGED
@@ -8,8 +8,8 @@
8
8
  <br />
9
9
 
10
10
  <div align="center">
11
- <a target="_blank" href="https://github.com/LesliTech/LesliTesting/actions/workflows/main.yml">
12
- <img alt="LesliTesting test status" src="https://img.shields.io/github/actions/workflow/status/LesliTech/LesliTesting/main.yml?branch=main&style=for-the-badge&logo=github&label=tests">
11
+ <a target="_blank" href="https://github.com/LesliTech/LesliTesting/actions/workflows/lesli-ci-gem.yaml">
12
+ <img alt="LesliTesting test status" src="https://img.shields.io/github/actions/workflow/status/LesliTech/LesliTesting/lesli-ci-gem.yaml?branch=master&style=for-the-badge&logo=github&label=tests">
13
13
  </a>
14
14
  <a target="_blank" href="https://rubygems.org/gems/lesli_testing">
15
15
  <img alt="Gem Version" src="https://img.shields.io/gem/v/lesli_testing?style=for-the-badge&logo=ruby">
@@ -49,14 +49,14 @@ It standardizes Minitest output, SimpleCov profiles, coverage reports, and fixtu
49
49
 
50
50
  - Coverage profiles for Rails applications, Rails engines, and Ruby gems
51
51
  - A human-friendly Minitest reporter with per-test timing and failure details
52
- - SimpleCov HTML, console, and Cobertura reports
52
+ - SimpleCov console and Cobertura reports
53
53
  - Configurable minimum coverage thresholds
54
54
  - Shared base classes for integration, model, and view tests
55
- - Automatic access to Lesli fixtures in Rails test cases
55
+ - Automatic engine, shared Lesli fixture, and migration paths
56
56
 
57
57
  <br />
58
58
 
59
- ## Quick Start
59
+ ## Quick start
60
60
 
61
61
  Add LesliTesting to the test group:
62
62
 
@@ -64,17 +64,48 @@ Add LesliTesting to the test group:
64
64
  bundle add lesli_testing --group test
65
65
  ```
66
66
 
67
- Require the gem from `test/test_helper.rb` and select exactly one profile for the project:
67
+ Require the gem from `test/test_helper.rb` and select exactly one profile for
68
+ the project. Configure LesliTesting before loading Rails or the library under
69
+ test.
70
+
71
+ ### Rails application
68
72
 
69
73
  ```ruby
74
+ ENV["RAILS_ENV"] ||= "test"
75
+
76
+ require "lesli_testing"
77
+ LesliTesting.app("LesliBuilder", coverage_min_coverage: 90)
78
+
79
+ require_relative "../config/environment"
80
+ require "rails/test_help"
81
+ ```
82
+
83
+ ### Rails engine
84
+
85
+ ```ruby
86
+ ENV["RAILS_ENV"] ||= "test"
87
+
70
88
  require "lesli_testing"
89
+ LesliTesting.engine("LesliShield", coverage_min_coverage: 90)
71
90
 
72
- LesliTesting.app("LesliBuilder") # Rails application
73
- # LesliTesting.engine("LesliShield") # Rails engine
74
- # LesliTesting.gem("LesliDate") # Standalone Ruby gem
91
+ require_relative "dummy/config/environment"
92
+ require "rails/test_help"
75
93
  ```
76
94
 
77
- Load LesliTesting before the code under test when coverage is enabled. Engine suites that use the shared Rails test classes should run through `bundle exec rails test` or `bundle exec rake app:test`.
95
+ ### Standalone Ruby gem
96
+
97
+ ```ruby
98
+ $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
99
+
100
+ require "lesli_testing"
101
+ LesliTesting.gem("Termline", coverage_min_coverage: 90)
102
+
103
+ require "minitest/autorun"
104
+ require "termline"
105
+ ```
106
+
107
+ Engine suites that use the shared Rails test classes should run through
108
+ `bundle exec rails test` or `bundle exec rake app:test`.
78
109
 
79
110
  Rails engines should keep a complete generated dummy application and verify eager loading locally before pushing:
80
111
 
@@ -84,7 +115,31 @@ CI=true bundle exec rails test
84
115
 
85
116
  LesliTesting does not provide an engine's runtime dependencies. Declare dependencies such as `lesli` explicitly in the engine gemspec and Gemfile so local and CI dependency resolution match.
86
117
 
87
- Run the suite normally or enable coverage with `COVERAGE`:
118
+ For Rails applications and engines, `Lesli` is always included as the shared testing base. Engine profiles use the configured engine name to discover its `Engine` class after the dummy application boots and register the target and Lesli fixture and migration paths. Migration paths are modified only in the test environment. Pure Ruby gems remain independent from Rails and Lesli integrations.
119
+
120
+ ## Definitive load order
121
+
122
+ LesliTesting initializes in five phases:
123
+
124
+ 1. `require "lesli_testing"` reads `COVERAGE` and starts native Ruby line
125
+ coverage immediately when enabled.
126
+ 2. `LesliTesting.app`, `.engine`, or `.gem` selects the profile, attaches
127
+ SimpleCov, and registers the Minitest reporter.
128
+ 3. Rails applications and engines boot their environment. ActiveSupport load
129
+ hooks install fixtures and shared test classes; the engine Railtie registers
130
+ migration paths only in the test environment.
131
+ 4. `rails/test_help` or `minitest/autorun` loads Minitest and the test files.
132
+ LesliTesting replaces any previously registered reporter when Minitest starts.
133
+ 5. At process exit, Minitest sets the suite result and SimpleCov writes
134
+ `coverage/coverage.xml` and enforces the coverage threshold.
135
+
136
+ Loading the application, engine, or gem before steps 1 and 2 prevents coverage
137
+ from observing code that Ruby already evaluated.
138
+
139
+ ## Running tests
140
+
141
+ Run the suite normally or enable coverage with `COVERAGE=true` (`1` and `yes`
142
+ are also accepted):
88
143
 
89
144
  ```shell
90
145
  bin/rails test
@@ -94,18 +149,41 @@ bundle exec rake
94
149
  COVERAGE=true bundle exec rake
95
150
  ```
96
151
 
97
- Set `QUIET=true` to hide individual passing-test lines while retaining the summary and failure details.
152
+ Set `QUIET=true` (`1` and `yes` are also accepted) to hide individual test lines while retaining the summary and failure details. Values such as `false`, `0`, and `no` leave the option disabled.
153
+
154
+ ### Environment variables
155
+
156
+ | Variable | Default | Enabled values | Effect |
157
+ | --- | --- | --- | --- |
158
+ | `COVERAGE` | Disabled | `true`, `1`, `yes` | Starts line coverage and writes console and Cobertura reports. |
159
+ | `QUIET` | Disabled | `true`, `1`, `yes` | Hides per-test lines but keeps the summary and failure details. |
160
+
161
+ Values are case-insensitive and surrounding whitespace is ignored. Every other
162
+ value, including `false`, `0`, and `no`, is disabled.
163
+
164
+ ### Exit codes
165
+
166
+ | Code | Meaning |
167
+ | ---: | --- |
168
+ | `0` | The suite passed. Skipped tests do not make the process fail. |
169
+ | `1` | A test failed, raised an unexpected exception, emitted a warning under `-Werror`, or an explicit test filter matched no tests. |
170
+ | `2` | Tests completed, but SimpleCov found coverage below `coverage_min_coverage`. |
171
+
172
+ Dependency installation, Ruby boot, signals, and operating-system failures may
173
+ return other non-zero codes. `QUIET` changes output only and never changes the
174
+ process result.
98
175
 
99
176
  <br />
100
177
 
101
178
  ## Guides
102
179
 
103
- - [Installation and configuration](https://www.lesli.dev/gems/testing/about/installation)
104
- - [Testing Rails applications](https://www.lesli.dev/gems/testing/testing/applications)
105
- - [Testing Rails engines](https://www.lesli.dev/gems/testing/testing/engines)
106
- - [Testing Ruby gems](https://www.lesli.dev/gems/testing/testing/gems)
107
- - [Reporter, coverage, fixtures, and test helpers](https://www.lesli.dev/gems/testing/about/tools)
108
- - [Recommended project and gem structure](https://www.lesli.dev/gems/testing/about/structure)
180
+ - [Installation and configuration](docs/about/installation.md)
181
+ - [Load order, environment, and exit codes](docs/about/execution.md)
182
+ - [Testing Rails applications](docs/testing/applications.md)
183
+ - [Testing Rails engines](docs/testing/engines.md)
184
+ - [Testing Ruby gems](docs/testing/gems.md)
185
+ - [Reporter, coverage, fixtures, and test helpers](docs/about/tools.md)
186
+ - [Recommended project and gem structure](docs/about/structure.md)
109
187
 
110
188
  <br />
111
189
 
@@ -131,16 +209,30 @@ Run the default test task from the LesliTesting directory:
131
209
 
132
210
  ```shell
133
211
  bundle exec rake
212
+ COVERAGE=true bundle exec rake test
213
+ bundle exec rake build
134
214
  ```
135
215
 
136
- Run the reporter demonstration failures explicitly with `DEMO=true`:
216
+ The LesliTesting repository enforces a 45% coverage baseline. Rails integration
217
+ behavior is tested in isolated Ruby processes, so those executed lines are not
218
+ merged into the parent process report. Consumer projects keep the public 90%
219
+ default unless they configure another threshold.
220
+
221
+ Run the intentional reporter failures manually when visually inspecting its output:
137
222
 
138
223
  ```shell
139
- DEMO=true bundle exec ruby -Itest test/demo_test.rb
224
+ bundle exec ruby examples/reporter_demo.rb
140
225
  ```
141
226
 
142
227
  The demo command is expected to fail and is intended for visually checking failure formatting.
143
228
 
229
+ Run the optional reporter benchmark separately from the test suite. It renders 5,000 results by default:
230
+
231
+ ```shell
232
+ bundle exec ruby benchmark/reporter_benchmark.rb
233
+ ITERATIONS=10000 bundle exec ruby benchmark/reporter_benchmark.rb
234
+ ```
235
+
144
236
  <br />
145
237
 
146
238
  ## Documentation
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lesli_testing
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Lesli Development Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-10-13 00:00:00.000000000 Z
11
+ date: 2026-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: termline
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.3.2
55
- - !ruby/object:Gem::Dependency
56
- name: simplecov-html
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: 0.13.2
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: 0.13.2
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: simplecov-console
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -104,11 +90,14 @@ extensions: []
104
90
  extra_rdoc_files: []
105
91
  files:
106
92
  - lib/lesli_testing.rb
93
+ - lib/lesli_testing/core.rb
107
94
  - lib/lesli_testing/coverage.rb
108
95
  - lib/lesli_testing/engine.rb
96
+ - lib/lesli_testing/environment.rb
109
97
  - lib/lesli_testing/fixtures.rb
110
98
  - lib/lesli_testing/helpers/response_integration_helper.rb
111
99
  - lib/lesli_testing/minitest/cli_reporter.rb
100
+ - lib/lesli_testing/rails_integration.rb
112
101
  - lib/lesli_testing/simplecov/profiles.rb
113
102
  - lib/lesli_testing/testers.rb
114
103
  - lib/lesli_testing/version.rb