Sha256: d08c22a1fd10d8bd3aa9a4db2676bbb1dbc63c27d9daa946cf4f61c7b8be0f7e

Contents?: true

Size: 637 Bytes

Versions: 3

Compression:

Stored size: 637 Bytes

Contents

RSpec.describe BreadcrumbTrail::BlockBuilder do
  let(:breadcrumbs) {
    [
      { path: "/", name: "home" },
      { path: "/foo", name: "foo" },
      { path: "/foo/bar", name: "foo/bar" }
    ].map { |data| BreadcrumbTrail::Breadcrumb.new(data) } }
  let(:context) { double("context") }
  let(:block) { proc { |element| %Q(<a href="#{element.path}">#{element.name}</a>).html_safe } }

  subject { described_class.new(context, breadcrumbs, &block) }

  it "renders a list" do
    expect(subject.call).to eq \
        "<a href=\"/\">home</a>" \
        "<a href=\"/foo\">foo</a>" \
        "<a href=\"/foo/bar\">foo/bar</a>"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
breadcrumb_trail-0.2.1 spec/block_builder_spec.rb
breadcrumb_trail-0.2.0 spec/block_builder_spec.rb
breadcrumb_trail-0.1.0 spec/block_builder_spec.rb