/usr/lib/ruby/vendor_ruby/shoulda/matchers/action_controller/filter_param_matcher.rb is in ruby-shoulda-matchers 1.0.0~beta2-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | module Shoulda # :nodoc:
module Matchers
module ActionController # :nodoc:
# Ensures that filter_parameter_logging is set for the specified key.
#
# Example:
#
# it { should filter_param(:password) }
def filter_param(key)
FilterParamMatcher.new(key)
end
class FilterParamMatcher # :nodoc:
def initialize(key)
@key = key.to_s
end
def matches?(controller)
@controller = controller
filters_key?
end
def failure_message
"Expected #{@key} to be filtered; filtered keys: #{filtered_keys.join(', ')}"
end
def negative_failure_message
"Did not expect #{@key} to be filtered"
end
def description
"filter #{@key}"
end
private
def filters_key?
filtered_keys.include?(@key)
end
def filtered_keys
Rails.application.config.filter_parameters.map { |filter| filter.to_s }
end
end
end
end
end
|