class Shoulda::Matchers::ActionController::FilterParamMatcher

@private

Public Class Methods

new(key) click to toggle source
# File lib/shoulda/matchers/action_controller/filter_param_matcher.rb, line 30
def initialize(key)
  @key = key
end

Public Instance Methods

description() click to toggle source
# File lib/shoulda/matchers/action_controller/filter_param_matcher.rb, line 46
def description
  "filter #{@key}"
end
failure_message() click to toggle source
# File lib/shoulda/matchers/action_controller/filter_param_matcher.rb, line 38
def failure_message
  "Expected #{@key} to be filtered; filtered keys: #{filtered_keys.join(', ')}"
end
failure_message_when_negated() click to toggle source
# File lib/shoulda/matchers/action_controller/filter_param_matcher.rb, line 42
def failure_message_when_negated
  "Did not expect #{@key} to be filtered"
end
matches?(controller) click to toggle source
# File lib/shoulda/matchers/action_controller/filter_param_matcher.rb, line 34
def matches?(controller)
  filters_key?
end

Private Instance Methods

filtered_keys() click to toggle source
# File lib/shoulda/matchers/action_controller/filter_param_matcher.rb, line 63
def filtered_keys
  Rails.application.config.filter_parameters
end
filters_key?() click to toggle source
# File lib/shoulda/matchers/action_controller/filter_param_matcher.rb, line 52
def filters_key?
  filtered_keys.any? do |filter|
    case filter
    when Regexp
      filter =~ @key
    else
      filter == @key
    end
  end
end