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 48
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
Also aliased as: failure_message_for_should
failure_message_for_should()
Alias for: failure_message
failure_message_for_should_not()
failure_message_when_negated() click to toggle source
# File lib/shoulda/matchers/action_controller/filter_param_matcher.rb, line 43
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 65
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 54
def filters_key?
  filtered_keys.any? do |filter|
    case filter
    when Regexp
      filter =~ @key
    else
      filter == @key
    end
  end
end