summaryrefslogtreecommitdiff
path: root/spec/support/helpers/navbar_structure_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/helpers/navbar_structure_helper.rb')
-rw-r--r--spec/support/helpers/navbar_structure_helper.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/spec/support/helpers/navbar_structure_helper.rb b/spec/support/helpers/navbar_structure_helper.rb
index c7aa2ffe536..11e67ba394c 100644
--- a/spec/support/helpers/navbar_structure_helper.rb
+++ b/spec/support/helpers/navbar_structure_helper.rb
@@ -4,13 +4,13 @@ module NavbarStructureHelper
def insert_after_nav_item(before_nav_item_name, new_nav_item:)
expect(structure).to include(a_hash_including(nav_item: before_nav_item_name))
- index = structure.find_index { |h| h[:nav_item] == before_nav_item_name }
+ index = structure.find_index { |h| h[:nav_item] == before_nav_item_name if h }
structure.insert(index + 1, new_nav_item)
end
def insert_after_sub_nav_item(before_sub_nav_item_name, within:, new_sub_nav_item_name:)
expect(structure).to include(a_hash_including(nav_item: within))
- hash = structure.find { |h| h[:nav_item] == within }
+ hash = structure.find { |h| h[:nav_item] == within if h }
expect(hash).to have_key(:nav_sub_items)
expect(hash[:nav_sub_items]).to include(before_sub_nav_item_name)