Sha256: 0beb9e794b6e76e1768d7f5bc86e9513e621c82abbedc3af8c1a38d07b408367

Contents?: true

Size: 783 Bytes

Versions: 4

Compression:

Stored size: 783 Bytes

Contents

module Ddr::Auth
  RSpec.describe EffectivePermissions do

    let(:resource) { FactoryGirl.build(:item) }
    let(:policy) { Collection.new(pid: "coll-1") }
    let(:agents) { [ "Editors", "bob@example.com" ] }
    
    before do
      resource.admin_policy = policy
      resource.roles.grant FactoryGirl.build(:role, :downloader, :public)
      policy.roles.grant type: "Editor", agent: "Editors", scope: "policy"
    end

    it "should return the list of permissions granted to the agents on the resource in resource scope, plus the permissions granted to the agents on the resource's policy in policy scope" do
      expect(described_class.call(resource, agents))
        .to contain_exactly(:read, :download, :add_children, :update, :replace, :arrange)
    end
    
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ddr-models-3.0.0.alpha.4 spec/auth/effective_permissions_spec.rb
ddr-models-3.0.0.alpha.3 spec/auth/effective_permissions_spec.rb
ddr-models-3.0.0.alpha.2 spec/auth/effective_permissions_spec.rb
ddr-models-3.0.0.alpha.1 spec/auth/effective_permissions_spec.rb