0
0
Fork 0

Refactor active_nav_class for use with multiple paths (#8757)

This commit is contained in:
ThibG 2018-09-23 20:42:13 +02:00 committed by Eugen Rochko
parent d0d65b5a28
commit c39183cc62
3 changed files with 11 additions and 3 deletions

View file

@ -9,6 +9,14 @@ describe ApplicationHelper do
expect(result).to eq "active"
end
it 'returns active when on a current page' do
allow(helper).to receive(:current_page?).with('/foo').and_return(false)
allow(helper).to receive(:current_page?).with('/test').and_return(true)
result = helper.active_nav_class('/foo', '/test')
expect(result).to eq "active"
end
it 'returns empty string when not on current page' do
allow(helper).to receive(:current_page?).and_return(false)