Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused active_nav_class helper method #29617

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 0 additions & 4 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ def friendly_number_to_human(number, **options)
number_to_human(number, **options)
end

def active_nav_class(*paths)
paths.any? { |path| current_page?(path) } ? 'active' : ''
end

def open_registrations?
Setting.registrations_mode == 'open'
end
Expand Down
24 changes: 0 additions & 24 deletions spec/helpers/application_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,6 @@
require 'rails_helper'

describe ApplicationHelper do
describe 'active_nav_class' do
it 'returns active when on the current page' do
allow(helper).to receive(:current_page?).and_return(true)

result = helper.active_nav_class('/test')
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)

result = helper.active_nav_class('/test')
expect(result).to eq ''
end
end

describe 'body_classes' do
context 'with a body class string from a controller' do
before { helper.extend controller_helpers }
Expand Down