Sha256: c583a6f19a4b10e7318756b25125e7a130ca4db8699351b1a36b4c33973d4091

Contents?: true

Size: 1.09 KB

Versions: 12

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

require "hanami/config"

RSpec.describe Hanami::Config, "#router" do
  let(:config) { described_class.new(app_name: app_name, env: :development) }
  let(:app_name) { "MyApp::app" }

  subject(:router) { config.router }

  context "hanami-router is bundled" do
    it "is a full router configuration" do
      is_expected.to be_an_instance_of(Hanami::Config::Router)

      is_expected.to respond_to(:resolver)
    end

    it "loads the middleware stack" do
      subject

      expect(config.middleware_stack).not_to be_nil
    end

    it "can be finalized" do
      is_expected.to respond_to(:finalize!)
    end
  end

  context "hanami-router is not bundled" do
    before do
      allow(Hanami).to receive(:bundled?).and_call_original
      expect(Hanami).to receive(:bundled?).with("hanami-router").and_return(false)
    end

    it "does not expose any settings" do
      is_expected.to be_an_instance_of(Hanami::Config::NullConfig)
      is_expected.not_to respond_to(:resolver)
    end

    it "can be finalized" do
      is_expected.to respond_to(:finalize!)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

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