module Decidim::ComponentTestHelpers

Helpers that get automatically included in component specs.

Public Instance Methods

expect_user_logged() click to toggle source
# File lib/decidim/dev/test/rspec_support/helpers.rb, line 35
def expect_user_logged
  expect(page).to have_css(".topbar__user__logged")
end
have_admin_callout(text) click to toggle source
# File lib/decidim/dev/test/rspec_support/helpers.rb, line 39
def have_admin_callout(text)
  have_selector(".callout--full", text: text)
end
stripped(text) click to toggle source
# File lib/decidim/dev/test/rspec_support/helpers.rb, line 25
def stripped(text)
  text.gsub(/^<p>/, "").gsub(%r{</p>$}, "")
end
within_flash_messages() { || ... } click to toggle source
# File lib/decidim/dev/test/rspec_support/helpers.rb, line 29
def within_flash_messages
  within ".flash" do
    yield
  end
end
within_language_menu() { || ... } click to toggle source
# File lib/decidim/dev/test/rspec_support/helpers.rb, line 18
def within_language_menu
  within ".topbar__dropmenu.language-choose" do
    find("ul.dropdown.menu").click
    yield
  end
end
within_user_menu() { || ... } click to toggle source
# File lib/decidim/dev/test/rspec_support/helpers.rb, line 11
def within_user_menu
  within ".topbar__user__logged" do
    find("a", text: user.name).click
    yield
  end
end