<% end %>
diff --git a/features/step_definitions/menu_steps.rb b/features/step_definitions/menu_steps.rb
index 81ff4999d1c..c94dd035a02 100644
--- a/features/step_definitions/menu_steps.rb
+++ b/features/step_definitions/menu_steps.rb
@@ -12,7 +12,7 @@
end
Then(/^I should see a menu parent for "([^"]*)"$/) do |name|
- expect(page).to have_css "#main-menu li button", text: name
+ expect(page).to have_css "#main-menu li a", text: name
end
Then(/^I should see a nested menu item for "([^"]*)"$/) do |name|
diff --git a/lib/active_admin/menu.rb b/lib/active_admin/menu.rb
index 62a8aa45baf..9662ca88dd9 100644
--- a/lib/active_admin/menu.rb
+++ b/lib/active_admin/menu.rb
@@ -66,8 +66,8 @@ def include?(item)
end
# Used in the UI to visually distinguish which menu item is selected.
- def current?(item)
- self == item || include?(item)
+ def current?(item, children: true)
+ self == item || (children && include?(item))
end
# Returns sorted array of menu items that should be displayed in this context.
diff --git a/spec/support/templates/admin/profiles.rb b/spec/support/templates/admin/profiles.rb
new file mode 100644
index 00000000000..5fead810c55
--- /dev/null
+++ b/spec/support/templates/admin/profiles.rb
@@ -0,0 +1,5 @@
+# frozen_string_literal: true
+ActiveAdmin.register Profile do
+ menu parent: 'Users'
+ permit_params :user_id, :bio
+end
diff --git a/spec/support/templates/policies/profile_policy.rb b/spec/support/templates/policies/profile_policy.rb
new file mode 100644
index 00000000000..a2ecd2a46cb
--- /dev/null
+++ b/spec/support/templates/policies/profile_policy.rb
@@ -0,0 +1,3 @@
+# frozen_string_literal: true
+class ProfilePolicy < ApplicationPolicy
+end
diff --git a/spec/unit/application_spec.rb b/spec/unit/application_spec.rb
index 8f75ae3f07d..455325b4de2 100644
--- a/spec/unit/application_spec.rb
+++ b/spec/unit/application_spec.rb
@@ -74,7 +74,7 @@
describe "files in load path" do
it "it should load sorted files" do
- expect(application.files.map { |f| File.basename(f) }).to eq(%w(admin_users.rb companies.rb dashboard.rb stores.rb))
+ expect(application.files.map { |f| File.basename(f) }).to eq %w(admin_users.rb companies.rb dashboard.rb profiles.rb stores.rb)
end
it "should load files in the first level directory" do
@@ -103,7 +103,9 @@
begin
FileUtils.mkdir_p(test_dir)
FileUtils.touch(test_file)
- expect(application.files.map { |f| File.basename(f) }).to eq(%w(posts.rb admin_users.rb companies.rb dashboard.rb stores.rb))
+ expect(application.files.map { |f| File.basename(f) }).to(
+ eq(%w(posts.rb admin_users.rb companies.rb dashboard.rb profiles.rb stores.rb))
+ )
ensure
FileUtils.remove_entry_secure(test_dir, force: true)
end