From 6eaf8775c12e35bd7b03357835808946d42b89b2 Mon Sep 17 00:00:00 2001 From: Kim Burgestrand Date: Mon, 26 Aug 2024 14:59:12 +0200 Subject: [PATCH] Release v2.4.0 ## Improve `NotAuthorizedError` message to include policy class (#812) Default error message changed from: > not allowed to destroy? this Comment To include the policy class: > not allowed to Project::Admin::CommentPolicy#destroy? this Comment ## Improve `NotAuthorizedError` when record is a class Before: > not allowed to index? this Class After: > not allowed to PostPolicy#index? Post ## Allow customizing rspec matcher description (#806) Before: > PostPolicy > update? and show? > is expected to permit # and #> In `spec_helper.rb`: ```ruby Pundit::RSpec::Matchers.description = ->(user, record) do "permit user with role #{user.role} to access record with ID #{record.id}" end ``` After: > PostPolicy > update? and show? > is expected to permit user with role admin to access record with ID 130 ## Add support for filter_run_when_matching :focus with permissions helper (#820) If your RSpec config has filter_run_when_matching :focus, you may tag the permissions helper like so: ```ruby permissions :show?, :focus do ``` --- CHANGELOG.md | 9 ++++++++- lib/pundit/version.rb | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f6ed6da..b16cddbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,15 @@ ## Unreleased +## 2.4.0 (2024-08-26) + +## Changed + - Improve the `NotAuthorizedError` message to include the policy class. -Furthermore, in the case where the record passed is a class instead of an instance, the class name is given. (#812) + Furthermore, in the case where the record passed is a class instead of an instance, the class name is given. (#812) + +## Added + - Add customizable permit matcher description (#806) - Add support for filter_run_when_matching :focus with permissions helper. (#820) diff --git a/lib/pundit/version.rb b/lib/pundit/version.rb index 6cdaa20e..049df533 100644 --- a/lib/pundit/version.rb +++ b/lib/pundit/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Pundit - VERSION = "2.3.2" + VERSION = "2.4.0" end