class Shoulda::Matchers::ActionController::RouteParams
Attributes
args[R]
Public Class Methods
new(args)
click to toggle source
# File lib/shoulda/matchers/action_controller/route_params.rb, line 5 def initialize(args) @args = args end
Public Instance Methods
normalize()
click to toggle source
# File lib/shoulda/matchers/action_controller/route_params.rb, line 9 def normalize if controller_and_action_given_as_string? extract_params_from_string else stringify_params end end
Private Instance Methods
controller_and_action_given_as_string?()
click to toggle source
# File lib/shoulda/matchers/action_controller/route_params.rb, line 21 def controller_and_action_given_as_string? args[0].is_a?(String) end
extract_params_from_string()
click to toggle source
# File lib/shoulda/matchers/action_controller/route_params.rb, line 25 def extract_params_from_string params = args[1] || {} controller, action = args[0].split('#') params.merge!(controller: controller, action: action) end
stringify(value)
click to toggle source
# File lib/shoulda/matchers/action_controller/route_params.rb, line 37 def stringify(value) if value.is_a?(Array) value.map(&:to_param) else value.to_param end end
stringify_params()
click to toggle source
# File lib/shoulda/matchers/action_controller/route_params.rb, line 31 def stringify_params args[0].each do |key, value| args[0][key] = stringify(value) end end