[rspec-users] Expecting an array but getting a string using webrat

Frank francisco.licea at gmail.com
Tue May 4 15:51:05 EDT 2010

Hi Guys,

I'm new to webrat and I've encountered a problem. I have a nested form
that I've created using the steps similar to the Rails Casts

As context, I have a form for programming exercises with a title and
description. The form also has a field for the associated Hint object,
just a regular text area field for the hint text.

When I submit a form using webrat and cucumber my application receives
'params' with:

     "new_hint_attributes"=>"[{\"text\"=>\"This is hint 1\"}]"

The key 'new_hint_attributes' maps to a string causing the application
to crash during a cucumber test.

But when I submit the form using the browser my application receives
'params' with:

     "new_hint_attributes"=>[{"text"=>"This is hint 1"}]

The key 'new_hint_attributes' maps to an array and everything works

I was wondering what I might be doing wrong.

Also, I was wondering if this ticket my be related:

More information about the rspec-users mailing list