-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
/
menu.feature
84 lines (77 loc) · 2.43 KB
/
menu.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
Feature: Menu
Background:
Given I am logged in
Scenario: Hide the menu item
Given a configuration of:
"""
ActiveAdmin.register Post do
menu false
end
"""
When I am on the dashboard
Then I should not see a menu item for "Posts"
Scenario: Set the menu item label
Given a configuration of:
"""
ActiveAdmin.register Post do
menu label: "Articles"
end
"""
When I am on the dashboard
Then I should see a menu item for "Articles"
And I should not see a menu item for "Posts"
Scenario: Add a non-resource menu item
Given a configuration of:
"""
ActiveAdmin.application.namespace :admin do |admin|
admin.build_menu do |menu|
menu.add label: "Custom Menu", url: :admin_dashboard_path
end
end
"""
When I am on the dashboard
Then I should see a menu item for "Custom Menu"
When I follow "Custom Menu"
Then I should be on the admin dashboard page
Scenario: Add a non-resource menu item with method delete
Given a configuration of:
"""
ActiveAdmin.application.namespace :admin do |admin|
admin.build_menu do |menu|
menu.add label: "Delete Menu", url: :admin_dashboard_path, html_options: { method: :delete }
end
end
"""
When I am on the dashboard
Then I should see a menu item for "Delete Menu"
And I should see the element "a[data-method='delete']:contains('Delete Menu')"
Scenario: Adding a resource as a sub menu item
Given a configuration of:
"""
ActiveAdmin.register User
ActiveAdmin.register Post do
menu parent: 'Users'
end
"""
When I am on the dashboard
Then I should see a menu item for "Users"
And the "Posts" menu item should be hidden
When I follow "Users"
Then the "Users" menu item should be selected
And I should see a nested menu item for "Posts"
Scenario: Adding a resources as a sub menu items
Given a configuration of:
"""
ActiveAdmin.register Category do
menu parent: 'Anything'
end
ActiveAdmin.register Post do
menu parent: 'Anything'
end
"""
When I am on the dashboard
Then I should see a menu parent for "Anything"
And the "Categories" menu item should be hidden
And the "Posts" menu item should be hidden
And I should see a nested menu item for "Categories"
And I should see a nested menu item for "Posts"