[rspec-users] HTML array problem

itsterry itsterry at gmail.com
Wed Dec 2 08:40:47 EST 2009

Hi all. Apologies if this is an easy one, but I've spent a while
Googling and trying trial-and-error, and can't find the solution.

I'm trying to spec a controller.

It accepts an HTML array, then processes items matching the id param.

So I'm passing (in meta form)


The controller looks at the id, finds the ActiveRecord object which
matches id, then looks for the thing with a thing_id matching id and
processes it

The real example is a little involved, but a simpler example would be
something like


so that comment 4 is rated 10, and comment 5 is untouched

In my controller spec I've been trying (for the above easy example)

post 'comments/rate', :id=>4, :score=>{4=>10}

but my params array doesn't appear to be going through the test

This doesn't do it:
post 'comments/rate', :id=>4, :score[4]=>10

Nor this:
post 'comments/rate', :id=>4, :score['4']=>10

Nor this:
post 'comments/rate', :id=>4, "score[4]".to_sym=>10

Any ideas? Have I given enough info? Trying to give relevant details
without too much extraneous info.

Thanks in advance for any help!

More information about the rspec-users mailing list