Sha256: 7fa7826ffd77915d933457904ae5c67662435ac58590ae746467b3d197c4bc49

Contents?: true

Size: 1.4 KB

Versions: 8

Compression:

Stored size: 1.4 KB

Contents

# frozen_string_literal: true

require "spec_helper"

describe "manage a feature's permissions", type: :feature do
  let(:organization) { create(:organization, available_authorizations: ["Decidim::DummyAuthorizationHandler"]) }
  let(:user) { create(:user, :admin, :confirmed, organization: organization) }

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

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

  before do
    switch_to_host(organization.host)
    login_as user, scope: :user
    visit decidim_admin.participatory_process_features_path(participatory_process)

    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

8 entries across 8 versions & 1 rubygems

Version Path
decidim-0.4.3 decidim-admin/spec/features/admin_manages_feature_permissions_spec.rb
decidim-0.4.2 decidim-admin/spec/features/admin_manages_feature_permissions_spec.rb
decidim-0.4.1 decidim-admin/spec/features/admin_manages_feature_permissions_spec.rb
decidim-0.4.0 decidim-admin/spec/features/admin_manages_feature_permissions_spec.rb
decidim-0.3.2 decidim-admin/spec/features/admin_manages_feature_permissions_spec.rb
decidim-0.3.1 decidim-admin/spec/features/admin_manages_feature_permissions_spec.rb
decidim-0.3.0 decidim-admin/spec/features/admin_manages_feature_permissions_spec.rb
decidim-0.2.0 decidim-admin/spec/features/admin_manages_feature_permissions_spec.rb