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.:
= ExampleMenu.new
expect().to ("Dashboard")
expect().to ("Dashboard").with_url("/dashboard")
expect().to ("Dashboard").with_icon("fa fa-dashboard")
expect().to ("Dashboard").("tag1", "tag2")
expect().to ("Dashboard").with_badge(1)
expect().to(
("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.:
= ExampleMenu.new
expect().to ("Unauthorized Item", authorized: false)
39 40 41 |
# File 'lib/compass/rspec/menu.rb', line 39 def (...) # rubocop:disable Naming/PredicateName HaveMenuItem.new(...) end |