Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v2.4.0 #827

Merged
merged 1 commit into from
Aug 26, 2024
Merged

Release v2.4.0 #827

merged 1 commit into from
Aug 26, 2024

Conversation

Burgestrand
Copy link
Member

@Burgestrand Burgestrand commented Aug 26, 2024

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 #<User:0x0000000104aefd80> and #<Post:0x0000000104aef8d0 @user=#<User:0x0000000104aefd80>>

In spec_helper.rb:

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:

permissions :show?, :focus do

To do

  • Make changes:
    • Bump Pundit::VERSION in lib/pundit/version.rb.
    • Update CHANGELOG.md.
  • Open pull request 🚀 and merge it.
  • Run push gem GitHub Action.
  • Make an announcement in Pundit discussions

## 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 #<User:0x0000000104aefd80> and #<Post:0x0000000104aef8d0 @user=#<User:0x0000000104aefd80>>

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
```
@Burgestrand Burgestrand marked this pull request as ready for review August 26, 2024 13:01
@Burgestrand Burgestrand merged commit ec75796 into main Aug 26, 2024
14 checks passed
@Burgestrand Burgestrand deleted the kbs/release-v2.4.0 branch August 26, 2024 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant