Sha256: 2ff17a1663f7ccf9e5ddc0568aa1d07d4ec4e4152e5d68f0c79919be73e041f1

Contents?: true

Size: 974 Bytes

Versions: 4

Compression:

Stored size: 974 Bytes

Contents

# frozen_string_literal: true

require "hanami/configuration"

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

  describe "inflector" do
    it "defaults to a Dry::Inflector instance" do
      expect(config.inflector).to be_kind_of(Dry::Inflector)
    end

    it "can be replaced with another inflector" do
      new_inflector = double(:inflector)

      expect { config.inflector = new_inflector }
        .to change { config.inflector }
        .to new_inflector
    end
  end

  describe "inflections" do
    it "configures a new inflector with the given inflections" do
      expect(config.inflector.pluralize("hanami")).to eq("hanamis")

      config.inflections do |i|
        i.uncountable("hanami")
      end

      expect(config.inflector).to be_kind_of(Dry::Inflector)
      expect(config.inflector.pluralize("hanami")).to eq("hanami")
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hanami-2.0.0.beta3 spec/unit/hanami/configuration/inflector_spec.rb
hanami-2.0.0.beta2 spec/unit/hanami/configuration/inflector_spec.rb
hanami-2.0.0.beta1.1 spec/unit/hanami/configuration/inflector_spec.rb
hanami-2.0.0.beta1 spec/unit/hanami/configuration/inflector_spec.rb