Sha256: b4e9e5e4ce6569367ff43def89ae06ba05e689c51e4cb6d4ec61817a76c19f88

Contents?: true

Size: 624 Bytes

Versions: 3

Compression:

Stored size: 624 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

RSpec.describe Loaf::ViewExtensions, '.breadcrumb' do

  it { expect(DummyView.new).to respond_to(:add_breadcrumb) }

  it 'creates crumb instance' do
    instance = DummyView.new
    name = 'Home'
    url  = :home_path
    allow(Loaf::Crumb).to receive(:new).with(name, url, {})
    instance.breadcrumb name, url
    expect(Loaf::Crumb).to have_received(:new).with(name, url, {})
  end

  it 'adds crumb to breadcrumbs storage' do
    instance = DummyView.new
    expect {
      instance.breadcrumb 'Home', :home_path
    }.to change { instance._breadcrumbs.size }.by(1)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
loaf-0.6.0 spec/unit/view_extensions/breadcrumb_spec.rb
loaf-0.5.0 spec/unit/view_extensions/breadcrumb_spec.rb
loaf-0.4.0 spec/unit/view_extensions/breadcrumb_spec.rb