Sha256: 343da8ed032c031b31e1991f2766c22867c94d17c5be71dadd8a727c38caec79

Contents?: true

Size: 1.15 KB

Versions: 12

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

require "stringio"

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 = StringIO.new

            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

12 entries across 12 versions & 1 rubygems

Version Path
hanami-2.1.0 spec/integration/slices/slice_configuration_spec.rb
hanami-2.1.0.rc3 spec/integration/slices/slice_configuration_spec.rb
hanami-2.1.0.rc2 spec/integration/slices/slice_configuration_spec.rb
hanami-2.1.0.rc1 spec/integration/slices/slice_configuration_spec.rb
hanami-2.1.0.beta2.1 spec/integration/slices/slice_configuration_spec.rb
hanami-2.1.0.beta2 spec/integration/slices/slice_configuration_spec.rb
hanami-2.1.0.beta1 spec/integration/slices/slice_configuration_spec.rb
hanami-2.0.3 spec/integration/slices/slice_configuration_spec.rb
hanami-2.0.2 spec/integration/slices/slice_configuration_spec.rb
hanami-2.0.1 spec/integration/slices/slice_configuration_spec.rb
hanami-2.0.0 spec/integration/slices/slice_configuration_spec.rb
hanami-2.0.0.rc1 spec/integration/slices/slice_configuration_spec.rb