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

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

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(key) ⇒ FilterParamMatcher

Returns a new instance of FilterParamMatcher.


16
17
18
# File 'lib/shoulda/action_controller/matchers/filter_param_matcher.rb', line 16

def initialize(key)
  @key = key.to_s
end

Instance Method Details

#descriptionObject


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

def description
  "filter #{@key}"
end

#failure_messageObject


25
26
27
# File 'lib/shoulda/action_controller/matchers/filter_param_matcher.rb', line 25

def failure_message
  "Expected #{@key} to be filtered"
end

#matches?(controller) ⇒ Boolean

Returns:

  • (Boolean)

20
21
22
23
# File 'lib/shoulda/action_controller/matchers/filter_param_matcher.rb', line 20

def matches?(controller)
  @controller = controller
  filters_params? && filters_key?
end

#negative_failure_messageObject


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

def negative_failure_message
  "Did not expect #{@key} to be filtered"
end