blob: a963739878ee44fdee0e23c01b25b578ea774f17 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# frozen_string_literal: true
RSpec.shared_examples 'verified navigation bar' do
it 'renders correctly' do
current_structure = page.find_all('.sidebar-top-level-items > li', class: ['!hidden']).map do |item|
nav_item = item.find_all('a').first.text.gsub(/\s+\d+$/, '') # remove counts at the end
nav_sub_items = item
.find_all('.sidebar-sub-level-items a')
.map(&:text)
.drop(1) # remove the first hidden item
{ nav_item: nav_item, nav_sub_items: nav_sub_items }
end
structure.each { |s| s[:nav_sub_items].compact! }
expect(current_structure).to eq(structure)
end
end
|