Replies: 2 comments
-
|
Hi @palkan The PR is on its way : master...inkstak:action_policy:feature-rspec_failed_with_reason |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Hey @inkstak, Yeah, this feature can be useful. I'm not sure about the API though. I'd like to avoid adding more DSL methods; maybe, we can incorporate something into existing ones? A quick idea is as follows: describe FooPolicy do
describe_rule :manage? do
failed "when condition A is not met", reason: :reason_a
# for nested policies
failed "when condition A is not met", reason: {bar: :reason_b}
end
endWDYT? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi @palkan
I'm starting to use ActionPolicy reasons and it's very helpful to debug policies when used with RSpec DSL :
Now, I'm thinking it will also be helpful to ensure a test failed for the right reason :
When rules becomes more complicated, it allows to identify false-positives.
What do you think ?
I'm already starting to prepare a PR.
Beta Was this translation helpful? Give feedback.
All reactions