Sha256: ca249e6a3232a1a5e69ecfc5060afbd60b11a10f03ae829950c3f7c20ad4e2f0

Contents?: true

Size: 960 Bytes

Versions: 18

Compression:

Stored size: 960 Bytes

Contents

# frozen_string_literal: true

require "hanami/config"

RSpec.describe Hanami::Config 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

18 entries across 18 versions & 1 rubygems

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