Skip to content

Commit 6ecf43d

Browse files
committed
- Update breadcrumbs href with a trailing slash
1 parent c333a01 commit 6ecf43d

3 files changed

Lines changed: 11 additions & 10 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Gemfile.lock
22

3+
/cache
34
/coverage
45
/debug.runfile
56
/dev

lib/madness/breadcrumbs.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def breadcrumbs_maker(partial_path)
2828
item = OpenStruct.new(
2929
{
3030
label: basename.to_label,
31-
href: "#{config.base_uri}/#{partial_path}",
31+
href: "#{config.base_uri}/#{partial_path}/",
3232
}
3333
)
3434
result = [item]

spec/madness/breadcrumbs_spec.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717

1818
it 'adds a link to each element' do
1919
expect(links[1].label).to eq 'one'
20-
expect(links[1].href).to eq '/one'
20+
expect(links[1].href).to eq '/one/'
2121
expect(links[2].label).to eq 'two'
22-
expect(links[2].href).to eq '/one/two'
22+
expect(links[2].href).to eq '/one/two/'
2323
expect(links[3].label).to eq 'three'
24-
expect(links[3].href).to eq '/one/two/three'
24+
expect(links[3].href).to eq '/one/two/three/'
2525
end
2626

2727
it 'adds a last attribute to last element' do
@@ -33,11 +33,11 @@
3333

3434
it 'removes sorting markers from labels' do
3535
expect(links[1].label).to eq 'one'
36-
expect(links[1].href).to eq '/1. one'
36+
expect(links[1].href).to eq '/1. one/'
3737
expect(links[2].label).to eq 'two'
38-
expect(links[2].href).to eq '/1. one/2. two'
38+
expect(links[2].href).to eq '/1. one/2. two/'
3939
expect(links[3].label).to eq 'three'
40-
expect(links[3].href).to eq '/1. one/2. two/3. three'
40+
expect(links[3].href).to eq '/1. one/2. two/3. three/'
4141
end
4242
end
4343

@@ -46,9 +46,9 @@
4646
after { config.base_uri = nil }
4747

4848
it 'prepends the links with the base_uri' do
49-
expect(links[1].href).to eq '/docs/one'
50-
expect(links[2].href).to eq '/docs/one/two'
51-
expect(links[3].href).to eq '/docs/one/two/three'
49+
expect(links[1].href).to eq '/docs/one/'
50+
expect(links[2].href).to eq '/docs/one/two/'
51+
expect(links[3].href).to eq '/docs/one/two/three/'
5252
end
5353
end
5454
end

0 commit comments

Comments
 (0)