Frank
2010-May-04 19:51 UTC
[rspec-users] Expecting an array but getting a string using webrat
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 http://railscasts.com/episodes/75-complex-forms-part-3 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 fine. I was wondering what I might be doing wrong. Also, I was wondering if this ticket my be related: https://webrat.lighthouseapp.com/projects/10503/tickets/259-webratmechanize-treats-array-as-string
David Chelimsky
2010-May-07 12:35 UTC
[rspec-users] Expecting an array but getting a string using webrat
On May 4, 2010, at 2:51 PM, Frank wrote:> 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 > http://railscasts.com/episodes/75-complex-forms-part-3 > > 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 > fine. > > I was wondering what I might be doing wrong. > > Also, I was wondering if this ticket my be related: > https://webrat.lighthouseapp.com/projects/10503/tickets/259-webratmechanize-treats-array-as-stringI''m not sure about this myself, but you may want to check the Cucumber and Webrat lists since those are the libraries you''re seeing trouble with: http://groups.google.com/group/cukes http://groups.google.com/group/webrat
David Chelimsky
2010-May-07 12:36 UTC
[rspec-users] Expecting an array but getting a string using webrat
On May 7, 2010, at 7:35 AM, David Chelimsky wrote:> > On May 4, 2010, at 2:51 PM, Frank wrote: > >> 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 >> http://railscasts.com/episodes/75-complex-forms-part-3 >> >> 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 >> fine. >> >> I was wondering what I might be doing wrong. >> >> Also, I was wondering if this ticket my be related: >> https://webrat.lighthouseapp.com/projects/10503/tickets/259-webratmechanize-treats-array-as-string > > I''m not sure about this myself, but you may want to check the Cucumber and Webrat lists since those are the libraries you''re seeing trouble with: > > http://groups.google.com/group/cukes > http://groups.google.com/group/webratAh - I see you already did :) http://groups.google.com/group/webrat/browse_thread/thread/d8e6bac15cb8fbd7 Feel free to post back here if you find a solution. Thanks, David