Sha256: b489df6356817effc9bb215d76b340b42fca8983d37fe83b4b9eb503c09d1d18

Contents?: true

Size: 1.15 KB

Versions: 6

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

require "spec_helper"

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

  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
      click_link "Permissions"
    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" => "dummy_authorization_handler",
        "options" => { "foo" => 123 }
      )
    )
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-admin-0.10.1 lib/decidim/admin/test/manage_feature_permissions_examples.rb
decidim-admin-0.10.0 lib/decidim/admin/test/manage_feature_permissions_examples.rb
decidim-admin-0.9.3 lib/decidim/admin/test/manage_feature_permissions_examples.rb
decidim-admin-0.9.2 lib/decidim/admin/test/manage_feature_permissions_examples.rb
decidim-admin-0.9.1 lib/decidim/admin/test/manage_feature_permissions_examples.rb
decidim-admin-0.9.0 lib/decidim/admin/test/manage_feature_permissions_examples.rb