Class: Glib::LastResortUnitTest
- Inherits:
-
ActiveSupport::TestCase
- Object
- ActiveSupport::TestCase
- Glib::LastResortUnitTest
- Defined in:
- lib/glib/last_resort_unit_test.rb
Overview
The truthful base class for the rare, justified unit tests (see dev-doc's AvoidUnitTest / RequireUnitTestJustification). Every other test should be a controller test on Glib::IntegrationTest.
The name is the policy: you may only be here after exhausting the controller-test route. Assume a controller test IS possible and look harder first — that conclusion is almost always premature (AvoidUnitTest's docs list the patterns that make "unit-only" behaviour reachable end-to-end). Subclassing this base is a confession, not a credential: it must sit in a unit-test directory under a justification header, both enforced by RequireUnitTestJustification.
Deliberately NOT a descendant of ActionDispatch::IntegrationTest:
- The declaration line states the test type honestly. A unit test subclassing an "IntegrationTest" base is a lie that also defeats base-class-keyed tooling.
- HTTP verb helpers (
get/post/...) don't exist here, so a unit test structurally cannot drift into half-integration territory — the inverse of the guarantee DevDoc::Test::Lints::HttpDrivenControllerTests provides for test/controllers/.
Project-wide helpers attached to ActiveSupport::TestCase (fixtures, glib_travel, coverage) are inherited as usual.