Sha256: dde94fda86eb874ab789eeeb7f70407c5f8d3fa3702edbb8c228ed7fa86e23af

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

require "spec_helper"

shared_examples "Managing component permissions" do
  let(:organization) { create(:organization, available_authorizations: ["dummy_authorization_handler"]) }

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

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

    within ".component-#{component.id}" do
      click_link "Permissions"
    end
  end

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

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
decidim-admin-0.11.2 lib/decidim/admin/test/manage_component_permissions_examples.rb
decidim-admin-0.11.1 lib/decidim/admin/test/manage_component_permissions_examples.rb
decidim-admin-0.11.0.pre1 lib/decidim/admin/test/manage_component_permissions_examples.rb