Skip to content

Commit

Permalink
Update test policies to match what we have in Centah
Browse files Browse the repository at this point in the history
Because we forked pundit we have to test against that forked pundit as well.
  • Loading branch information
Skipants committed Sep 23, 2024
1 parent f4a77b8 commit 1044a1b
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 5 deletions.
8 changes: 7 additions & 1 deletion spec/dummy/app/policies/article_policy.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
class ArticlePolicy
class Scope < Struct.new(:user, :scope)
class Scope
def initialize(user, scope, options: {})
@user = user
@scope = scope
@options = options
end

def resolve
raise NotImplementedError
end
Expand Down
8 changes: 7 additions & 1 deletion spec/dummy/app/policies/comment_policy.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
class CommentPolicy
class Scope < Struct.new(:user, :scope)
class Scope
def initialize(user, scope, options: {})
@user = user
@scope = scope
@options = options
end

def resolve
raise NotImplementedError
end
Expand Down
8 changes: 7 additions & 1 deletion spec/dummy/app/policies/tag_policy.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
class TagPolicy
class Scope < Struct.new(:user, :scope)
class Scope
def initialize(user, scope, options: {})
@user = user
@scope = scope
@options = options
end

def resolve
raise NotImplementedError
end
Expand Down
8 changes: 7 additions & 1 deletion spec/dummy/app/policies/user_policy.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
class UserPolicy
class Scope < Struct.new(:user, :scope)
class Scope
def initialize(user, scope, options: {})
@user = user
@scope = scope
@options = options
end

def resolve
raise NotImplementedError
end
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/config/initializers/jsonapi.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
JSONAPI.configure do |config|
config.default_processor_klass_name = JSONAPI::Authorization::AuthorizingProcessor
config.default_processor_klass_name = 'JSONAPI::Authorization::AuthorizingProcessor'
config.exception_class_whitelist = [Pundit::NotAuthorizedError]
end

0 comments on commit 1044a1b

Please sign in to comment.