payout / rester

An exceedingly quick way of creating restful interfaces between Ruby services.
https://www.payout.com
MIT License
2 stars 0 forks source link

Provide clearer error when an Array or Hash is expected #77

Closed kayvonghaffari closed 8 years ago

kayvonghaffari commented 8 years ago

I came across this error message: undefined method 'parse' for Array:Class when sending a String for an Array param:

params do
  Array   :array, type: String
end

let(:params) {{ array: 'value' }}

The undefined method error should be rescued and a more descriptive error message should be displayed

roberthoner commented 8 years ago

I don't think this is really an issue with the parse error. The main issue here is that it's giving a parse error at all for this case.

This should cause a validation error that says something like :array should be an array but a String was provided or :hash should be a hash but a String was provided.