Ruby, Lua: missing `require`s not detected by tests due to `require` leaks
I was wondering how it is possible that the `EnumImport` test passes in Ruby (see https://ci.kaitai.io/ or [`ci.json:239-243`](https://github.com/kaitai-io/ci_artifacts/blob/3aa03d081786114ed075f74c9d8f211a6617020d/test_out/ruby/ci.json#L239-L243) of the `ruby/3.3-linux-x86_64` target).

The [`enum_import.ksy`](https://github.com/kaitai-io/kaitai_struct_tests/blob/f7bfcf9989d7667e50f4a209a46e93c968b326eb/formats/enum_import.ksy) spec imports two other .ksy specs (`enum_0` and `enum_deep`) and defines two `seq` fields, each of an enum type defined in one of the imported specs:

```ksy
meta:
  id: enum_import
  endian: le
  imports:
    - enum_0
    - enum_deep
seq:
  - id: pet_1
    type: u4
    enum: enum_0::animal
  - id: pet_2
    type: u4
    enum: enum_deep::container1::container2::animal
```

The problem is that the [`enum_import.rb`](https://github.com/kaitai-io/ci_targets/blob/db0c0156d304693a5007e125d1f72c1bd4d1ac6e/compiled/ruby/enum_import.rb) (still generated by the latest KSC at the time of writing, i.e. [`29f7a592`](https://github.com/kaitai-io/kaitai_struct_compiler/tree/29f7a59225f646b24f29a7400baefbbbe38ef58d)) looks like this:

```rb
# This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild

require 'kaitai/struct/struct'

unless Gem::Version.new(Kaitai::Struct::VERSION) >= Gem::Version.new('0.11')
  raise "Incompatible Kaitai Struct Ruby API: 0.11 or later is required, but you have #{Kaitai::Struct::VERSION}"
end

class EnumImport < Kaitai::Struct::Struct
  def initialize(_io, _parent = nil, _root = self)
    super(_io, _parent, _root)
    _read
  end

  def _read
    @pet_1 = Kaitai::Struct::Stream::resolve_enum(Enum0::ANIMAL, @_io.read_u4le)
    @pet_2 = Kaitai::Struct::Stream::resolve_enum(EnumDeep::Container1::Container2::ANIMAL, @_io.read_u4le)
    self
  end
  attr_reader :pet_1
  attr_reader :pet_2
end
```

Notice that it refers to classes `Enum0` and `EnumDeep` on these lines:

```rb
    @pet_1 = Kaitai::Struct::Stream::resolve_enum(Enum0::ANIMAL, @_io.read_u4le)
    #                                             ^^^^^
    @pet_2 = Kaitai::Struct::Stream::resolve_enum(EnumDeep::Container1::Container2::ANIMAL, @_io.read_u4le)
    #                                             ^^^^^^^^
```

... but there are no corresponding `require` statements, so the Ruby interpreter should have no idea what these names are. And yet this test passes in Ruby.

It turns out that the `require`s in Ruby are "leaky", i.e. they pollute the global namespace. So if any format or test Ruby files running before the above `enum_import.rb` contain `require 'enum_0'` and `require 'enum_deep'` (which is what the `EnumImport` class needs to run successfully) in the same Ruby interpreter process, the fact that the `enum_import.rb` file doesn't itself have the `require`s it needs is not detected by tests.

And if you search [for `require 'enum_0'`](https://github.com/search?q=repo%3Akaitai-io%2Fkaitai_struct_tests+%22require+%27enum_0%27%22&type=code) and [for `require 'enum_deep'`](https://github.com/search?q=repo%3Akaitai-io%2Fkaitai_struct_tests+%22require+%27enum_deep%27%22&type=code), you can see that both `require`s have 2 occurrences in test specs.

If you disable the `enum_0` in [`spec/ruby/enum_import_spec.rb`](https://github.com/kaitai-io/kaitai_struct_tests/blob/f7bfcf9989d7667e50f4a209a46e93c968b326eb/spec/ruby/enum_import_spec.rb#L3-L7):

```rb
RSpec.describe 'EnumImport' do
  it 'parses test properly' do
    require 'enum_import'
    # require 'enum_0'
    require 'enum_deep'
```

... it's not enough (i.e. the `EnumImport` test will still pass), because `enum_0` is also tested directly, so `require 'enum_0'` is also in [`spec/ruby/enum_0_spec.rb`](https://github.com/kaitai-io/kaitai_struct_tests/blob/f7bfcf9989d7667e50f4a209a46e93c968b326eb/spec/ruby/enum_0_spec.rb#L3-L5):

```rb
RSpec.describe 'Enum0' do
  it 'parses test properly' do
    # require 'enum_0'
```

`EnumImport` will finally fail (as it should have all this time) only after you disable both these `require`s:

```console
$ ./run-ruby

  ...

  3) EnumImport parses test properly
     Failure/Error: r = EnumImport.from_file('src/enum_0.bin')

     NameError:
       uninitialized constant EnumImport::Enum0
     # ./compiled/ruby/enum_import.rb:16:in `_read'
     # ./compiled/ruby/enum_import.rb:12:in `initialize'
     # C:/temp/kaitai_struct/runtime/ruby/lib/kaitai/struct/struct.rb:26:in `new'
     # C:/temp/kaitai_struct/runtime/ruby/lib/kaitai/struct/struct.rb:26:in `from_file'
     # ./spec/ruby/enum_import_spec.rb:8:in `block (2 levels) in <top (required)>'
```