Hi,
I need some help to spec’ a function I am developping. Note that the
function is still not complete, cause I am trying to spec’ it while
working on it, as it should be ! Basically, this is what my function
should look like :
private
def obtain_criterias(hash_params)
crits = {}
hash_params.each {
|key, val|
crits[key.to_sym] = StringUtils.sanitize(val).upcase if not (key
== “controller” || key == “action”)
}
return crits
end
- hash_params is a hash table of some parameters received by a
controller - StringUtils.sanitize removes all kind of accents from the string
passed in parameters - it is encapsulated in a controller
The problem is with the local variable “crits” on which I can not seem
to have any kind of control in my rspec. Now, I am wandering, is this
(still) a good way to code from a spec point of view ?! Can you give
me ideas on ways to spec this ?
Many thanks in advance !
Mathieu