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 5, 2024
1 parent 11e3078 commit 1529387
Show file tree
Hide file tree
Showing 8 changed files with 281 additions and 7 deletions.
2 changes: 1 addition & 1 deletion gemfiles/rails_6.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ gem "puma", "~> 5.0"
gem "sass-rails", ">= 6"
gem "bcrypt", "~> 3.1.7"
gem "jsonapi-resources", "~> 0.9"
gem "pundit", "~> 2.0"
gem 'pundit', git: 'https://github.com/financeit/pundit', branch: 'v2.0.1_centah'

gemspec path: "../"
2 changes: 1 addition & 1 deletion gemfiles/rails_6.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ gem "puma", "~> 4.1"
gem "bootsnap", ">= 1.4.2", require: false
gem "psych", "< 4"
gem "jsonapi-resources", "~> 0.9"
gem "pundit", "~> 2.0"
gem 'pundit', git: 'https://github.com/financeit/pundit', branch: 'v2.0.1_centah'

gemspec path: "../"
250 changes: 250 additions & 0 deletions gemfiles/rails_6.gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,250 @@
GIT
remote: https://github.com/financeit/pundit
revision: d6638c22a515f374c1dc3e4824fb0032c1042456
branch: v2.0.1_centah
specs:
pundit (2.0.1)
activesupport (>= 3.0.0)

PATH
remote: ..
specs:
jsonapi-authorization (3.0.1)
base64
jsonapi-resources (~> 0.9)
mutex_m
pundit (>= 1.0.0, < 3.0.0)

GEM
remote: https://rubygems.org/
specs:
actioncable (6.0.6.1)
actionpack (= 6.0.6.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.0.6.1)
actionpack (= 6.0.6.1)
activejob (= 6.0.6.1)
activerecord (= 6.0.6.1)
activestorage (= 6.0.6.1)
activesupport (= 6.0.6.1)
mail (>= 2.7.1)
actionmailer (6.0.6.1)
actionpack (= 6.0.6.1)
actionview (= 6.0.6.1)
activejob (= 6.0.6.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.0.6.1)
actionview (= 6.0.6.1)
activesupport (= 6.0.6.1)
rack (~> 2.0, >= 2.0.8)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.0.6.1)
actionpack (= 6.0.6.1)
activerecord (= 6.0.6.1)
activestorage (= 6.0.6.1)
activesupport (= 6.0.6.1)
nokogiri (>= 1.8.5)
actionview (6.0.6.1)
activesupport (= 6.0.6.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.0.6.1)
activesupport (= 6.0.6.1)
globalid (>= 0.3.6)
activemodel (6.0.6.1)
activesupport (= 6.0.6.1)
activerecord (6.0.6.1)
activemodel (= 6.0.6.1)
activesupport (= 6.0.6.1)
activestorage (6.0.6.1)
actionpack (= 6.0.6.1)
activejob (= 6.0.6.1)
activerecord (= 6.0.6.1)
marcel (~> 1.0)
activesupport (6.0.6.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
appraisal (2.5.0)
bundler
rake
thor (>= 0.14.0)
ast (2.4.2)
base64 (0.2.0)
bootsnap (1.18.4)
msgpack (~> 1.2)
builder (3.3.0)
byebug (11.1.3)
coderay (1.1.3)
concurrent-ruby (1.3.4)
crass (1.0.6)
date (3.3.4)
diff-lcs (1.5.1)
erubi (1.13.0)
globalid (1.1.0)
activesupport (>= 5.0)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
jsonapi-resources (0.10.7)
activerecord (>= 4.1)
concurrent-ruby
railties (>= 4.1)
loofah (2.22.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
mail (2.8.1)
mini_mime (>= 0.1.1)
net-imap
net-pop
net-smtp
marcel (1.0.4)
method_source (1.1.0)
mini_mime (1.1.5)
mini_portile2 (2.8.7)
minitest (5.25.1)
msgpack (1.7.2)
mutex_m (0.2.0)
net-imap (0.4.16)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
timeout
net-smtp (0.5.0)
net-protocol
nio4r (2.7.3)
nokogiri (1.15.6-arm64-darwin)
racc (~> 1.4)
parser (2.7.2.0)
ast (~> 2.4.1)
powerpack (0.1.3)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.10.1)
byebug (~> 11.0)
pry (>= 0.13, < 0.15)
pry-doc (1.5.0)
pry (~> 0.11)
yard (~> 0.9.11)
pry-rails (0.3.11)
pry (>= 0.13.0)
psych (3.3.4)
puma (4.3.12)
nio4r (~> 2.0)
racc (1.8.1)
rack (2.2.9)
rack-test (2.1.0)
rack (>= 1.3)
rails (6.0.6.1)
actioncable (= 6.0.6.1)
actionmailbox (= 6.0.6.1)
actionmailer (= 6.0.6.1)
actionpack (= 6.0.6.1)
actiontext (= 6.0.6.1)
actionview (= 6.0.6.1)
activejob (= 6.0.6.1)
activemodel (= 6.0.6.1)
activerecord (= 6.0.6.1)
activestorage (= 6.0.6.1)
activesupport (= 6.0.6.1)
bundler (>= 1.3.0)
railties (= 6.0.6.1)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (6.0.6.1)
actionpack (= 6.0.6.1)
activesupport (= 6.0.6.1)
method_source
rake (>= 0.8.7)
thor (>= 0.20.3, < 2.0)
rainbow (2.2.2)
rake
rake (13.2.1)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.1)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-rails (5.1.2)
actionpack (>= 5.2)
activesupport (>= 5.2)
railties (>= 5.2)
rspec-core (~> 3.10)
rspec-expectations (~> 3.10)
rspec-mocks (~> 3.10)
rspec-support (~> 3.10)
rspec-support (3.13.1)
rubocop (0.36.0)
parser (>= 2.3.0.0, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7)
ruby-progressbar (1.13.0)
sprockets (4.2.1)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
sprockets-rails (3.4.2)
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
sqlite3 (1.7.3)
mini_portile2 (~> 2.8.0)
thor (1.3.2)
thread_safe (0.3.6)
timeout (0.4.1)
tzinfo (1.2.11)
thread_safe (~> 0.1)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
yard (0.9.37)
zeitwerk (2.6.18)

PLATFORMS
arm64-darwin-23

DEPENDENCIES
appraisal
bootsnap (>= 1.4.2)
bundler
jsonapi-authorization!
jsonapi-resources (~> 0.9)
pry
pry-byebug
pry-doc
pry-rails
psych (< 4)
puma (~> 4.1)
pundit!
rails (~> 6.0.6, >= 6.0.6.1)
rake
rspec
rspec-rails
rubocop (~> 0.36.0)
sqlite3 (~> 1.4)

BUNDLED WITH
2.4.22
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 1529387

Please sign in to comment.