Sha256: 3649785d5d97e31aef8a3aa77478a6e0e4e1c6837002a31294f67634bd418c6d

Contents?: true

Size: 1.25 KB

Versions: 18

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

# Helpers that get automatically included in component specs.
module Decidim::ComponentTestHelpers
  def click_submenu_link(text)
    within ".secondary-nav--subnav" do
      click_link text
    end
  end

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

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

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

  def within_flash_messages
    within ".flash" do
      yield
    end
  end

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

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

  def stub_get_request_with_format(rq_url, rs_format)
    stub_request(:get, rq_url)
      .with(
        headers: {
          "Accept" => "*/*",
          "Accept-Encoding" => "gzip;q=1.0,deflate;q=0.6,identity;q=0.3",
          "User-Agent" => "Ruby"
        }
      )
      .to_return(status: 200, body: "", headers: { content_type: rs_format })
  end
end

RSpec.configure do |config|
  config.include Decidim::ComponentTestHelpers, type: :system
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
decidim-dev-0.27.9 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-dev-0.27.8 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-dev-0.27.7 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-dev-0.27.6 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-dev-0.26.10 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-dev-0.26.9 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-dev-0.27.5 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-dev-0.26.8 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-dev-0.27.4 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-dev-0.27.3 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-dev-0.26.7 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-dev-0.26.5 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-dev-0.27.2 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-dev-0.27.1 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-dev-0.26.4 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-dev-0.27.0 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-dev-0.26.3 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-dev-0.27.0.rc2 lib/decidim/dev/test/rspec_support/helpers.rb