Module: Decidim::FeatureTestHelpers
- Defined in:
- lib/decidim/dev/test/rspec_support/helpers.rb
Overview
Helpers that get automatically included in feature specs.
Instance Method Summary collapse
- #click_icon(name = nil) ⇒ Object
- #click_submenu_link(text) ⇒ Object
- #expect_user_logged ⇒ Object
- #stripped(text) ⇒ Object
- #within_flash_messages ⇒ Object
- #within_language_menu ⇒ Object
- #within_user_menu ⇒ Object
Instance Method Details
#click_icon(name = nil) ⇒ Object
25 26 27 28 29 |
# File 'lib/decidim/dev/test/rspec_support/helpers.rb', line 25 def click_icon(name = nil) classes = ["icon"] classes << ["icon--#{name}"] if name find(".#{classes.join(".")}").click end |
#click_submenu_link(text) ⇒ Object
5 6 7 8 9 |
# File 'lib/decidim/dev/test/rspec_support/helpers.rb', line 5 def (text) within ".secondary-nav--subnav" do click_link text end end |
#expect_user_logged ⇒ Object
41 42 43 |
# File 'lib/decidim/dev/test/rspec_support/helpers.rb', line 41 def expect_user_logged expect(page).to have_css(".topbar__user__logged") end |
#stripped(text) ⇒ Object
31 32 33 |
# File 'lib/decidim/dev/test/rspec_support/helpers.rb', line 31 def stripped(text) Nokogiri::HTML(text).text end |
#within_flash_messages ⇒ Object
35 36 37 38 39 |
# File 'lib/decidim/dev/test/rspec_support/helpers.rb', line 35 def within ".flash" do yield end end |
#within_language_menu ⇒ Object
18 19 20 21 22 23 |
# File 'lib/decidim/dev/test/rspec_support/helpers.rb', line 18 def within ".topbar__dropmenu.language-choose" do find("ul.dropdown.menu").hover yield end end |
#within_user_menu ⇒ Object
11 12 13 14 15 16 |
# File 'lib/decidim/dev/test/rspec_support/helpers.rb', line 11 def within ".topbar__user__logged" do find("a", text: user.name).hover yield end end |