Sha256: b723c5633e9ae6e314750fafd19f85b112661f4bcb8c0621cf6d5a8d802496af

Contents?: true

Size: 836 Bytes

Versions: 2

Compression:

Stored size: 836 Bytes

Contents

# frozen_string_literal: true

RSpec.describe Loaf::Configuration do
  it "allows to set and read attributes" do
    config = Loaf::Configuration.new
    config.match = :exact
    expect(config.match).to eq(:exact)
  end

  it "accepts attributes at initialization" do
    options = { locales_path: '/lib', match: :exact }
    config = Loaf::Configuration.new(options)

    expect(config.locales_path).to eq('/lib')
    expect(config.match).to eq(:exact)
  end

  it "exports configuration as hash" do
    config = Loaf::Configuration.new
    expect(config.to_hash).to eq({
      locales_path: '/',
      match: :inclusive
    })
  end

  it "yields configuration" do
    conf = double(:conf)
    allow(Loaf).to receive(:configuration).and_return(conf)
    expect { |b|
      Loaf.configure(&b)
    }.to yield_with_args(conf)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
loaf-0.8.1 spec/unit/configuration_spec.rb
loaf-0.8.0 spec/unit/configuration_spec.rb