Class: Shoulda::Matchers::ActionController::FilterParamMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/shoulda/matchers/action_controller/filter_param_matcher.rb

Instance Method Summary collapse

Constructor Details

#initialize(key) ⇒ FilterParamMatcher

Returns a new instance of FilterParamMatcher.



30
31
32
# File 'lib/shoulda/matchers/action_controller/filter_param_matcher.rb', line 30

def initialize(key)
  @key = key
end

Instance Method Details

#descriptionObject



47
48
49
# File 'lib/shoulda/matchers/action_controller/filter_param_matcher.rb', line 47

def description
  "filter #{@key}"
end

#failure_messageObject



38
39
40
41
# 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_negatedObject



43
44
45
# 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) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/shoulda/matchers/action_controller/filter_param_matcher.rb', line 34

def matches?(_controller)
  filters_key?
end