Module: Compass::Rspec::Menu
- Defined in:
- lib/compass/rspec/menu.rb
Overview
Compass::Menu test helper for RSpec
Defined Under Namespace
Classes: HaveMenuItem
Instance Method Summary collapse
-
#have_menu_item ⇒ HaveMenuItem
Creates a matcher for menu items, allowing you to assert that a menu item with a given label exists.
Instance Method Details
#have_menu_item ⇒ HaveMenuItem
Creates a matcher for menu items, allowing you to assert that a menu item with a given label exists.
I.e.: menu = ExampleMenu.new
expect(menu).to have_menu_item("Dashboard") expect(menu).to have_menu_item("Dashboard").with_url("/dashboard") expect(menu).to have_menu_item("Dashboard").with_icon("fa fa-dashboard") expect(menu).to have_menu_item("Dashboard").with_tags("tag1", "tag2") expect(menu).to have_menu_item("Dashboard").with_badge(1) expect(menu).to( have_menu_item("Dashboard") .with_badge(1) .with_icon("dashboard") )
The matcher will test whether the given menu/item has a
nested authorized item with the given attributes.
To match unauthorized items, you can also pass authorized: false
to have_menu_item.
I.e.:
menu = ExampleMenu.new expect(menu).to have_menu_item("Unauthorized Item", authorized: false)
39 40 41 |
# File 'lib/compass/rspec/menu.rb', line 39 def (...) # rubocop:disable Naming/PredicateName HaveMenuItem.new(...) end |