Sha256: 55484e910f45a731f04c92f40436843f22051ca04f3d3878c992b1515041ef7d

Contents?: true

Size: 1.26 KB

Versions: 23

Compression:

Stored size: 1.26 KB

Contents

# frozen_string_literal: true

require "spec_helper"

shared_examples "Managing feature permissions" do
  let(:organization) { create(:organization, available_authorizations: ["Decidim::DummyAuthorizationHandler"]) }
  let(:user) { create(:user, :admin, :confirmed, organization: organization) }

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

  before do
    switch_to_host(organization.host)
    login_as user, scope: :user
    visit participatory_space_engine.features_path(participatory_space)

    within ".feature-#{feature.id}" do
      page.find(".action-icon--permissions").click
    end
  end

  it "allows setting permissions with json options" do
    within "form.new_feature_permissions" do
      within ".foo-permission" do
        select "Example authorization", from: "feature_permissions_permissions_foo_authorization_handler_name"
        fill_in "feature_permissions_permissions_foo_options", with: '{ "foo": 123 }'
      end
      find("*[type=submit]").click
    end

    expect(page).to have_content("successfully")

    expect(feature.reload.permissions["foo"]).to(
      include(
        "authorization_handler_name" => "decidim/dummy_authorization_handler",
        "options" => { "foo" => 123 }
      )
    )
  end
end

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
decidim-admin-0.7.4 lib/decidim/admin/test/manage_feature_permissions_examples.rb
decidim-admin-0.7.3 lib/decidim/admin/test/manage_feature_permissions_examples.rb
decidim-admin-0.7.2 lib/decidim/admin/test/manage_feature_permissions_examples.rb
decidim-admin-0.7.1 lib/decidim/admin/test/manage_feature_permissions_examples.rb
decidim-admin-0.7.0 lib/decidim/admin/test/manage_feature_permissions_examples.rb
decidim-admin-0.6.8 lib/decidim/admin/test/manage_feature_permissions_examples.rb
decidim-0.6.8 decidim-admin/lib/decidim/admin/test/manage_feature_permissions_examples.rb
decidim-admin-0.6.7 lib/decidim/admin/test/manage_feature_permissions_examples.rb
decidim-0.6.7 decidim-admin/lib/decidim/admin/test/manage_feature_permissions_examples.rb
decidim-admin-0.6.6 lib/decidim/admin/test/manage_feature_permissions_examples.rb
decidim-0.6.6 decidim-admin/lib/decidim/admin/test/manage_feature_permissions_examples.rb
decidim-admin-0.6.5 lib/decidim/admin/test/manage_feature_permissions_examples.rb
decidim-0.6.5 decidim-admin/lib/decidim/admin/test/manage_feature_permissions_examples.rb
decidim-admin-0.6.4 lib/decidim/admin/test/manage_feature_permissions_examples.rb
decidim-0.6.4 decidim-admin/lib/decidim/admin/test/manage_feature_permissions_examples.rb
decidim-admin-0.6.3 lib/decidim/admin/test/manage_feature_permissions_examples.rb
decidim-0.6.3 decidim-admin/lib/decidim/admin/test/manage_feature_permissions_examples.rb
decidim-admin-0.6.2 lib/decidim/admin/test/manage_feature_permissions_examples.rb
decidim-0.6.2 decidim-admin/lib/decidim/admin/test/manage_feature_permissions_examples.rb
decidim-admin-0.6.1 lib/decidim/admin/test/manage_feature_permissions_examples.rb