We're using RSpec output to document the permissions of all our resources. The default description is not what we want since it inspects the user and that adds noise to the output for no value.
I understand that it's probably not reasonable to change the default description because some people may depend on that behavior. But, it would be good to add the ability to customize it.
For example, I added a:
module Pundit
module RSpec
module Matchers
extend ::RSpec::Matchers::DSL
def self.description(&block)
@description = block.call
end
# ...
matcher :permit do |user, record|
# ...
description do
if Pundit::RSpec::Matchers.instance_variable_defined?(:@description)
Pundit::RSpec::Matchers.instance_variable_get(:@description)
else
super
end
end
# ...
end
If you're interested in a related PR, I'll send one in.
We're using RSpec output to document the permissions of all our resources. The default description is not what we want since it inspects the user and that adds noise to the output for no value.
I understand that it's probably not reasonable to change the default description because some people may depend on that behavior. But, it would be good to add the ability to customize it.
For example, I added a:
If you're interested in a related PR, I'll send one in.