Sha256: 7a53913640cd8468d49434046e0e8bdd8aa265f9a87ac911dcbb5765f8a677b3

Contents?: true

Size: 942 Bytes

Versions: 11

Compression:

Stored size: 942 Bytes

Contents

# frozen_string_literal: true

RSpec.describe Hanami, ".env" do
  subject(:env) { described_class.env }

  before do
    @orig_env = ENV.to_h
  end

  after do
    ENV.replace(@orig_env)
  end

  context "HANAMI_ENV in ENV" do
    before do
      ENV["HANAMI_ENV"] = "test"
    end

    it "is the value of HANAMI_ENV" do
      is_expected.to eq :test
    end
  end

  context "RACK_ENV in ENV" do
    before do
      ENV["RACK_ENV"] = "test"
    end

    it "is the value of RACK_ENV" do
      is_expected.to eq :test
    end
  end

  context "both HANAMI_ENV and RACK_ENV in ENV" do
    before do
      ENV["HANAMI_ENV"] = "test"
      ENV["RACK_ENV"] = "production"
    end

    it "is the value of HANAMI_ENV" do
      is_expected.to eq :test
    end
  end

  context "no ENV vars set" do
    before do
      ENV.delete("HANAMI_ENV")
    end

    it "defaults to \"development\"" do
      is_expected.to eq :development
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
hanami-2.1.0.beta1 spec/unit/hanami/env_spec.rb
hanami-2.0.3 spec/unit/hanami/env_spec.rb
hanami-2.0.2 spec/unit/hanami/env_spec.rb
hanami-2.0.1 spec/unit/hanami/env_spec.rb
hanami-2.0.0 spec/unit/hanami/env_spec.rb
hanami-2.0.0.rc1 spec/unit/hanami/env_spec.rb
hanami-2.0.0.beta4 spec/unit/hanami/env_spec.rb
hanami-2.0.0.beta3 spec/unit/hanami/env_spec.rb
hanami-2.0.0.beta2 spec/unit/hanami/env_spec.rb
hanami-2.0.0.beta1.1 spec/unit/hanami/env_spec.rb
hanami-2.0.0.beta1 spec/unit/hanami/env_spec.rb