Sha256: aa9ebd88c7ac38155feffe9ac1a2cc068b4c4269cefb717e07256a651ddb5443

Contents?: true

Size: 1.02 KB

Versions: 20

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

describe Hydra::AccessControls::Permission do
  describe "hash-like key access" do
    let(:perm) { described_class.new(type: 'user', name: 'bob', access: 'read') }
    it "should return values" do
      perm[:type].should == 'user'
      perm[:name].should == 'bob'
      perm[:access].should == 'read'
    end
  end
  describe "#to_hash" do
    subject { described_class.new(type: 'user', name: 'bob', access: 'read') }
    its(:to_hash) { should == {type: 'user', name: 'bob', access: 'read'} }
  end
  describe "equality comparison" do
    let(:perm1) { described_class.new(type: 'user', name: 'bob', access: 'read') }
    let(:perm2) { described_class.new(type: 'user', name: 'bob', access: 'read') }
    let(:perm3) { described_class.new(type: 'user', name: 'jane', access: 'read') }
    it "should be equal if all values are equal" do
      perm1.should == perm2
    end
    it "should be unequal if some values are unequal" do
      perm1.should_not == perm3
      perm2.should_not == perm3
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
hydra-access-controls-8.2.0 spec/unit/permission_spec.rb
hydra-access-controls-8.1.0 spec/unit/permission_spec.rb
hydra-access-controls-8.0.0 spec/unit/permission_spec.rb
hydra-access-controls-8.0.0.beta1 spec/unit/permission_spec.rb
hydra-access-controls-7.2.2 spec/unit/permission_spec.rb
hydra-access-controls-7.2.1 spec/unit/permission_spec.rb
hydra-access-controls-7.2.0 spec/unit/permission_spec.rb
hydra-access-controls-7.1.0 spec/unit/permission_spec.rb
hydra-access-controls-7.1.0.rc2 spec/unit/permission_spec.rb
hydra-access-controls-7.1.0.rc1 spec/unit/permission_spec.rb
hydra-access-controls-6.5.2 spec/unit/permission_spec.rb
hydra-access-controls-6.5.1 spec/unit/permission_spec.rb
hydra-access-controls-7.0.2 spec/unit/permission_spec.rb
hydra-access-controls-6.4.2 spec/unit/permission.rb
hydra-access-controls-7.0.1 spec/unit/permission_spec.rb
hydra-access-controls-7.0.0 spec/unit/permission_spec.rb
hydra-access-controls-7.0.0.rc1 spec/unit/permission_spec.rb
hydra-access-controls-7.0.0.pre3 spec/unit/permission_spec.rb
hydra-access-controls-6.5.0 spec/unit/permission_spec.rb
hydra-access-controls-6.5.0.rc2 spec/unit/permission_spec.rb