Sha256: 8a41c6b56d75869d09705b228c1bd52eba40146167bf6153e1636d2a57c1d42f

Contents?: true

Size: 1.83 KB

Versions: 6

Compression:

Stored size: 1.83 KB

Contents

# frozen_string_literal: true

shared_context "with a feature" do
  let(:manifest) { Decidim.find_feature_manifest(manifest_name) }

  let(:user) { create :user, :confirmed, organization: organization }

  let!(:organization) { create(:organization) }

  let(:participatory_process) do
    create(:participatory_process, :with_steps, organization: organization)
  end

  let(:participatory_space) { participatory_process }

  let!(:feature) do
    create(:feature,
           manifest: manifest,
           participatory_space: participatory_space)
  end

  let!(:category) { create :category, participatory_space: participatory_process }

  let!(:scope) { create :scope, organization: organization }

  before do
    switch_to_host(organization.host)
  end

  def visit_feature
    page.visit main_feature_path(feature)
  end
end

shared_context "when managing a feature" do
  include_context "with a feature"

  let(:current_feature) { feature }

  before do
    login_as user, scope: :user
    visit_feature_admin
  end

  def visit_feature_admin
    visit manage_feature_path(feature)
  end

  # Returns the config path for a given feature.
  #
  # feature - the Feature we want to find the root path for.
  #
  # Returns a url.
  def edit_feature_path(feature)
    Decidim::EngineRouter.admin_proxy(feature.participatory_space).edit_feature_path(feature.id)
  end
end

shared_context "when managing a feature as an admin" do
  include_context "when managing a feature"

  let(:user) do
    create :user,
           :admin,
           :confirmed,
           organization: organization
  end
end

shared_context "when managing a feature as a process admin" do
  include_context "when managing a feature"

  let(:user) do
    create :process_admin,
           :confirmed,
           organization: organization,
           participatory_process: participatory_process
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-dev-0.10.1 lib/decidim/dev/test/rspec_support/feature_context.rb
decidim-dev-0.10.0 lib/decidim/dev/test/rspec_support/feature_context.rb
decidim-dev-0.9.3 lib/decidim/dev/test/rspec_support/feature_context.rb
decidim-dev-0.9.2 lib/decidim/dev/test/rspec_support/feature_context.rb
decidim-dev-0.9.1 lib/decidim/dev/test/rspec_support/feature_context.rb
decidim-dev-0.9.0 lib/decidim/dev/test/rspec_support/feature_context.rb