model and policy specs

This commit is contained in:
Karol
2019-12-07 13:11:48 +01:00
parent 5625fa63b0
commit c89ee6c102
9 changed files with 109 additions and 13 deletions

View File

@ -1,5 +1,3 @@
# frozen_string_literal: true
class CodeharborLinkPolicy < ApplicationPolicy
def index?
false
@ -18,14 +16,20 @@ class CodeharborLinkPolicy < ApplicationPolicy
end
def edit?
teacher?
owner?
end
def update?
teacher?
owner?
end
def destroy?
teacher?
owner?
end
private
def owner?
@record.reload.user == @user
end
end