spec/auth/ability_spec.rb in ddr-models-3.0.0.beta.20 vs spec/auth/ability_spec.rb in ddr-models-3.0.0.beta.21

- old
+ new

@@ -208,9 +208,28 @@ end end end + describe "locks" do + let(:obj) { Ddr::Models::Base.new } + + describe "effects of locks on abilities" do + before do + allow(obj).to receive(:effective_permissions) { Permissions::ALL } + allow(obj).to receive(:locked?) { true } + end + it { should be_able_to(:read, obj) } + it { should be_able_to(:download, obj) } + it { should_not be_able_to(:add_children, obj) } + it { should_not be_able_to(:update, obj) } + it { should_not be_able_to(:replace, obj) } + it { should_not be_able_to(:arrange, obj) } + it { should be_able_to(:audit, obj) } + it { should_not be_able_to(:grant, obj) } + end + end + describe "role based abilities" do shared_examples "it has role based abilities" do describe "when permissions are cached" do before { subject.cache[cache_key] = [ Permissions::READ ] } it "should use the cached permissions" do