Sha256: fc062637b61c0b9c7bf9f4a0b343a92e5af5aaf7abf79efd5c1cda107d19dd02

Contents?: true

Size: 878 Bytes

Versions: 7

Compression:

Stored size: 878 Bytes

Contents

require 'spec_helper'

module Ddr
  module Models
    RSpec.describe HasRoleAssignments, type: :model do
    
      before(:all) do
        class RoleAssignable < ActiveFedora::Base
          include HasRoleAssignments
        end
      end

      subject { RoleAssignable.new }

      describe "#principal_has_role?" do
        it "should respond when given a list of principals and a valid role" do
          expect { subject.principal_has_role?(["bob", "admins"], :administrator) }.not_to raise_error
        end
        it "should respond when given a principal name and a valid role" do
          expect { subject.principal_has_role?("bob", :administrator) }.not_to raise_error
        end
        it "should raise an error when given an invalid role" do
          expect { subject.principal_has_role?("bob", :foo) }.to raise_error
        end
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ddr-models-1.7.0 spec/models/has_role_assignments_spec.rb
ddr-models-1.6.0 spec/models/has_role_assignments_spec.rb
ddr-models-1.5.0 spec/models/has_role_assignments_spec.rb
ddr-models-1.4.0 spec/models/has_role_assignments_spec.rb
ddr-models-1.3.0 spec/models/has_role_assignments_spec.rb
ddr-models-1.2.1 spec/models/has_role_assignments_spec.rb
ddr-models-1.2.0 spec/models/has_role_assignments_spec.rb