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

Instance Method Details

#click_icon(name = nil) ⇒ Object



19
20
21
22
23
# File 'lib/decidim/dev/test/rspec_support/helpers.rb', line 19

def click_icon(name = nil)
  classes = ["icon"]
  classes << ["icon--#{name}"] if name
  find(".#{classes.join(".")}").click
end

#expect_user_loggedObject



35
36
37
# File 'lib/decidim/dev/test/rspec_support/helpers.rb', line 35

def expect_user_logged
  expect(page).to have_css(".topbar__user__logged")
end

#stripped(text) ⇒ Object



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

def stripped(text)
  Nokogiri::HTML(text).text
end

#within_flash_messagesObject



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

def within_flash_messages
  within ".flash" do
    yield
  end
end

#within_language_menuObject



12
13
14
15
16
17
# File 'lib/decidim/dev/test/rspec_support/helpers.rb', line 12

def within_language_menu
  within ".topbar__dropmenu.language-choose" do
    find("ul.dropdown.menu").hover
    yield
  end
end

#within_user_menuObject



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

def within_user_menu
  within ".topbar__user__logged" do
    find("a", text: user.name).hover
    yield
  end
end