Sha256: 94923cb6ad53a89ab44230fbbd71757344c44600e7527e7edb996a8b5bf463d0

Contents?: true

Size: 835 Bytes

Versions: 18

Compression:

Stored size: 835 Bytes

Contents

# frozen_string_literal: true

require "dry/inflector"
require "hanami/config"
require "hanami/slice_name"

RSpec.describe Hanami::Config, "#slices" do
  subject(:config) { described_class.new(app_name: app_name, env: :development) }
  let(:app_name) { Hanami::SliceName.new(double(name: "MyApp::App"), inflector: Dry::Inflector.new) }

  subject(:slices) { config.slices }

  before do
    @orig_env = ENV.to_h
  end

  after do
    ENV.replace(@orig_env)
  end

  it "is nil by default" do
    is_expected.to be nil
  end

  it "defaults to the HANAMI_LOAD_SLICES env var, separated by commas" do
    ENV["HANAMI_SLICES"] = "main,admin"
    is_expected.to eq %w[main admin]
  end

  it "strips spaces from HANAMI_LOAD_SLICES env var entries" do
    ENV["HANAMI_SLICES"] = "main, admin"
    is_expected.to eq %w[main admin]
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
hanami-2.2.1 spec/unit/hanami/config/slices_spec.rb
hanami-2.2.0 spec/unit/hanami/config/slices_spec.rb
hanami-2.2.0.rc1 spec/unit/hanami/config/slices_spec.rb
hanami-2.2.0.beta2 spec/unit/hanami/config/slices_spec.rb
hanami-2.2.0.beta1 spec/unit/hanami/config/slices_spec.rb
hanami-2.1.0 spec/unit/hanami/config/slices_spec.rb
hanami-2.1.0.rc3 spec/unit/hanami/config/slices_spec.rb
hanami-2.1.0.rc2 spec/unit/hanami/config/slices_spec.rb
hanami-2.1.0.rc1 spec/unit/hanami/config/slices_spec.rb
hanami-2.1.0.beta2.1 spec/unit/hanami/config/slices_spec.rb
hanami-2.1.0.beta2 spec/unit/hanami/config/slices_spec.rb
hanami-2.1.0.beta1 spec/unit/hanami/config/slices_spec.rb
hanami-2.0.3 spec/unit/hanami/config/slices_spec.rb
hanami-2.0.2 spec/unit/hanami/config/slices_spec.rb
hanami-2.0.1 spec/unit/hanami/config/slices_spec.rb
hanami-2.0.0 spec/unit/hanami/config/slices_spec.rb
hanami-2.0.0.rc1 spec/unit/hanami/config/slices_spec.rb
hanami-2.0.0.beta4 spec/unit/hanami/config/slices_spec.rb