Sha256: 55b30371f7c7e83b817626b115d4bccecb2f78dcb998853294cbb98f47ae4af6
Contents?: true
Size: 1023 Bytes
Versions: 4
Compression:
Stored size: 1023 Bytes
Contents
module Shoulda # :nodoc: module Matchers module ActionController # :nodoc: class RouteParams def initialize(args) @args = args end def normalize if controller_and_action_given_as_string? extract_params_from_string else stringify_params end end private attr_reader :args def controller_and_action_given_as_string? args[0].is_a?(String) end def extract_params_from_string params = args[1] || {} controller, action = args[0].split('#') params.merge!(controller: controller, action: action) end def stringify_params args[0].each do |key, value| args[0][key] = stringify(value) end end def stringify(value) if value.is_a?(Array) value.map(&:to_param) else value.to_param end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems