Sha256: eb04fef93a4362b5074935a913b464dc373382d356fa498a3750ef414e93ecbb

Contents?: true

Size: 1.17 KB

Versions: 17

Compression:

Stored size: 1.17 KB

Contents

RSpec.describe "Container / Standard providers / Rack", :app_integration do
  specify "Rack provider is loaded when rack is bundled" do
    with_tmp_directory(Dir.mktmpdir) do
      write "config/app.rb", <<~RUBY
        require "hanami"

        module TestApp
          class App < Hanami::App
          end
        end
      RUBY

      write "slices/main/.keep", ""

      require "hanami/prepare"

      expect(Hanami.app["rack.monitor"]).to be_a_kind_of(Dry::Monitor::Rack::Middleware)
      expect(Main::Slice["rack.monitor"]).to be_a_kind_of(Dry::Monitor::Rack::Middleware)
    end
  end

  specify "Rack provider is not loaded when rack is not bundled" do
    allow(Hanami).to receive(:bundled?).and_call_original
    allow(Hanami).to receive(:bundled?).with("rack").and_return false

    with_tmp_directory(Dir.mktmpdir) do
      write "config/app.rb", <<~RUBY
        require "hanami"

        module TestApp
          class App < Hanami::App
          end
        end
      RUBY

      write "slices/main/.keep", ""

      require "hanami/prepare"

      expect(Hanami.app.key?("rack.monitor")).to be false
      expect(Main::Slice.key?("rack.monitor")).to be false
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
hanami-2.2.1 spec/integration/container/standard_providers/rack_provider_spec.rb
hanami-2.2.0 spec/integration/container/standard_providers/rack_provider_spec.rb
hanami-2.2.0.rc1 spec/integration/container/standard_providers/rack_provider_spec.rb
hanami-2.2.0.beta2 spec/integration/container/standard_providers/rack_provider_spec.rb
hanami-2.2.0.beta1 spec/integration/container/standard_providers/rack_provider_spec.rb
hanami-2.1.0 spec/integration/container/standard_providers/rack_provider_spec.rb
hanami-2.1.0.rc3 spec/integration/container/standard_providers/rack_provider_spec.rb
hanami-2.1.0.rc2 spec/integration/container/standard_providers/rack_provider_spec.rb
hanami-2.1.0.rc1 spec/integration/container/standard_providers/rack_provider_spec.rb
hanami-2.1.0.beta2.1 spec/integration/container/standard_providers/rack_provider_spec.rb
hanami-2.1.0.beta2 spec/integration/container/standard_providers/rack_provider_spec.rb
hanami-2.1.0.beta1 spec/integration/container/standard_providers/rack_provider_spec.rb
hanami-2.0.3 spec/integration/container/standard_providers/rack_provider_spec.rb
hanami-2.0.2 spec/integration/container/standard_providers/rack_provider_spec.rb
hanami-2.0.1 spec/integration/container/standard_providers/rack_provider_spec.rb
hanami-2.0.0 spec/integration/container/standard_providers/rack_provider_spec.rb
hanami-2.0.0.rc1 spec/integration/container/standard_providers/rack_provider_spec.rb