debian-mirror-gitlab/spec/support/matchers/policy_matchers.rb

18 lines
458 B
Ruby
Raw Normal View History

2019-12-21 20:55:43 +05:30
# 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