# Why isn't HANAMI\_ENV hard set to test in spec\_hepler?

**URL:** <https://discourse.hanakai.org/t/why-isnt-hanami-env-hard-set-to-test-in-spec-hepler/713>\
**Category:** questions\
**Created:** [November 9, 2022, 11:52am UTC](https://discourse.hanakai.org/t/why-isnt-hanami-env-hard-set-to-test-in-spec-hepler/713 "2022-11-09T11:52:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wuarmin](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.hanakai.org/wuarmin/32/548_2.png) [@wuarmin](https://discourse.hanakai.org/u/wuarmin)\
**Post date:** [November 9, 2022, 11:52am UTC](https://discourse.hanakai.org/t/why-isnt-hanami-env-hard-set-to-test-in-spec-hepler/713/1 "2022-11-09T11:52:42Z")

</div>

Hey,  
the spec\_helper.rb in a generated app looks like this:

```ruby
# frozen_string_literal: true

require "pathname"
SPEC_ROOT = Pathname( __dir__ ).realpath.freeze

ENV["HANAMI_ENV"] ||= "test"
require "hanami/prepare"

require_relative "support/rspec"
require_relative "support/requests"

```

HANAMI\_ENV is set with `||=`. This could be dangerous for users who executes tests in i.a. a docker-container, where HANAMI\_ENV is set at compose-time to development.

Why not setting HANAMI\_ENV to test:

```ruby
ENV["HANAMI_ENV"] = "test"

```

Or are there scenarios, where tests should be executed in antother HANAMI\_ENV?

Thanks

---

<div class="post-metadata">

**Author:** ![jodosha](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.hanakai.org/jodosha/32/710_2.png) [@jodosha](https://discourse.hanakai.org/u/jodosha)\
**Post date:** [November 9, 2022, 1:00pm UTC](https://discourse.hanakai.org/t/why-isnt-hanami-env-hard-set-to-test-in-spec-hepler/713/2 "2022-11-09T13:00:35Z")

</div>

@wuarmin Because that policy will guarantee flexibility to end users.

In short: we don’t know how engineers are going to use Hanami. In cases like this we give the freedom to override the defaults.

---

<div class="post-metadata">

**Author:** ![wuarmin](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.hanakai.org/wuarmin/32/548_2.png) [@wuarmin](https://discourse.hanakai.org/u/wuarmin)\
**Post date:** [November 9, 2022, 1:08pm UTC](https://discourse.hanakai.org/t/why-isnt-hanami-env-hard-set-to-test-in-spec-hepler/713/3 "2022-11-09T13:08:49Z")

</div>

Ok, thanks for the reply.
