Sha256: b939e1cedf34694d9d00611ee8290f6c25f7998837e667cf5395b176a980886d

Contents?: true

Size: 998 Bytes

Versions: 5

Compression:

Stored size: 998 Bytes

Contents

# frozen_string_literal: true

require "hanami/config"

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

  subject(:db) { config.db }

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

      is_expected.to respond_to(:import_from_parent)
    end

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

  context "hanami-db is not bundled" do
    before do
      allow(Hanami).to receive(:bundled?).and_call_original
      allow(Hanami).to receive(:bundled?).with("hanami-db").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(:import_from_parent)
    end

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hanami-2.2.1 spec/unit/hanami/config/db_spec.rb
hanami-2.2.0 spec/unit/hanami/config/db_spec.rb
hanami-2.2.0.rc1 spec/unit/hanami/config/db_spec.rb
hanami-2.2.0.beta2 spec/unit/hanami/config/db_spec.rb
hanami-2.2.0.beta1 spec/unit/hanami/config/db_spec.rb