1
0
Fork 0

Add PasswordConfirmationPolicy

This commit is contained in:
Alex Kotov 2018-11-30 13:24:40 +05:00
parent 734bfe1dc1
commit 220063b670
No known key found for this signature in database
GPG key ID: 4E831250F47DE154
2 changed files with 35 additions and 0 deletions

View file

@ -0,0 +1,10 @@
# frozen_string_literal: true
class PassportConfirmationPolicy < ApplicationPolicy
def create?
return false if record.passport.nil?
return false if record.user != user
policy(record.passport).show?
end
end

View file

@ -0,0 +1,25 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe PassportConfirmationPolicy do
permissions '.scope' do
pending "add some examples to (or delete) #{__FILE__}"
end
permissions :show? do
pending "add some examples to (or delete) #{__FILE__}"
end
permissions :create? do
pending "add some examples to (or delete) #{__FILE__}"
end
permissions :update? do
pending "add some examples to (or delete) #{__FILE__}"
end
permissions :destroy? do
pending "add some examples to (or delete) #{__FILE__}"
end
end