Hello community, here is the log from the commit of package rubygem-pundit for openSUSE:Factory checked in at 2019-06-19 21:00:49 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-pundit (Old) and /work/SRC/openSUSE:Factory/.rubygem-pundit.new.4811 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-pundit" Wed Jun 19 21:00:49 2019 rev:2 rq:706016 version:2.0.1 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-pundit/rubygem-pundit.changes 2018-07-23 18:02:08.736845938 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-pundit.new.4811/rubygem-pundit.changes 2019-06-19 21:00:50.950110713 +0200 @@ -1,0 +2,17 @@ +Sat Mar 2 15:31:29 UTC 2019 - Stephan Kulow <[email protected]> + +- updated to version 2.0.1 + see installed CHANGELOG.md + + ## 2.0.1 (2019-01-18) + + ### Breaking changes + + None + + ### Other changes + + - Improve exception handling for `#policy_scope` and `#policy_scope!`. (#550) + - Add `:policy` metadata to RSpec template. (#566) + +------------------------------------------------------------------- Old: ---- pundit-2.0.0.gem New: ---- pundit-2.0.1.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-pundit.spec ++++++ --- /var/tmp/diff_new_pack.5kWXC6/_old 2019-06-19 21:00:51.698111341 +0200 +++ /var/tmp/diff_new_pack.5kWXC6/_new 2019-06-19 21:00:51.702111344 +0200 @@ -1,7 +1,7 @@ # # spec file for package rubygem-pundit # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,7 +12,7 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # @@ -24,7 +24,7 @@ # Name: rubygem-pundit -Version: 2.0.0 +Version: 2.0.1 Release: 0 %define mod_name pundit %define mod_full_name %{mod_name}-%{version} ++++++ pundit-2.0.0.gem -> pundit-2.0.1.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.rubocop.yml new/.rubocop.yml --- old/.rubocop.yml 2018-07-21 20:37:53.000000000 +0200 +++ new/.rubocop.yml 2019-01-18 14:05:13.000000000 +0100 @@ -1,6 +1,6 @@ AllCops: DisplayCopNames: true - TargetRubyVersion: 2.1 + TargetRubyVersion: 2.2 Exclude: - "gemfiles/**/*" - "vendor/**/*" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.travis.yml new/.travis.yml --- old/.travis.yml 2018-07-21 20:37:53.000000000 +0200 +++ new/.travis.yml 2019-01-18 14:05:13.000000000 +0100 @@ -1,21 +1,20 @@ language: ruby -sudo: false before_install: - - gem update --system - - gem install bundler + - gem install bundler -v 1.17.3 matrix: include: - rvm: 2.5.1 script: bundle exec rake rubocop # ONLY lint once, first - rvm: 2.1 - - rvm: 2.2.8 + - rvm: 2.2 - rvm: 2.3.5 - rvm: 2.4.2 - rvm: 2.5.1 + - rvm: 2.6.0 - rvm: jruby-9.1.8.0 env: - JRUBY_OPTS="--debug" - - rvm: jruby-9.2.0.0 + - rvm: jruby-9.2.5.0 env: - JRUBY_OPTS="--debug" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md --- old/CHANGELOG.md 2018-07-21 20:37:53.000000000 +0200 +++ new/CHANGELOG.md 2019-01-18 14:05:13.000000000 +0100 @@ -1,21 +1,38 @@ # Pundit +## 2.0.1 (2019-01-18) + +### Breaking changes + +None + +### Other changes + +- Improve exception handling for `#policy_scope` and `#policy_scope!`. (#550) +- Add `:policy` metadata to RSpec template. (#566) + ## 2.0.0 (2018-07-21) No changes since beta1 ## 2.0.0.beta1 (2018-07-04) +### Breaking changes + +- Only pass last element of "namespace array" to policy and scope. (#529) +- Raise `InvalidConstructorError` if a policy or policy scope with an invalid constructor is called. (#462) +- Return passed object from `#authorize` method to make chaining possible. (#385) + +### Other changes + - Add `policy_class` option to `authorize` to be able to override the policy. (#441) - Add `policy_scope_class` option to `authorize` to be able to override the policy scope. (#441) - Fix `param_key` issue when passed an array. (#529) -- Only pass last element of "namespace array" to policy and scope. (#529) - Allow specification of a `NilClassPolicy`. (#525) - Make sure `policy_class` override is called when passed an array. (#475) -- Raise `InvalidConstructorError` if a policy or policy scope with an invalid constructor is called. (#462) + - Use `action_name` instead of `params[:action]`. (#419) - Add `pundit_params_for` method to make it easy to customize params fetching. (#502) -- Return passed object from `#authorize` method to make chaining possible. (#385) ## 1.1.0 (2016-01-14) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/LICENSE.txt new/LICENSE.txt --- old/LICENSE.txt 2018-07-21 20:37:53.000000000 +0200 +++ new/LICENSE.txt 2019-01-18 14:05:13.000000000 +0100 @@ -1,4 +1,4 @@ -Copyright (c) 2012 Jonas Nicklas, Elabs AB +Copyright (c) 2018 Jonas Nicklas, Varvet AB MIT License diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2018-07-21 20:37:53.000000000 +0200 +++ new/README.md 2019-01-18 14:05:13.000000000 +0100 @@ -195,6 +195,10 @@ end ``` +Note that the headless policy still needs to accept two arguments. The +second argument will just be the symbol `:dashboard` in this case which +is what is passed as the record to `authorize` below. + ```ruby # In controllers authorize :dashboard, :show? Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/generators/rspec/templates/policy_spec.rb new/lib/generators/rspec/templates/policy_spec.rb --- old/lib/generators/rspec/templates/policy_spec.rb 2018-07-21 20:37:53.000000000 +0200 +++ new/lib/generators/rspec/templates/policy_spec.rb 2019-01-18 14:05:13.000000000 +0100 @@ -1,6 +1,6 @@ require '<%= File.exists?('spec/rails_helper.rb') ? 'rails_helper' : 'spec_helper' %>' -RSpec.describe <%= class_name %>Policy do +RSpec.describe <%= class_name %>Policy, type: :policy do let(:user) { User.new } subject { described_class } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/pundit/version.rb new/lib/pundit/version.rb --- old/lib/pundit/version.rb 2018-07-21 20:37:53.000000000 +0200 +++ new/lib/pundit/version.rb 2019-01-18 14:05:13.000000000 +0100 @@ -1,5 +1,5 @@ # frozen_string_literal: true module Pundit - VERSION = "2.0.0".freeze + VERSION = "2.0.1".freeze end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/pundit.rb new/lib/pundit.rb --- old/lib/pundit.rb 2018-07-21 20:37:53.000000000 +0200 +++ new/lib/pundit.rb 2019-01-18 14:05:13.000000000 +0100 @@ -80,10 +80,16 @@ # @raise [InvalidConstructorError] if the policy constructor called incorrectly # @return [Scope{#resolve}, nil] instance of scope class which can resolve to a scope def policy_scope(user, scope) - policy_scope = PolicyFinder.new(scope).scope - policy_scope.new(user, pundit_model(scope)).resolve if policy_scope - rescue ArgumentError - raise InvalidConstructorError, "Invalid #<#{policy_scope}> constructor is called" + policy_scope_class = PolicyFinder.new(scope).scope + return unless policy_scope_class + + begin + policy_scope = policy_scope_class.new(user, pundit_model(scope)) + rescue ArgumentError + raise InvalidConstructorError, "Invalid #<#{policy_scope_class}> constructor is called" + end + + policy_scope.resolve end # Retrieves the policy scope for the given record. @@ -95,10 +101,16 @@ # @raise [InvalidConstructorError] if the policy constructor called incorrectly # @return [Scope{#resolve}] instance of scope class which can resolve to a scope def policy_scope!(user, scope) - policy_scope = PolicyFinder.new(scope).scope! - policy_scope.new(user, pundit_model(scope)).resolve - rescue ArgumentError - raise InvalidConstructorError, "Invalid #<#{policy_scope}> constructor is called" + policy_scope_class = PolicyFinder.new(scope).scope! + return unless policy_scope_class + + begin + policy_scope = policy_scope_class.new(user, pundit_model(scope)) + rescue ArgumentError + raise InvalidConstructorError, "Invalid #<#{policy_scope_class}> constructor is called" + end + + policy_scope.resolve end # Retrieves the policy for the given record. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2018-07-21 20:37:53.000000000 +0200 +++ new/metadata 2019-01-18 14:05:13.000000000 +0100 @@ -1,15 +1,15 @@ --- !ruby/object:Gem::Specification name: pundit version: !ruby/object:Gem::Version - version: 2.0.0 + version: 2.0.1 platform: ruby authors: - Jonas Nicklas -- Elabs AB +- Varvet AB autorequire: bindir: bin cert_chain: [] -date: 2018-07-21 00:00:00.000000000 Z +date: 2019-01-18 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: activesupport @@ -83,7 +83,7 @@ version: '0' requirements: [] rubyforge_project: -rubygems_version: 2.7.6 +rubygems_version: 2.5.2 signing_key: specification_version: 4 summary: OO authorization for Rails diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pundit.gemspec new/pundit.gemspec --- old/pundit.gemspec 2018-07-21 20:37:53.000000000 +0200 +++ new/pundit.gemspec 2019-01-18 14:05:13.000000000 +0100 @@ -5,7 +5,7 @@ Gem::Specification.new do |gem| gem.name = "pundit" gem.version = Pundit::VERSION - gem.authors = ["Jonas Nicklas", "Elabs AB"] + gem.authors = ["Jonas Nicklas", "Varvet AB"] gem.email = ["[email protected]", "[email protected]"] gem.description = "Object oriented authorization for Rails applications" gem.summary = "OO authorization for Rails" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/pundit_spec.rb new/spec/pundit_spec.rb --- old/spec/pundit_spec.rb 2018-07-21 20:37:53.000000000 +0200 +++ new/spec/pundit_spec.rb 2019-01-18 14:05:13.000000000 +0100 @@ -16,6 +16,7 @@ let(:tag_four_five_six) { ProjectOneTwoThree::TagFourFiveSix.new(user) } let(:avatar_four_five_six) { ProjectOneTwoThree::AvatarFourFiveSix.new } let(:wiki) { Wiki.new } + let(:thread) { Thread.new } describe ".authorize" do it "infers the policy and authorizes based on it" do @@ -88,6 +89,12 @@ Pundit.policy_scope(user, Wiki) end.to raise_error(Pundit::InvalidConstructorError, "Invalid #<WikiPolicy::Scope> constructor is called") end + + it "raises an original error with a policy scope that contains error" do + expect do + Pundit.policy_scope(user, Thread) + end.to raise_error(ArgumentError) + end end describe ".policy_scope!" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/spec_helper.rb new/spec/spec_helper.rb --- old/spec/spec_helper.rb 2018-07-21 20:37:53.000000000 +0200 +++ new/spec/spec_helper.rb 2019-01-18 14:05:13.000000000 +0100 @@ -236,6 +236,18 @@ end end +class Thread + def self.all; end +end +class ThreadPolicy < Struct.new(:user, :thread) + class Scope < Struct.new(:user, :scope) + def resolve + # deliberate wrong useage of the method + scope.all(:unvalid, :parameters) + end + end +end + class PostFourFiveSix < Struct.new(:user); end class CommentFourFiveSix; extend ActiveModel::Naming; end
