Sha256: ed2505a61b4f21d78a31268175e8b598661b58b7a0a8ca6c17078b27b01b8482
Contents?: true
Size: 1.06 KB
Versions: 13
Compression:
Stored size: 1.06 KB
Contents
# frozen_string_literal: true require "spec_helper" module Decidim::<%= component_module_name %>::Admin describe Permissions do subject { described_class.new(user, permission_action, context).permissions.allowed? } let(:organization) { create :organization } let(:context) do { current_organization: organization } end let(:action) do { scope: :admin, action: :read, subject: :<%= component_name.to_sym %> } end let(:permission_action) { Decidim::PermissionAction.new(**action) } context "when user is admin" do let(:user) { create :user, :admin, organization: organization } it { is_expected.to be_truthy } context "when scope is not admin" do let(:action) do { scope: :foo, action: :read, subject: :<%= component_name.to_sym %> } end it_behaves_like "permission is not set" end end context "when user is not admin" do let(:user) { create :user, organization: organization } it_behaves_like "permission is not set" end end end
Version data entries
13 entries across 13 versions & 1 rubygems