-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
navigation_spec.rb
55 lines (43 loc) · 1.47 KB
/
navigation_spec.rb
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
require "rails_helper"
describe "navigation" do
let(:navigation) { find(".navigation") }
it "highlights the link to the current page's resource type" do
visit admin_customers_path
active_link = find(".navigation__link--active")
expect(active_link.text).to eq "Customers"
end
it "displays links to resources from admin namespace" do
visit admin_root_path
expect(navigation).to have_link("Customers")
expect(navigation).to have_link("Line Items")
expect(navigation).to have_link("Log Entries")
expect(navigation).to have_link("Products")
expect(navigation).to have_link("Product Meta Tags")
expect(navigation).to have_link("Payments")
expect(navigation).to have_link("Series")
expect(navigation).to have_link("Blog/Posts")
end
it "does not display links to resources configured to not be rendered in navigation" do
LineItemDashboard.configuration.navigation = false
visit admin_root_path
expect(navigation).not_to have_link("Line Items")
LineItemDashboard.configuration.navigation = true # Reset to default
end
it "displays translated name of model" do
translations = {
activerecord: {
models: {
customer: {
one: "User",
other: "Users",
},
},
},
}
with_translations(:en, translations) do
visit admin_customers_path
expect(navigation).to have_link("Users")
expect(page).to have_header("Users")
end
end
end