Sha256: 66fd2bc9b47304d22e3d36114880fca19397ca1c93fe163692138467f938356d

Contents?: true

Size: 936 Bytes

Versions: 2

Compression:

Stored size: 936 Bytes

Contents

# encoding: utf-8

RSpec.describe Loaf::Configuration do
  it "allows to set and read attributes" do
    config = Loaf::Configuration.new

    config.crumb_length = 4
    expect(config.crumb_length).to eq(4)

    config.match = :exact
    expect(config.match).to eq(:exact)
  end

  it "accepts attributes at initialization" do
    options = { crumb_length: 12, match: :exact }
    config = Loaf::Configuration.new(options)

    expect(config.crumb_length).to eq(12)
    expect(config.match).to eq(:exact)
  end

  it "exports configuration as hash" do
    config = Loaf::Configuration.new
    expect(config.to_hash).to eq({
      capitalize: false,
      crumb_length: 30,
      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.7.0 spec/unit/configuration_spec.rb
loaf-0.6.2 spec/unit/configuration_spec.rb