Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Floppy committed Aug 29, 2024
1 parent 4ae9611 commit dd0fa7b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
1 change: 0 additions & 1 deletion app/models/concerns/caber/object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@ def revoke_permission(permission, subject)
def revoke_all_permissions(subject)
Caber::Relation.where(object: self, subject: subject).destroy_all
end

end
14 changes: 6 additions & 8 deletions spec/models/caber/relation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,14 @@
end

it "removes a specific permission" do
expect{object.revoke_permission("viewer", alice)}.
to change { alice.has_permission_on?("viewer", object) }.from(true).to(false)
expect { object.revoke_permission("viewer", alice) }
.to change { alice.has_permission_on?("viewer", object) }.from(true).to(false)
end

it "removes all permissions" do
expect{object.revoke_all_permissions(alice)}.
to change { alice.has_permission_on?("viewer", object) }.from(true).to(false)
expect { object.revoke_all_permissions(alice) }
.to change { alice.has_permission_on?("viewer", object) }.from(true).to(false)
end

end

context "removing permissions on object/subject removal" do
Expand All @@ -134,12 +133,11 @@
end

it "removes permission when subject is removed" do
expect { alice.destroy }.to change {Caber::Relation.count}.by(-1)
expect { alice.destroy }.to change { Caber::Relation.count }.by(-1)
end

it "removes permission when object is removed" do
expect { object.destroy }.to change {Caber::Relation.count}.by(-1)
expect { object.destroy }.to change { Caber::Relation.count }.by(-1)
end
end

end

0 comments on commit dd0fa7b

Please sign in to comment.