# Configure Zeitwerk for test-only classes inside spec/ directory

**URL:** <https://discourse.hanakai.org/t/configure-zeitwerk-for-test-only-classes-inside-spec-directory/774>\
**Category:** questions\
**Created:** [January 3, 2023, 2:01pm UTC](https://discourse.hanakai.org/t/configure-zeitwerk-for-test-only-classes-inside-spec-directory/774 "2023-01-03T14:01:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![choallin](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.hanakai.org/choallin/32/598_2.png) [@choallin](https://discourse.hanakai.org/u/choallin)\
**Post date:** [January 3, 2023, 2:01pm UTC](https://discourse.hanakai.org/t/configure-zeitwerk-for-test-only-classes-inside-spec-directory/774/1 "2023-01-03T14:01:02Z")

</div>

I’m working on a Hanami 2 app where I want to configure Zeitwerk to namespace the files under spec into the namespace `Test`. I saw that Tim Riley is namespacing all helpers/factories and stuff in the spec directory into the `Test` namespace in his decaf app, and I think this is quite elegant. How can I do this as well?

---

<div class="post-metadata">

**Author:** ![timriley](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.hanakai.org/timriley/32/621_2.png) [@timriley](https://discourse.hanakai.org/u/timriley)\
**Post date:** [January 3, 2023, 7:54pm UTC](https://discourse.hanakai.org/t/configure-zeitwerk-for-test-only-classes-inside-spec-directory/774/2 "2023-01-03T19:54:35Z")

</div>

Hey @choallin! I’m not actually autoloading anything inside my spec/ directory; everything is brought in by requires, so Zeitwerk configuration is not involved there. (For reference, the original post refers to [decafsucks/spec at main · decafsucks/decafsucks · GitHub](https://github.com/decafsucks/decafsucks/tree/main/spec))

If you wanted to autoload files inside your spec/ directory using Zeitwerk, I would recommend you create a totally separate Zeitwerk loader to do this, not reuse any that are set up for the Hanami app. So this would mean creating a `Zeitwerk::Loader` inside your spec\_helper.rb and then just following Zeitwerk’s own (excellent) README to set it up.
