Sha256: 423b0aea4916578c35819728df4e51f4141fd370cf64dcd281fb547f763c70f1

Contents?: true

Size: 1.14 KB

Versions: 5

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true

RSpec.describe "Slices / Slice configuration", :app_integration do
  specify "Slices receive a copy of the app configuration, and can make distinct modifications" do
    with_tmp_directory(Dir.mktmpdir) do
      write "config/app.rb", <<~RUBY
        require "hanami"

        module TestApp
          class App < Hanami::App
            config.logger.stream = File.new("/dev/null", "w")

            config.no_auto_register_paths << "structs"
          end
        end
      RUBY

      write "config/slices/main.rb", <<~'RUBY'
        module Main
          class Slice < Hanami::Slice
            config.no_auto_register_paths << "schemas"
          end
        end
      RUBY

      write "config/slices/search.rb", <<~'RUBY'
        module Search
          class Slice < Hanami::Slice
          end
        end
      RUBY

      require "hanami/prepare"

      expect(TestApp::App.config.no_auto_register_paths).to eq %w[entities structs]
      expect(Main::Slice.config.no_auto_register_paths).to eq %w[entities structs schemas]
      expect(Search::Slice.config.no_auto_register_paths).to eq %w[entities structs]
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hanami-2.0.0.beta4 spec/integration/slices/slice_configuration_spec.rb
hanami-2.0.0.beta3 spec/integration/slices/slice_configuration_spec.rb
hanami-2.0.0.beta2 spec/new_integration/slices/slice_configuration_spec.rb
hanami-2.0.0.beta1.1 spec/new_integration/slices/slice_configuration_spec.rb
hanami-2.0.0.beta1 spec/new_integration/slices/slice_configuration_spec.rb