Module: Decidim::ComponentTestHelpers

Defined in:
decidim-dev/lib/decidim/dev/test/rspec_support/helpers.rb

Overview

Helpers that get automatically included in component specs.

Instance Method Summary collapse

Instance Method Details


5
6
7
8
9
# File 'decidim-dev/lib/decidim/dev/test/rspec_support/helpers.rb', line 5

def click_submenu_link(text)
  within ".secondary-nav--subnav" do
    click_link text
  end
end

#expect_user_loggedObject


35
36
37
# File 'decidim-dev/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) ⇒ Object


39
40
41
# File 'decidim-dev/lib/decidim/dev/test/rspec_support/helpers.rb', line 39

def have_admin_callout(text)
  have_selector(".callout--full", text: text)
end

#stripped(text) ⇒ Object


25
26
27
# File 'decidim-dev/lib/decidim/dev/test/rspec_support/helpers.rb', line 25

def stripped(text)
  text.gsub(/^<p>/, "").gsub(%r{</p>$}, "")
end

#within_flash_messagesObject


29
30
31
32
33
# File 'decidim-dev/lib/decidim/dev/test/rspec_support/helpers.rb', line 29

def within_flash_messages
  within ".flash" do
    yield
  end
end

#within_language_menuObject


18
19
20
21
22
23
# File 'decidim-dev/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_menuObject


11
12
13
14
15
16
# File 'decidim-dev/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