Action Policy v0.4.0 Release Notes
Release Date: 2019-12-11 // over 4 years ago-
๐ Features
- Optional authorization context. (#95)
In addition to
allow_nil: true
, we now have an option to skip the context altogether:class OptionalRolePolicy \< ActionPolicy::Baseauthorize :role, optional: trueendpolicy = OptionalRolePolicy.newpolicy.role #=\> nil
- ๐ Rails generators. (#87)
Now you can use
action_policy:install
andaction_policy:policy MODEL
Rails generators.- ๐ New instrumentation event:
action_policy.init
.
Triggered every time a new policy object is initialized.
๐ Changes
- โ Composed matchers are supported in authorization target testing.
โ Now you can write tests like this:
expect { subject }.to be\_authorized\_to(:show?, an\_instance\_of(User))