blob: 020c5ce2baf2a891a15bbc366b9f56ec1cde71b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# frozen_string_literal: true
RSpec::Matchers.define :allow_action do |action|
match do |policy|
expect(policy).to be_allowed(action)
end
failure_message do |policy|
policy.debug(action, debug_output = +'')
"expected #{policy} to allow #{action}\n\n#{debug_output}"
end
failure_message_when_negated do |policy|
policy.debug(action, debug_output = +'')
"expected #{policy} not to allow #{action}\n\n#{debug_output}"
end
end
|