fix(rube): load erb at require time, not inside generate
test_generate_returns_an_object_not_bytes errored on roughly 1 run in 12 under Minitest's random ordering. assert_kind_of ERB, chain.generate evaluates the ERB constant before calling generate, and generate was performing a lazy require of erb inside itself. If that test ran before anything else had loaded erb, the constant did not exist. The lazy require was the defect rather than the test. A require buried in a method makes constant availability depend on call order for every caller, not just this one. Moved to the top of the file. Verified across 40 randomized runs, 0 unstable. The previous commit shipped this suite showing 1 error and should not have.
This commit is contained in:
parent
bd89c6704a
commit
b082276376
|
|
@ -1,6 +1,8 @@
|
|||
# ©AngelaMos | 2026
|
||||
# erb_def_method.rb
|
||||
|
||||
require "erb"
|
||||
|
||||
module Rube
|
||||
module Chains
|
||||
class ErbDefMethod < Base
|
||||
|
|
@ -47,8 +49,6 @@ module Rube
|
|||
end
|
||||
|
||||
def generate
|
||||
require "erb"
|
||||
|
||||
object = ERB.allocate
|
||||
object.instance_variable_set(IVAR_SRC, src)
|
||||
object.instance_variable_set(IVAR_FILENAME, DEFAULT_FILENAME)
|
||||
|
|
|
|||
Loading…
Reference in New Issue